directive-no-use
Disallow directive comments, eslint-* or oxlint-*, except the allowed kinds, and check block-directive pairing.
Why
Block disables and inline rule configuration hide diagnostics for whole regions of a file. Allowing only line-scoped directives keeps each exception next to the code it excuses. A block disable without an enable directive switches the rule off for the rest of the file, including code written long after the exception was reviewed. When one enable directive closes several disable directives, removing one exception means editing a shared comment, and it is easy to re-enable a rule early or leave one off. An enable directive with nothing to close is left over from an exception that is gone, and it misleads readers into looking for one.
Fix
Replace the directive with one of the allowed kinds, usually an eslint-disable-next-line comment that names the rule and the reason.
Examples
/* eslint-disable no-console -- the CLI prints its report */console.log(report);// eslint-disable-next-line no-console -- the CLI prints its reportconsole.log(report);References
- https://eslint-community.github.io/eslint-plugin-eslint-comments/rules/no-use.html
- https://oxc.rs/docs/guide/usage/linter/ignore-comments
- https://eslint-community.github.io/eslint-plugin-eslint-comments/rules/disable-enable-pair.html
- https://eslint-community.github.io/eslint-plugin-eslint-comments/rules/no-aggregating-enable.html
- https://eslint-community.github.io/eslint-plugin-eslint-comments/rules/no-unused-enable.html
Formerly: directive-disable-enable-pair, directive-no-aggregating-enable, directive-no-unused-enable