Can eslint be configured to report only a certain subset of errors without explicitly settings all other rules as false
My use case is I want to have a separate report for a11y related errors coming from eslint-plugin-jsx-a11y
So I have a package scripts like
"lint": "eslint .",
"lint.a11y": "eslint --no-eslintrc -c .eslintrc.a11y.js .",
The general config used in lint covers everything and is used in the IDE and during CI to validate code style
The lin.a11y serves only to provide a report on accessibility violations
Currently I use something like this (the idea was borrowed from eslint:all):
const builtInRules = require('eslint/lib/rules');
const disabledRules = {};
for (const [ruleId, rule] of builtInRules) {
if (!rule.meta.deprecated) {
disabledRules[ruleId] = 'off';
}
}
module.exports = {
parser: 'babel-eslint',
extends: ['plugin:jsx-a11y/recommended'],
plugins: ['jsx-a11y'],
rules: {
// Lint only a11y, disable other js style related rules
...disabledRules,
},
};
This almost works, but when there exception to the rules disabled with code comments (disable rule for the line). I'll get an error like "Definition for rule ... was not found":
Definition for rule 'react-hooks/exhaustive-deps' was not found react-hooks/exhaustive-deps
So now I have to import my default eslint configuration, extend it, disable any rules defined there, disable any other rules coming from other plugins, just so that errors for inline comments are disregarded