ESLint
@derived-modular/eslint-plugin — four architectural rules in the editor.
@derived-modular/eslint-plugin gives fast feedback in the editor: a wrong import is highlighted on save, without waiting for CI.
This is not a replacement for dma check. The plugin looks at one file at a time and does not see cycles in the graph. You still need the CLI in CI.
Installation
npm install -D @derived-modular/eslint-plugin eslintRequires ESLint 9+ with flat config.
Minimal setup
// eslint.config.js
import dma from "@derived-modular/eslint-plugin";
export default [
...dma.configs.recommended,
{
settings: {
dma: {
srcRoot: "src",
compositionRoots: ["app", "pages", "routes"],
},
},
},
];The recommended preset enables all four rules at error level.
Rules
| Rule | What it catches |
|---|---|
@derived-modular/layer-direction | Import not downward through layers |
@derived-modular/feature-to-feature | Feature imports another feature |
@derived-modular/public-api | Cross-module import bypasses */public/* |
@derived-modular/no-barrel | Barrel index with re-exports inside a module |
settings.dma options
| Key | Default | Description |
|---|---|---|
srcRoot | "src" | Source root |
compositionRoots | ["app", "pages", "routes"] | Composition root folders |
If unset, the plugin also reads srcRoot / compositionRoots from an upward dma.config.*. Precedence: settings.dma > config file > defaults.
The plugin resolves relative imports and @/ → srcRoot. Complex aliases from tsconfig that ESLint does not resolve on its own may need extra host configuration. npm package imports are ignored.
@derived-modular/no-barrel can autofix imports that hit a single-target barrel (rewrite to the public path).
pages/ and routes/ are treated like app/ — for Next.js App Router, Astro, TanStack Router, SvelteKit.
What ESLint does not cover
| Concern | ESLint | dma check |
|---|---|---|
no-cycle | — | ✓ |
feature-has-inbound | — | ✓ |
service-no-inbound | — | ✓ |
dma doctor signals | — | ✓ |
If ESLint is silent but dma check fails — that is normal. Run both.
Oxlint
The same rules are available via @derived-modular/oxlint-plugin — JS plugins for Oxlint. Status: alpha.
Biome
If your project uses Biome instead of ESLint — see Biome. Coverage is weaker (GritQL heuristics), but dma check in CI is mandatory either way.
Example from the repository
Live config — examples/next-app/eslint.config.js.