oxc-project/oxc · error · OxcDiagnostic

Unused {} directive (no matching {} directives were found).

Error message

Unused {} directive (no matching {} directives were found).

What it means

Diagnostic from create_unused_directives_diagnostics: a bare oxlint-enable/eslint-enable comment had no matching disable directive anywhere in the file, so re-enabling rules that were never disabled is a no-op and signals a mistaken or leftover comment.

Source

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

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

    diagnostics
}

#[cfg(test)]
mod tests {
    use oxc_allocator::Allocator;
    use oxc_ast::Comment;
    use oxc_parser::Parser;
    use oxc_semantic::{Semantic, SemanticBuilder};
    use oxc_span::{SourceType, Span};

    use crate::disable_directives::{
        DirectivePrefix, DisabledRule, RuleCommentRule, RuleCommentType,
    };

    use super::{DisableDirectives, DisableDirectivesBuilder};

View on GitHub (pinned to e1e7af627c)

Solutions

  1. Delete the orphaned enable comment
  2. Add the matching disable directive if suppression was intended
Defensive patterns

Strategy: validation

When it happens

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