Skip to content

noUnresolvedImports

  • Rule available since: v2.0.0
  • Diagnostic Category: lint/correctness/noUnresolvedImports
  • This rule isn’t recommended, so you need to enable it.
  • This rule doesn’t have a fix.
  • The default severity of this rule is error.
  • This rule belongs to the following domains:
  • Sources:
biome.json
{
"linter": {
"rules": {
"correctness": {
"noUnresolvedImports": "error"
}
}
}
}

Warn when importing non-existing exports.

Importing a non-existing export is an error at runtime or build time. Biome can detect such incorrect imports and report errors for them.

Note that if you use TypeScript, you probably don’t want to use this rule, since TypeScript already performs such checks for you.

  • This rule does not validate imports through dynamic import() expressions or CommonJS require() calls.
foo.js
export function foo() {};
bar.js
// Attempt to import symbol with a typo:
import { fooo } from "./foo.js";
/bar.js:2:10 lint/correctness/noUnresolvedImports ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

The path ./foo.js has no export named fooo.

1 │ // Attempt to import symbol with a typo:
> 2 │ import { fooo } from “./foo.js”;
^^^^
3 │

Make sure that the path is correct and that you’re importing the right symbol.

foo.js
export function foo() {};
bar.js
// Fixed typo:
import { foo } from "./foo.js";