Limit maximum number of errors

寵の児 提交于 2021-02-10 06:32:32

问题


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

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!