unicorn/no-abusive-eslint-disable
Require eslint-disable comments to name the rules they turn off
An eslint-disable comment without a rule name turns off every rule. You add it to silence one report, and it also hides every other problem on that line or in that file, now and later.
The rule checks eslint-disable, eslint-disable-line, and eslint-disable-next-line, and the same comments that start with oxlint-.
Configure#
Off by default. To turn it on:
bunfig.toml
[lint.rules]
"unicorn/no-abusive-eslint-disable" = "error" # or "warn"Examples#
example.js3 problems
console.log(user.name); // eslint-disable-lineUnexpected eslint-disable comment that does not specify any rules to disable.
// oxlint-disable-next-lineUnexpected oxlint-disable comment that does not specify any rules to disable.
console.log(user.email);
/* eslint-disable Unexpected eslint-disable comment that does not specify any rules to disable.*/
console.log(user.id);
/* eslint-enable */A reason after -- isn't a rule name:
example.js1 problem
console.log(user.name); // eslint-disable-line -- needed for debuggingUnexpected eslint-disable comment that does not specify any rules to disable.example.jsNo problems
console.log(user.name); // eslint-disable-line no-console
// oxlint-disable-next-line no-console, no-undef
console.log(user.email);
/* eslint-disable no-console */
console.log(user.id);
/* eslint-enable no-console */