blog.dopana

Back

When working with Biome, you may encounter situations where the linter automatically converts regular imports to import type. While this feature helps with optimization, sometimes you want to preserve your existing import syntax. This guide covers 3 ways to disable this behavior.

The Problem#

Biome has a useImportType rule that automatically converts imports containing only types to import type:

// Before Biome format
import { Icons } from '../../libs/icons';

// After Biome format
import type { Icons } from '../../libs/icons';
typescript

This can be annoying when:

  • You want to keep regular import syntax consistent
  • The import also contains runtime values (not just types)
  • You’re migrating from ESLint and want to preserve code style

Solutions#

Option 1: Disable the Rule Globally#

The simplest approach is to disable the useImportType rule in your biome.json file:

{
  "linter": {
    "enabled": true,
    "rules": {
      "style": {
        "useImportType": "off"
      }
    }
  }
}
json

[!TIP] After modifying biome.json, remember to restart your IDE or Biome extension for changes to take effect.

Option 2: Disable for a Specific File#

If you only want to disable it for a specific file or line, use a suppress comment:

// biome-ignore lint/style/useImportType: preserving regular import syntax
import { Icons } from '../../libs/icons';
typescript

Or place the comment at the top of the file to apply to the entire file:

// biome-ignore-file lint/style/useImportType
import { Icons } from '../../libs/icons';
import { OtherType } from './other';
typescript

Option 3: Disable All Import Organization#

If Biome is moving, sorting, or restructuring your type imports during formatting, you can disable the organizeImports feature entirely:

{
  "assist": {
    "enabled": true,
    "actions": {
      "source": {
        "organizeImports": {
          "enabled": false
        }
      }
    }
  }
}
json

[!WARNING] This disables all import organization features, not just type imports. Consider carefully before using this approach.

When to Use Each Approach#

ApproachWhen to UseProsCons
GlobalTeam wants consistent regular importsApplies to entire project, easy to manageLoses import type optimization benefits
Specific FileOnly a few files need exceptionFlexible, doesn’t affect other codeRequires manual comment additions
Disable organizeImportsWant complete control over import organizationDisables all import automationLoses many useful features

Practical Example#

Suppose you have an Astro component using type imports:

---
import type { Icons } from '../../libs/icons';

interface Props {
	name: keyof typeof Icons;
}
---
astro

After disabling useImportType, you can write:

---
import { Icons } from '../../libs/icons';

interface Props {
	name: keyof typeof Icons;
}
---
astro

Biome will no longer automatically convert it back to import type.

References#