Skip to content
Sarj Code Standards

directive-no-unused-enable

Disallow eslint-enable and oxlint-enable directives for rules that are not disabled.

Why

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

Delete the enable directive, or the rule name it does not need.

Examples

Before — flagged An enable directive with no disable directive before it
src/report.ts
console.log(report);
/* eslint-enable no-console */
After — preferred An enable directive that closes a disable directive
src/report.ts
/* eslint-disable no-console -- the CLI prints its report */
console.log(report);
/* eslint-enable no-console */

References