Skip to Content

Architecture boundaries

Architecture-boundary rules enforce import direction and module visibility between configured source-path elements (layers, features, apps in a monorepo). Every rule operates on the resolved source file of an import, relative imports are followed to the real .ts/.tsx/.d.ts file before classification. Boundary diagnostics do not offer autofixes, a violation usually needs an API or architecture decision, not a mechanical import rewrite.

Source: ported from eslint-plugin-boundaries (MIT).

  • boundaries/dependencies: unified dependency-direction rule from upstream eslint-plugin-boundaries, intended to replace element-types / entry-point / external / no-private / no-unknown with a single policy block.
  • boundaries/element-types: Enforce allowed dependency directions between configured source-path element types.
  • boundaries/entry-point: Require imports that cross element boundaries to target the importee element’s configured public entry files (typically index.ts), so the public surface of each element is explicit.
  • boundaries/external: Restrict external package imports by package or specifier pattern.
  • boundaries/no-private: Reject imports of files declared private by a parent element from outside that element.
  • boundaries/no-unknown: Reject relative imports whose resolved source file falls under no configured element.
// lint.config.ts import type { ITtscLintConfig } from "@ttsc/lint"; export default { rules: { "boundaries/element-types": ["error", { elements: [ { type: "app", pattern: "src/app/**" }, { type: "domain", pattern: "src/domain/**", entry: "index.ts", private: "internal/**" }, ], rules: [{ from: "app", disallow: "domain" }], }], "boundaries/entry-point": ["error", { elements: [{ type: "domain", pattern: "src/domain/**", entry: "index.ts" }], }], "boundaries/no-private": ["error", { elements: [{ type: "domain", pattern: "src/domain/**", private: "internal/**" }], }], "boundaries/no-unknown": ["error", { elements: [ { type: "app", pattern: "src/app/**" }, { type: "domain", pattern: "src/domain/**" }, ], }], "boundaries/external": ["error", { disallow: ["@legacy/sdk"] }], }, } satisfies ITtscLintConfig;
Last updated on