admin管理员组

文章数量:1318986

There is errors in my code:

Severity Code Description Project File Line Suppression State Error eqeqeq (ESLint) Expected '!==' and instead saw '!='.

I can't find where to disable ONLY the eqeqeq option.

Thanks in advance.

There is errors in my code:

Severity Code Description Project File Line Suppression State Error eqeqeq (ESLint) Expected '!==' and instead saw '!='.

I can't find where to disable ONLY the eqeqeq option.

Thanks in advance.

Share Improve this question edited Aug 16, 2019 at 3:25 craigcaulfield 3,53810 gold badges35 silver badges43 bronze badges asked Nov 2, 2018 at 7:42 Tigran PetrosyanTigran Petrosyan 1373 silver badges9 bronze badges 5
  • Where is your ESLint config? – VLAZ Commented Nov 2, 2018 at 7:44
  • I have no config eslint in my project. The error started after update of Visual Studio – Tigran Petrosyan Commented Nov 2, 2018 at 11:14
  • Then I guess you have to figure out where Visual Studio is getting the config from. – VLAZ Commented Nov 2, 2018 at 11:38
  • Thanks @vlaz, but I need to change this option in generally, not in my local config file Or maybe we can supress some warning like it is done in framework where in project properties you can add suppress warnings – Tigran Petrosyan Commented Nov 3, 2018 at 13:04
  • Hence why I said you have to find where the config for VS is. So you can modify that. – VLAZ Commented Nov 3, 2018 at 13:08
Add a ment  | 

1 Answer 1

Reset to default 6

To turn off the eqeqeq rule everywhere:

  1. Open Windows Explorer with Windows Key + E
  2. Paste exactly this into your URL bar: %USERPROFILE% and hit Enter
  3. Find the file .eslintrc
  4. Right-click
  5. open with..., Notepad (or your favorite text editor)
  6. Find:
"rules": {
    "eqeqeq": "always",

and change it to "off" to disable, or "smart" (see below):

"rules": {
    "eqeqeq": "off",

smart

The "smart" option enforces the use of === and !== except for these cases:

Comparing two literal values
Evaluating the value of typeof
Comparing against null
  1. Then, Restart Visual Studio for it to take effect.

Link for more information:

https://eslint/docs/rules/eqeqeq


To turn off the eqeqeq rule on a per file basis, paste this at the top of your .js file:

/*eslint eqeqeq: "off"*/


To turn off the all ESLint functionality on a per-project basis, create a file named .eslintrc.json in your project's root folder, (or any folder you want ESLint turned off), with the following contents:

{ }

本文标签: javascriptCan39t change ESlint eqeqeq option to quotsmartquotStack Overflow