Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Eslint: warning File ignored by default. Use a negated ignore pattern

I am new in using Eslint.

So far I have installed Eslint in my local project and configured it. The eslintrc.js file contains

module.exports = {
  env: {
    node: true,
    commonjs: true,
    es6: true,
    mocha: true,
  },
  extends: [
    'airbnb-base',
  ],
  globals: {
    Atomics: 'readonly',
    SharedArrayBuffer: 'readonly',
  },
  parserOptions: {
    ecmaVersion: 2018,
  },
  rules: {
  },
};

And in package.json I have

  "scripts": {
    "lint": "eslint .eslintrc.js --fix",
}

In terminal I run

npm run lint

And the output is

> [email protected] lint C:\nodeprojects\restapi
> eslint .eslintrc.js --fix


C:\nodeprojects\restapi\.eslintrc.js
  0:0  warning  File ignored by default.  Use a negated ignore pattern (like "--ignore-pattern '!<relative/path/to/filename>'") to override

But if I run

eslint <foldername> --fix then it works.

I am using webstorm IDE and in windows os.

Any help is highly appreciated.

like image 289
Prithviraj Mitra Avatar asked Sep 15 '19 19:09

Prithviraj Mitra


1 Answers

Your npm script runs the linter on the .eslintrc.js file and this file is as the comment says File ignored by default.

You need to change the lint script from:

"lint": "eslint .eslintrc.js --fix",

to:

"lint": "eslint <foldername> --fix"

Where <foldername> is the correct folder.

like image 67
Mac_W Avatar answered Sep 20 '22 10:09

Mac_W