Skip to content

@eslint-community/eslint-comments/disable-enable-pair

require a eslint-enable comment for every eslint-disable comment

  • 🌟 The "extends": "plugin:@eslint-community/eslint-comments/recommended" property in a configuration file enables this rule.

eslint-disable directive-comments disable ESLint rules in all lines preceded by the comment. If you forget eslint-enable directive-comment, you may overlook ESLint warnings unintentionally.

This rule warns eslint-disable directive-comments if the eslint-enable directive-comment for that does not exist.

Rule Details

Examples of 👎 incorrect code for this rule:

Now loading...
Now loading...

Examples of 👍 correct code for this rule:

Now loading...
Now loading...

Options

The allowWholeFile option lets you allow disabling rules for the entire file while still catching "open" eslint-disable directives in the middle of a file.

json
{
    "@eslint-community/eslint-comments/disable-enable-pair": ["error", {"allowWholeFile": true}]
}

Examples of 👎 incorrect code for this rule:

Now loading...

Examples of 👍 correct code for this rule:

Now loading...