Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can't change ESlint eqeqeq option to "smart"

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.

like image 399
Tigran Petrosyan Avatar asked Nov 02 '18 07:11

Tigran Petrosyan


1 Answers

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.org/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:

{ }

like image 61
Sean Kendle Avatar answered Sep 30 '22 04:09

Sean Kendle