“No ESLint configuration found” error

天大地大妈咪最大 提交于 2019-12-02 22:01:10
Arkadiusz Lendzian

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.

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.

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

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.

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());

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)
        }
      },
    ],
  },
  // ...
}
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!

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

 {
    "parserOptions": {
         "ecmaVersion": 6,
         "sourceType": "module",
         "ecmaFeatures": {
             "jsx": true
         }
    },
    "rules": {
        "semi": "error"
    }
}
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!