ESLint rules with modified behavior or additional options that won't be merged into upstream for "as designed" or "stylistic features frozen" etc. reasons.
Just clone the repo or download it as tarball and unpack
Improved rules could be used as replacements to stock ones (just move them to %{eslint}/lib/rules
folder)
but it's easier and more correct to add them as custom rule set.
-
Via command line: run ESLint with parameter
--rulesdir <path to ESLint-custom-rules>
-
With VSCode and ESLint plugin by Dirk Baeumer - add following lines to
settings.json
(noterulePaths
property notrulesdir
!)"eslint.options": { "rulePaths": ["<path to ESLint-custom-rules>"] },
Modification: detects Node-specific event listener assignments and doesn't alert in these cases.
Issues: eslint/eslint#11349 ("Node-specific"), mysticatea/eslint-plugin-node#4 (no reaction)
Before:
process.on('exit', function() { console.log(this.argv); });
// Message "Unexpected 'this'"
After:
process.on('exit', function() { console.log(this.argv); });
// OK
Modification: add ignoreConstDeclaration: boolean
option which, if enabled, allows numbers in declaration of constants.
Issue: eslint/eslint#13239 ("As intended" + "freeze stylistic rules")
// no-magic-numbers: "error"
const MSEC_PER_MIN = 60 * 1000;
const DEF_OPTS = { timeout: 10 * MSEC_PER_MIN };
// Messages "No magic number: " for 60, 1000 and 10
// no-magic-numbers: ["error", { "ignoreConstDeclaration": true }]
const MSEC_PER_MIN = 60 * 1000;
const DEF_OPTS = { timeout: 10 * MSEC_PER_MIN };
// OK
let interv = 20 * MSEC_PER_MIN;
console.log( 1 * 2 * 3);
// Will still produce messages
Modification: add allowAfter: string[]
option which defines list of identifiers after which dangling underscores are allowed.
PR: eslint/eslint#13590 ("Freeze stylistic rules")
// no-underscore-dangle: "error"
const self = this;
some.on('event', function() {
self._private();
});
// Message "Unexpected dangling '_' in '_private'"
// no-underscore-dangle: ["error", { "allowAfter": [ "self" ] }]
const self = this;
some.on('event', function() {
self._private();
});
// OK