Skip to main content

no-unused-disable

Disallow eslint-disable comments that do not suppress any diagnostics.

Targeted pattern scopeโ€‹

This rule targets eslint-disable and related inline directive comments.

What this rule reportsโ€‹

This rule reports disable directives that are not actually used to suppress any rule violations.

Why this rule existsโ€‹

Unused disables hide lint signal, create maintenance noise, and can mask future issues if copied forward.

โŒ Incorrectโ€‹

/* eslint-disable no-alert */
const value = 1;

โœ… Correctโ€‹

/* eslint-disable no-alert */
alert("x");

Behavior and migration notesโ€‹

This rule forwards options and behavior to @eslint-community/eslint-comments/no-unused-disable.

Additional examplesโ€‹

/* eslint-disable no-console */
console.log("debug");
// โœ… valid: disable is used

/* eslint-disable no-console */
const value = 1;
// โŒ reported: disable directive is unused

ESLint flat config exampleโ€‹

import etcMisc from "eslint-plugin-etc-misc";

export default [
{
plugins: { "etc-misc": etcMisc },
rules: {
"etc-misc/no-unused-disable": "error",
},
},
];

When not to use itโ€‹

Disable this rule only during temporary migration windows where broad placeholder disables are explicitly managed.

Package documentationโ€‹

Rule catalog ID: R049

Further readingโ€‹

Adoption resourcesโ€‹

  • Start at warning level in CI, then move to error after cleanup.
  • Use focused codemods/autofix batches per package or directory.