“No ESLint configuration found” error

后端 未结 11 2207
故里飘歌
故里飘歌 2021-02-01 16:03

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

> $ grunt eslint
Running \"         


        
相关标签:
11条回答
  • 2021-02-01 16:16

    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());
    
    0 讨论(0)
  • 2021-02-01 16:21

    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.

    0 讨论(0)
  • 2021-02-01 16:22

    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.

    0 讨论(0)
  • 2021-02-01 16:22
    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!

    0 讨论(0)
  • 2021-02-01 16:25

    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)
            }
          },
        ],
      },
      // ...
    }
    
    0 讨论(0)
  • 2021-02-01 16:26

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

    Go to your project root & run in terminal

    ./node_modules/.bin/eslint --init
    
    0 讨论(0)
提交回复
热议问题