Skip to content

Only Type Imports

Error
small-rules/only-type-imports

Require all imports to be type-only imports. Benchmarks cannot import non-types because the benchmarker plugin will throw an error.

Diagnostic Messages

onlyTypeImports
Benchmarks must use `import type` to avoid runtime imports that break the benchmarker plugin.

Configuration

This rule does not accept options.

{
"jsPlugins": [
"@pobammer-ts/small-rules"
],
"rules": {
"small-rules/only-type-imports": "error"
}
}

Examples

Value import needs type keyword
import { Foo } from "./bar";
Type-only import declaration
import type { Foo } from "./bar";