Skip to content
Sarj Code Standards

directive-no-duplicate-disable

Disallow eslint-disable and oxlint-disable directives for rules that are already disabled there.

Why

A second disable directive for a rule that is already off changes nothing, and it stays behind as a stale exception when the first one is removed.

Fix

Delete the duplicate directive, or the rule name it repeats.

Examples

Before — flagged A line disable inside a block that already disables the rule
src/report.ts
/* eslint-disable no-console -- the CLI prints its report */
console.log(report); // eslint-disable-line no-console -- the CLI prints its report
/* eslint-enable no-console */
After — preferred One directive per suppressed rule
src/report.ts
/* eslint-disable no-console -- the CLI prints its report */
console.log(report);
/* eslint-enable no-console */

References