oxc-project/oxc · error · OxcDiagnostic

Unused {} directive (no problems were reported).

Error message

Unused {} directive (no problems were reported).

What it means

Diagnostic from create_unused_directives_diagnostics (report_unused directives): an oxlint-disable (or eslint-disable) comment with no rule list was collected as unused, meaning no problems were actually reported in the span it covers, so the blanket suppression is dead weight that hides future lint regressions.

Source

Thrown at crates/oxc_linter/src/disable_directives.rs:1377

) -> Vec<oxc_diagnostics::OxcDiagnostic> {
    use oxc_diagnostics::OxcDiagnostic;

    let mut diagnostics = Vec::new();

    let severity = if severity == crate::AllowWarnDeny::Deny {
        oxc_diagnostics::Severity::Error
    } else {
        oxc_diagnostics::Severity::Warning
    };

    // 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),
                    );
                }
            }
        }
    }

View on GitHub (pinned to e1e7af627c)

Solutions

  1. Delete the unused disable comment
  2. Narrow the comment to the specific rules that actually fire
  3. If suppression is still needed in CI, disable the reportUnusedDisableDirectives option
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at crates/oxc_linter/src/disable_directives.rs:1377 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/d28d0200945bf9df. Report an issue: GitHub.