oxc-project/oxc · warning · OxcDiagnostic
{pronoun} '{name}' is imported but never used.
Error message
{pronoun} '{name}' is imported but never used. What it means
no-unused-vars import variant: an imported binding is never referenced, so the import is dead code that obscures real dependencies and can bloat bundles in toolchains that cannot tree-shake. The label points at the import span.
Source
Thrown at crates/oxc_linter/src/rules/eslint/no_unused_vars/diagnostic.rs:139
} else {
pat.diagnostic_help("parameters")
};
OxcDiagnostic::warn(if only_used_as_type {
format!("Parameter '{name}' is declared but only used as a type.{suffix}")
} else {
format!("Parameter '{name}' is declared but never used.{suffix}")
})
.with_label(symbol.span().label(format!("'{name}' is declared here")))
.with_help("Consider removing this parameter.")
}
/// Identifier 'x' imported but never used.
pub fn imported(symbol: &Symbol<'_, '_>) -> OxcDiagnostic {
let (pronoun, _) = pronoun_for_symbol(symbol.flags());
let name = symbol.name();
OxcDiagnostic::warn(format!("{pronoun} '{name}' is imported but never used."))
.with_label(symbol.span().label(format!("'{name}' is imported here")))
.with_help("Consider removing this import.")
}
View on GitHub (pinned to e1e7af627c)
Solutions
- Delete the unused specifier (or the whole import statement if no specifiers remain).
- If it is only used as a type, convert to import type { X }.
- Run an organize-imports fixer (editor action or oxlint --fix where configured) before committing.
Example fix
// before
import { ref, computed } from 'vue';
export const x = 1;
// after
export const x = 1; Defensive patterns
Strategy: validation
Prevention
- Enable editor organize-imports on save to remove unused imports automatically.
- Use import type for type-only imports so the distinction is explicit.
- Delete imports in the same change that removes their last usage.
When it happens
Trigger: import { debounce } from 'lodash-es'; with no debounce usage anywhere in the module; type imports kept after switching to inline types; barrel-file imports of unused symbols.
Common situations: Refactors removing call sites; IDE auto-import pulling in unused names; switching values to import type; re-export cleanup.
Related errors
- {pronoun} '{name}' is {verb} but never used.{suffix}
- Redundant Boolean call
- This label '{label_name}' is unnecessary
- Do not assign to imported bindings
- Unreachable code.
AI-assisted analysis of oxc-project/oxc@e1e7af627c (2026-08-20).
Data as JSON: /api/errors/1fb744f567ba25c6.
Report an issue: GitHub.