Configuration
Configuration lives in domainlint.json (or .domainlint.json) at the project root. All fields are optional — the defaults work for a standard src/features/ layout.
Full schema
Section titled “Full schema”{ "rootDir": ".", "srcDir": "src", "featuresDir": "src/features", "barrelFiles": ["index.ts"], "extensions": [".ts", ".tsx"], "tsconfigPath": "./tsconfig.json", "exclude": ["**/node_modules/**", "**/dist/**", "**/.next/**"], "includeDynamicImports": false, "overrides": { "global": { "rules": { "import-cycles": "error", "cross-feature-imports": "error" } }, "features": { "legacy-feature": { "rules": { "import-cycles": "off", "cross-feature-imports": "warn" } } } }}Field reference
Section titled “Field reference”| Field | Type | Default | Description |
|---|---|---|---|
rootDir | string | "." | Project root directory. |
srcDir | string | "src" | Source directory to analyze. |
featuresDir | string | "src/features" | Directory containing feature modules. |
barrelFiles | string[] | ["index.ts"] | Filenames treated as public API barrels. |
extensions | string[] | [".ts", ".tsx"] | File extensions to include in analysis. Each entry must start with .. |
tsconfigPath | string | "./tsconfig.json" | Path to tsconfig.json for path alias resolution. |
exclude | string[] | ["**/node_modules/**", "**/dist/**", "**/.next/**"] | Glob patterns to exclude from analysis. |
includeDynamicImports | boolean | false | Whether to include await import() expressions in the dependency graph. |
overrides | object | — | Rule-level overrides (see below). |
packageRules | PackageImportRestriction[] | — | Cross-package import restrictions for monorepos (see Workspaces). |
packageRulesFile | string | — | Path to a file exporting custom workspace rules. |
Rule overrides
Section titled “Rule overrides”Overrides let you change the severity of each rule — or disable it entirely — at the global or per-feature level.
Rule names
Section titled “Rule names”| Rule name | Default | Maps to |
|---|---|---|
import-cycles | "error" | R1 — No import cycles |
cross-feature-imports | "error" | R2 — Cross-feature barrel imports |
no-external-feature-imports | "off" | Feature files cannot import from outside the features directory |
Severity levels
Section titled “Severity levels”| Level | Behavior |
|---|---|
"error" | Reported as an error. Causes exit code 1. |
"warn" | Reported as a warning. Does not cause exit code 1. |
"off" | Rule is skipped entirely for the scope. |
Override resolution order
Section titled “Override resolution order”- Feature-level —
overrides.features["<featureName>"].rulesapplies to files inside that feature. - Global —
overrides.global.rulesapplies to all other files. - Default —
"error"if no override matches ("off"forno-external-feature-imports).
Examples
Section titled “Examples”{ "overrides": { "features": { "legacy-billing": { "rules": { "import-cycles": "off" } } } }}{ "overrides": { "global": { "rules": { "cross-feature-imports": "warn" } }, "features": { "payments": { "rules": { "cross-feature-imports": "error" } } } }}Zod validation schema
Section titled “Zod validation schema”The configuration file is validated at load time using Zod. Here is the schema used internally:
const ruleOverrideSchema = z.object({ rules: z .object({ "import-cycles": z.enum(["off", "warn", "error"]).optional(), "cross-feature-imports": z.enum(["off", "warn", "error"]).optional(), "no-external-feature-imports": z.enum(["off", "warn", "error"]).optional(), }) .optional(),});
const configFileSchema = z.object({ rootDir: z.string().optional(), srcDir: z.string().optional(), featuresDir: z.string().optional(), barrelFiles: z .array(z.string().min(1)) .optional(), extensions: z .array(z.string().startsWith(".")) .optional(), tsconfigPath: z.string().optional(), exclude: z.array(z.string()).optional(), includeDynamicImports: z.boolean().optional(), overrides: z .object({ global: ruleOverrideSchema.optional(), features: z.record(z.string(), ruleOverrideSchema).optional(), }) .optional(),});Invalid configuration will cause domainlint to exit with code 2.