{"record":{"id":"18b749631e0f778f","repo":"oxc-project/oxc","slug":"pronoun-is-verb-but-only-used-as-a-type-suffi","errorCode":null,"errorMessage":"{pronoun} is {verb} but only used as a type.{suffix}","messagePattern":"(.+?) is (.+?) but only used as a type\\.(.+?)","errorType":"validation","errorClass":"OxcDiagnostic","httpStatus":null,"severity":"warning","filePath":"crates/oxc_linter/src/rules/eslint/no_unused_vars/diagnostic.rs","lineNumber":80,"sourceCode":"pub 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.\")\n    } else {\n        (\"declared\", \"Consider removing this declaration.\")\n    };\n    let name = symbol.name();\n    let (pronoun, pronoun_plural) = pronoun_for_symbol(symbol.flags());\n    let suffix = pat.diagnostic_help(pronoun_plural);\n\n    OxcDiagnostic::warn(if only_used_as_type {\n        format!(\"{pronoun} is {verb} but only used as a type.{suffix}\")\n    } else {\n        format!(\"{pronoun} '{name}' is {verb} but never used.{suffix}\")\n    })\n    .with_label(symbol.span().label(format!(\"'{name}' is declared here\")))\n    .with_help(help)\n}\n\n/// Variable 'x' is assigned a value but never used.\npub fn assign<R>(\n    symbol: &Symbol<'_, '_>,\n    assign_span: Span,\n    pat: &IgnorePattern<R>,\n) -> OxcDiagnostic\nwhere\n    R: fmt::Display,\n{\n    let name = symbol.name();\n    let (pronoun, pronoun_plural) = pronoun_for_symbol(symbol.flags());","sourceCodeStart":62,"sourceCodeEnd":98,"githubUrl":"https://github.com/oxc-project/oxc/blob/e1e7af627c8843ab64044ed466b128fcc21a035b/crates/oxc_linter/src/rules/eslint/no_unused_vars/diagnostic.rs#L62-L98","documentation":"Diagnostic of no-unused-vars: the binding's only references are in type positions (TS type annotations, typeof types, interfaces), so it is unused as a runtime value. {verb} is 'declared' for normal bindings or 'caught' for catch parameters; {suffix} appends ignore-pattern guidance.","triggerScenarios":"const Greeting = 'hello'; referenced only via type T = typeof Greeting; a catch parameter only used inside a type annotation; type-level constants whose value is never read.","commonSituations":"Migrating value constants to type-only usage during a TS refactor; codegen emitting runtime constants only consumed by types; keeping values around after switching to literal types.","solutions":["Remove the runtime declaration and express the type directly (e.g. export type Greeting = 'hello').","For imports used only as types, switch to import type { X }.","If intentional, match it with varsIgnorePattern or prefix the name with an underscore."],"exampleFix":"// before\nconst Greeting = 'hello';\ntype G = typeof Greeting;\n// after\nexport type Greeting = 'hello';\ntype G = Greeting;","handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":["Use import type / export type for type-only bindings so value-ness is explicit.","During TS migrations, replace runtime constants that only feed types with literal type aliases.","Run oxlint with no-unused-vars in CI to catch type-only leftovers immediately."],"tags":["eslint","oxlint","unused-vars","typescript","type-only"],"backgroundTag":"variable-only-used-as-type","analyzedSha":"e1e7af627c8843ab64044ed466b128fcc21a035b","analyzedAt":"2026-08-20T07:01:07.079Z","contentChangedAt":"2026-08-20T07:01:07.079Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}