alecxe
alecxe

Reputation: 474111

"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?

Upvotes: 52

Views: 176724

Answers (11)

Jonas_Hess
Jonas_Hess

Reputation: 2018

We faced this problem today and realized, that the issue was not caused inside the project that we were working on, but inside a package that we had a link on using the command:

yarn link

Which is a feature often useful to test out new features or when trying to debug an issue in a package that manifests itself in another project. We solved it by either removing the link, or in case of ember.js disabling the developer mode of our addon package.

index.js

module.exports = {
    isDevelopingAddon: function() {
      return false;
    },
    ...
}

Upvotes: 2

Shiva
Shiva

Reputation: 769

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

Go to your project root & run in terminal

./node_modules/.bin/eslint --init

Upvotes: 56

premji012
premji012

Reputation: 31

Run the command ember init. When it asks for overwriting the existing file(s). Type n to skipping overwriting the file. Now it will automatically create required files like .eslintrc, etc.

For me the same issue occurred when i copied my folder except dist, dist_production and node_modules folder to another system and tried running ember build.

Upvotes: 1

Serhat T&#252;rkman
Serhat T&#252;rkman

Reputation: 403

Create a new file on the root directory called .eslintrc.json file:

 {
    "parserOptions": {
         "ecmaVersion": 6,
         "sourceType": "module",
         "ecmaFeatures": {
             "jsx": true
         }
    },
    "rules": {
        "semi": "error"
    }
}

Upvotes: 5

lord5et
lord5et

Reputation: 500

Webpack

I had eslint.rc file in my root project directory but event though I was getting error.
Solution was to add exclude property to "eslint-loader" rule config:

module.exports = {
  // ...
  module: {
    rules: [
      {
        test: /\.js$/,
        exclude: /node_modules/,
        loader: "eslint-loader",
        options: {
          // eslint options (if necessary)
        }
      },
    ],
  },
  // ...
}

Upvotes: 2

Arkadiusz Lendzian
Arkadiusz Lendzian

Reputation: 427

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.

Upvotes: 31

ankit biswas
ankit biswas

Reputation: 477

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.

Upvotes: 46

Mantu Nigam
Mantu Nigam

Reputation: 4040

Just follow the steps
1.create eslint config file name eslintrc.json
2.place the code as given below

gulp.src(jsFiles)
        // eslint() attaches the lint output to the "eslint" property
        // of the file object so it can be used by other modules.
        .pipe(eslint({configFile: 'eslintrc.json'}))
        // eslint.format() outputs the lint results to the console.
        // Alternatively use eslint.formatEach() (see Docs).
        .pipe(eslint.format())
        // To have the process exit with an error code (1) on
        // lint error, return the stream and pipe to failAfterError last.
        .pipe(eslint.failAfterError());

Upvotes: 2

Seven
Seven

Reputation: 609

gulp.task('eslint',function(){
return gulp.src(['src/*.js'])
    .pipe(eslint())
    .pipe(eslint.format())
});


`touch .eslintrc`  instead of .eslint

these two steps may help you!

Upvotes: 1

ap_snitch
ap_snitch

Reputation: 367

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'}))

Upvotes: 16

alecxe
alecxe

Reputation: 474111

For those having the same problem, this is how we've fixed it.

Following the Requiring Configuration to Run migration procedure, we had to rename eslint.json to .eslintrc.json which is one of the default ESLint config file names now.

We've also removed the config grunt-eslint option.

Upvotes: 8

Related Questions