💼 This rule is enabled in the ✅ recommended
config.
This rule makes you specify the rules you want to disable when using eslint-disable
, eslint-disable-line
or eslint-disable-next-line
comments.
If you want to disable an ESLint rule in a file or on a specific line, you can add a comment.
On a single line:
const message = 'foo';
console.log(message); // eslint-disable-line no-console
// eslint-disable-next-line no-console
console.log(message);
On the whole (rest of the) file:
/* eslint-disable no-console */
const message = 'foo';
console.log(message);
You don't have to specify any rules (like no-console
in the examples above), but you should, as you might otherwise hide useful errors.
/* eslint-disable */
console.log(message); // `message` is not defined, but it won't be reported
This rule enforces specifying the rules to disable. If you want to disable ESLint on a file altogether, you should ignore it through .eslintignore
for ESLint or through the ignores
property in package.json
for XO
.
/* eslint-disable */
console.log(message);
console.log(message); // eslint-disable-line
// eslint-disable-next-line
console.log(message);
/* eslint-disable no-console */
console.log(message);
console.log(message); // eslint-disable-line no-console
// eslint-disable-next-line no-console
console.log(message);