oxc-project/oxc · error · OxcDiagnostic
Unused {} directive (no problems were reported from {rule_na
Error message
Unused {} directive (no problems were reported from {rule_name}). What it means
Diagnostic from create_unused_directives_diagnostics: a disable comment naming a specific rule produced no matching diagnostic in its span. The rule never fired (or was fixed), so the per-rule suppression is unused and may mask future regressions from that rule.
Source
Thrown at crates/oxc_linter/src/disable_directives.rs:1387
// Report unused disable comments
let unused_disable = directives.collect_unused_disable_comments();
for unused_comment in unused_disable {
let span = unused_comment.span;
match unused_comment.r#type {
RuleCommentType::All => {
diagnostics.push(
OxcDiagnostic::warn(unused_comment.directive_prefix.unused_disable_message())
.with_label(span)
.with_severity(severity),
);
}
RuleCommentType::Single(rules) => {
for rule in rules {
let rule_message =
rule.directive_prefix.unused_disable_rule_message(&rule.rule_name);
diagnostics.push(
OxcDiagnostic::warn(rule_message)
.with_label(rule.name_span)
.with_severity(severity),
);
}
}
}
}
// Report unused enable comments
let unused_enable = directives.unused_enable_comments();
for (directive_prefix, rule_name, span) in unused_enable {
let message = if let Some(rule_name) = rule_name {
directive_prefix.unused_enable_rule_message(rule_name)
} else {
directive_prefix.unused_enable_message()
};
diagnostics.push(OxcDiagnostic::warn(message).with_label(*span).with_severity(severity));
}View on GitHub (pinned to e1e7af627c)
Solutions
- Remove the stale rule-specific disable comment
- Re-run the linter after fixing the underlying issue so only needed disables remain
- Turn off reportUnusedDisableDirectives if stale comments are acceptable
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at crates/oxc_linter/src/disable_directives.rs:1387 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/2b2e89e90281285a.
Report an issue: GitHub.