Skip to content
Sarj Code Standards

directive-no-restricted-disable

Disallow eslint-disable and oxlint-disable directives that turn off a restricted rule or every rule.

Why

Some rules guard policy that a local exception must not waive, such as the suppression rules themselves. A directive that disables every rule also disables those.

Fix

Fix the reported code instead, or name only rules that may be disabled.

Examples

Before — flagged Disabling a restricted rule
src/report.ts
// eslint-disable-next-line no-console -- the CLI prints its report
console.log(report);
After — preferred Disabling a rule that is not restricted
src/report.ts
// eslint-disable-next-line no-debugger -- a breakpoint for the demo
debugger;

Options

{ "items": { "type": "string" }, "type": "array", "uniqueItems": true }

References