Biome GritQL plugins for code quality
npm install @gracefullight/biome-pluginBiome GritQL plugins for code quality.
``bash`
pnpm add -D @gracefullight/biome-plugin
Add to your biome.json:
`json`
{
"plugins": [
"node_modules/@gracefullight/biome-plugin/rules/no-relative-imports.grit"
]
}
Disallows relative imports (./, ../). Use path aliases from tsconfig.json instead.
Supports:
- Static imports: import { foo } from "./utils"import type { Foo } from "./types"
- Type imports: import("./lazy")
- Dynamic imports: export { foo } from "./utils"
- Re-exports: export type { Foo } from "./types"
- Type re-exports: export * from "./all"
- Barrel exports: export * as ns from "./namespace"
- Namespace exports:
`typescript
// ❌ Error
import { foo } from "./utils";
import type { Foo } from "../types";
const lazy = await import("./lazy");
export { bar } from "./components";
export type { Baz } from "../models";
export * from "./all";
// ✅ OK
import { foo } from "@/utils";
import type { Foo } from "@/types";
const lazy = await import("@/lazy");
export { bar } from "@/components";
export type { Baz } from "@/models";
export * from "@/all";
`
GritQL plugins can only perform pattern matching. This rule flags all relative imports and cannot dynamically check if a path alias exists in your tsconfig.json`.
MIT