oxc-project/oxc · error · OxcDiagnostic
Unexpected `eslint-disable` comment that does not specify an
Error message
Unexpected `eslint-disable` comment that does not specify any rules to disable.
What it means
Raised by unicorn/no-abusive-eslint-disable when an `eslint-disable` comment carries no rule names, so it blanket-suppresses every rule on the next line. The helper selects this message for the ESLint directive prefix; the faulting input is the bare disable comment at the labeled span.
Source
Thrown at crates/oxc_linter/src/rules/unicorn/no_abusive_eslint_disable.rs:23
use crate::{
context::LintContext,
disable_directives::{DirectivePrefix, RuleCommentType},
rule::Rule,
};
fn no_abusive_eslint_disable_diagnostic(
span: Span,
directive_prefix: DirectivePrefix,
) -> OxcDiagnostic {
let message = match directive_prefix {
DirectivePrefix::Eslint => {
"Unexpected `eslint-disable` comment that does not specify any rules to disable."
}
DirectivePrefix::Oxlint => {
"Unexpected `oxlint-disable` comment that does not specify any rules to disable."
}
};
OxcDiagnostic::warn(message)
.with_help("Specify the rules you want to disable.")
.with_label(span)
}
#[derive(Debug, Default, Clone)]
pub struct NoAbusiveEslintDisable;
declare_oxc_lint!(
/// ### What it does
///
/// Disallows `oxlint-disable` or `eslint-disable` comments without specifying rules.
///
/// ### Why is this bad?
///
/// A general `oxlint-disable` or `eslint-disable` comment suppresses all lint errors, not just the intended one,
/// potentially hiding useful warnings and making debugging harder.
///
/// ### ExamplesView on GitHub (pinned to e1e7af627c)
Solutions
- Append the specific rule names to the comment, e.g. `// eslint-disable-next-line rule-name`
- Delete the comment if no rule actually needs suppressing
- Fix the underlying lint error instead of disabling it
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at crates/oxc_linter/src/rules/unicorn/no_abusive_eslint_disable.rs:23 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of oxc-project/oxc@e1e7af627c (2026-08-20).
Data as JSON: /api/errors/78631c569c799c42.
Report an issue: GitHub.