问题
How to limit maximum number of error in eslint through .eslintrc. My current .eslintrc
module.exports = {
"extends": "airbnb",
"parserOptions": {
"ecmaVersion": 6
},
"max-warnings" : 2
};
回答1:
Currently, max-warnings
is a command-line only option. You can't define it in a .eslintrc
file. See eslint#2769.
There are a couple of alternatives you can use, depending on how you are runnning eslint. You can use something like eslint-nibble to address a subset of the errors one at a time, and see that subset.
Another option if you're using a task runner is to use its built in options. For example, if you're using gulp-eslint
you can fail on/after the first error using failOnError/failAfterError:
var eslint = require('gulp-eslint'),
gulp = require('gulp');
gulp.src('**/*.js')
.pipe(eslint())
.pipe(eslint.failAfterError());
来源:https://stackoverflow.com/questions/36866954/limit-maximum-number-of-errors