eslint-formatter-skip
is library that adds eslint-disable
comments for each file that cannot be automatically fix by eslint.
This is useful when you get a lot of errors after changing the rules, updating versions, add plugins.
yarn add -D eslint-formatter-skip
# or
# npm i -save-dev eslint-formatter-skip
Please be careful as the file will be overwritten
yarn eslint -f skip src
Example code.
// ./testdata/index.js
var x; // error: unused-vars
var b = "b";
var ab = "a" + b; // error: prefer-template
console.log(ab);
eslint rules.
// ./testdata/.eslintrc.js
module.exports = {
parserOptions: {
ecmaVersion: 2015,
},
rules: {
"no-unused-vars": ["error"],
"prefer-template": ["error"],
},
};
With autofix. yarn eslint -f skip --fix ./testdata
/* eslint-disable no-unused-vars */
var x; // error: unused-vars
var b = "b";
var ab = `a${ b}`; // error: prefer-template
console.log(ab);
Without autofix. yarn eslint -f skip ./testdata
/* eslint-disable no-unused-vars, prefer-template */
var x; // error: unused-vars
var b = "b";
var ab = "a" + b; // error: prefer-template
console.log(ab);