{"record":{"id":"71badd044e12e364","repo":"oxc-project/oxc","slug":"pronoun-singular-name-is-marked-as-ignored-b","errorCode":null,"errorMessage":"{pronoun_singular} '{name}' is marked as ignored but is used.","messagePattern":"(.+?) '(.+?)' is marked as ignored but is used\\.","errorType":"validation","errorClass":"OxcDiagnostic","httpStatus":null,"severity":"warning","filePath":"crates/oxc_linter/src/rules/eslint/no_unused_vars/diagnostic.rs","lineNumber":53,"sourceCode":"\npub fn used_ignored<R>(symbol: &Symbol<'_, '_>, pat: &IgnorePattern<R>) -> OxcDiagnostic\nwhere\n    R: fmt::Display,\n{\n    let (pronoun_singular, _) = pronoun_for_symbol(symbol.flags());\n    let name = symbol.name();\n\n    let help_suffix = match pat {\n        IgnorePattern::None => \".\".into(),\n        IgnorePattern::Default | IgnorePattern::PrefixUnderscore => {\n            name.strip_prefix('_').map_or(\".\".into(), |name| format!(\" to '{name}'.\"))\n        }\n        IgnorePattern::Some(r) => {\n            format!(\" to match the pattern /{r}/.\")\n        }\n    };\n\n    OxcDiagnostic::warn(format!(\"{pronoun_singular} '{name}' is marked as ignored but is used.\"))\n        .with_label(symbol.span().label(format!(\"'{name}' is declared here\")))\n        .with_help(format!(\n            \"Consider renaming this {}{help_suffix}\",\n            pronoun_singular.cow_to_ascii_lowercase()\n        ))\n}\n\n/// Variable 'x' is declared but never used.\npub fn declared<R>(\n    symbol: &Symbol<'_, '_>,\n    pat: &IgnorePattern<R>,\n    only_used_as_type: bool,\n) -> OxcDiagnostic\nwhere\n    R: fmt::Display,\n{\n    let (verb, help) = if symbol.flags().is_catch_variable() {\n        (\"caught\", \"Consider handling this error.\")","sourceCodeStart":35,"sourceCodeEnd":71,"githubUrl":"https://github.com/oxc-project/oxc/blob/e1e7af627c8843ab64044ed466b128fcc21a035b/crates/oxc_linter/src/rules/eslint/no_unused_vars/diagnostic.rs#L35-L71","documentation":"Diagnostic of oxlint's no-unused-vars for ignore-pattern drift: a binding matches your varsIgnorePattern/argsIgnorePattern (or the default underscore convention) yet it IS referenced in code. The message tells you the ignore marker on a used symbol is misleading and suggests renaming so it no longer matches.","triggerScenarios":"Configuration sets argsIgnorePattern \"^_\" (or enables reporting of ignored-but-used bindings) and code declares function f(_count) { return _count + 1; } where _count is read in the body.","commonSituations":"Underscore-prefixed params that later gain real uses after a refactor; overly broad ignore patterns that swallow genuine names; copy-pasting ignored names into used positions.","solutions":["Rename the variable to drop the underscore/ignore marker since it is genuinely used.","Tighten the ignore pattern (e.g. ^_ instead of _ anywhere) so it stops matching this name.","If the ignore is deliberate for tooling reasons, disable the ignored-but-used reporting for the rule."],"exampleFix":"// before (argsIgnorePattern: \"^\")\nfunction f(_count) { return _count + 1; }\n// after\nfunction f(count) { return count + 1; }","handlingStrategy":"validation","validationCode":"// sanity-check your pattern against names you actually use:\nconst argsIgnorePattern = /^_/;\nconst usedNames = ['_count', 'total'];\nfor (const n of usedNames) if (argsIgnorePattern.test(n)) console.warn(`${n} is used but ignored`);","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Reserve underscore/ignore-pattern names for genuinely unused bindings; rename them the moment a use appears.","Keep ignore patterns tight (e.g. ^_ rather than _ anywhere).","Turn on ignored-but-used reporting so pattern/code drift is detected automatically."],"tags":["eslint","oxlint","unused-vars","ignore-pattern","naming"],"backgroundTag":"unused-vars-ignore-pattern","analyzedSha":"e1e7af627c8843ab64044ed466b128fcc21a035b","analyzedAt":"2026-08-20T07:01:07.079Z","contentChangedAt":"2026-08-20T07:01:07.079Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}