Biome Organize Imports: Sorting in check
Biome can sort and group imports automatically, applied by biome check --write and verified by biome ci.
Import sorting is built in, no plugin needed. The config key moved between versions: organizeImports in v1, the assist section in v2.
What it does
Biome reorders import statements into a deterministic order. In v1 you enable it with the top-level organizeImports.enabled. In v2 it is an assist action (source.organizeImports) under the assist section. biome check applies it with --write and biome ci flags files whose imports are out of order.
Common usage
// Biome v1
{ "organizeImports": { "enabled": true } }
// Biome v2 (assist)
{ "assist": { "enabled": true, "actions": { "source": { "organizeImports": "on" } } } }Options
| Key | What it does |
|---|---|
| organizeImports.enabled (v1) | Turn import sorting on in v1 |
| assist.actions.source.organizeImports (v2) | The v2 assist action |
| check --write | Apply import sorting along with format and fixes |
| ci / check (no write) | Report files whose imports need sorting |
In CI
biome ci treats unsorted imports as a diagnostic, so the build fails until they are sorted. Developers fix it locally with biome check --write. Keep import sorting on in the same check that does formatting so there is one source of truth.
Common errors in CI
On v2, setting organizeImports at the top level gives "Found an unknown key organizeImports" because it moved under assist. If imports are never sorted, the assist section may be disabled (assist.enabled false). A diff-only failure with no rule name in CI is usually the import-order action; run check --write to resolve it.