{"record":{"id":"8460e6db286bf27a","repo":"oxc-project/oxc","slug":"parameter-name-is-declared-but-never-used-suf","errorCode":null,"errorMessage":"Parameter '{name}' is declared but never used.{suffix}","messagePattern":"Parameter '(.+?)' is declared but never used\\.(.+?)","errorType":"validation","errorClass":"OxcDiagnostic","httpStatus":null,"severity":"warning","filePath":"crates/oxc_linter/src/rules/eslint/no_unused_vars/diagnostic.rs","lineNumber":128,"sourceCode":"pub fn param<R>(\n    symbol: &Symbol<'_, '_>,\n    pat: &IgnorePattern<R>,\n    only_used_as_type: bool,\n) -> OxcDiagnostic\nwhere\n    R: fmt::Display,\n{\n    let name = symbol.name();\n    let suffix = if name == \"_\" && pat.is_default() {\n        std::borrow::Cow::Borrowed(\"\")\n    } else {\n        pat.diagnostic_help(\"parameters\")\n    };\n\n    OxcDiagnostic::warn(if only_used_as_type {\n        format!(\"Parameter '{name}' is declared but only used as a type.{suffix}\")\n    } else {\n        format!(\"Parameter '{name}' is declared but never used.{suffix}\")\n    })\n    .with_label(symbol.span().label(format!(\"'{name}' is declared here\")))\n    .with_help(\"Consider removing this parameter.\")\n}\n\n/// Identifier 'x' imported but never used.\npub fn imported(symbol: &Symbol<'_, '_>) -> OxcDiagnostic {\n    let (pronoun, _) = pronoun_for_symbol(symbol.flags());\n    let name = symbol.name();\n\n    OxcDiagnostic::warn(format!(\"{pronoun} '{name}' is imported but never used.\"))\n        .with_label(symbol.span().label(format!(\"'{name}' is imported here\")))\n        .with_help(\"Consider removing this import.\")\n}\n","sourceCodeStart":110,"sourceCodeEnd":143,"githubUrl":"https://github.com/oxc-project/oxc/blob/e1e7af627c8843ab64044ed466b128fcc21a035b/crates/oxc_linter/src/rules/eslint/no_unused_vars/diagnostic.rs#L110-L143","documentation":"Fires when the no_unused_vars rule finds a function parameter binding that is never referenced in the function body (or only inside type positions when only_used_as_type is true). The suffix carries ignore-pattern help text, or is empty for the default '_' parameter under the default ignore pattern.","triggerScenarios":"items.map((item, index) => item * 2) with index unused; function f(a, b) { return a; }; interface method implementations with unused parameters.","commonSituations":"Framework callbacks with fixed signatures (express handlers, React props, test runners); unused arguments positioned before used ones; refactors that dropped the last use of a parameter.","solutions":["Rename to _index / _ to match the default underscore ignore convention.","Remove the parameter entirely when it is trailing and unneeded: items.map((item) => ...).","Tune rule options (args, argsIgnorePattern) in .oxlintrc.json to your team's strictness.","Use rest parameters to absorb ignored positionals when arity must be preserved."],"exampleFix":"// before\nitems.map((item, index) => item * 2);\n// after\nitems.map((item, _index) => item * 2);\n// or: items.map((item) => item * 2);","handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":["Name ignored positional parameters with a leading underscore (_index).","Drop trailing unused parameters outright: (item) => ... instead of (item, _index) => ... when arity allows.","Set args/argsIgnorePattern options once in .oxlintrc.json to encode team convention."],"tags":["eslint","oxlint","unused-vars","parameters"],"backgroundTag":"unused-function-parameter","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"}