Skip to content

gspot/import-boundaries

Finds relative imports that leave the nearest boundary folder. By default every second-level folder, such as src/cart or packages/shop, is a boundary. Set folders to project paths or folder globs to choose other boundaries. Paths and aliases are relative to the repository root. Alias imports are out of scope; architecture modules govern them.

The all config turns it on. eslint --fix fixes it.

Relative paths between folders couple separate parts of a project to the tree shape.

Keep relative imports within the selected folder. eslint --fix uses a configured alias when one exists. Otherwise, move shared code into this folder or into a package both projects depend on, and import its package name.

With @/ mapped to src/, import { a } from "../turn/a.js"; in src/other/b.ts reports alias. Correct the import to import { a } from "@/turn/a.js";. With folders api and supabase, a relative import from api into supabase reports escape.

Option Type Default What it does
folders List ["*/*"] Boundary folders or folder globs. The nearest matching ancestor owns each file.
aliases Table {} Import alias prefixes mapped to repository folders for fixes.