Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

"No ESLint configuration found" error

Recently, we've upgraded to ESLint 3.0.0 and started to receive the following message running the grunt eslint task:

> $ grunt eslint
Running "eslint:files" (eslint) task
Warning: No ESLint configuration found. Use --force to continue.

Here is the grunt-eslint configuration:

var lintTargets = [
    "<%= app.src %>/**/*/!(*test|swfobject)+(.js)",
    "test/e2e/**/*/*.js",
    "!test/e2e/db/models/*.js"
];
module.exports.tasks = {
    eslint: {
        files: {
            options: {
                config: 'eslint.json',
                fix: true,
                rulesdir: ['eslint_rules']
            },
            src: lintTargets
        }
    }
};

What should we do to fix the error?

like image 423
alecxe Avatar asked Jul 03 '16 18:07

alecxe


People also ask

How do I configure Eslint?

There are two primary ways to configure ESLint: Configuration Comments - use JavaScript comments to embed configuration information directly into a file. Configuration Files - use a JavaScript, JSON, or YAML file to specify configuration information for an entire directory and all of its subdirectories.

Where is Eslint config file?

The ESLint configuration is in the ./node_modules/@spm/eslint-config/index. js file. To check the code for ESLint violations, run the following command in the application root directory. Errors are listed in the console.


4 Answers

The error you are facing is because your configuration is not present. To configure the eslint type

eslint --init

then configure as your requirement.

then execute the project again.

like image 198
ankit biswas Avatar answered Sep 24 '22 20:09

ankit biswas


Try to swap config with configFile. Then :

  1. Create eslint.json file and
  2. Point the right location of it (relative to Gruntfile.js file)
  3. Place some configuration in that file (eslint.json), i.e.:

.

{
    "rules": {
        "eqeqeq": "off",
        "curly": "warn",
        "quotes": ["warn", "double"]
    }
}

for more examples, go here.

like image 24
Arkadiusz Lendzian Avatar answered Sep 25 '22 20:09

Arkadiusz Lendzian


I've had the same error. It seems to need configuration.

Go to your project root & run in terminal

./node_modules/.bin/eslint --init
like image 37
Shiva Avatar answered Sep 24 '22 20:09

Shiva


I hade the same problem with Gulp and running "gulp-eslint": "^3.0.1" version. I had to rename config: to configFile in Gulp task

.pipe(lint({configFile: 'eslint.json'}))
like image 16
ap_snitch Avatar answered Sep 24 '22 20:09

ap_snitch