Config: boundaries and architecture
Find the fallow config keys for boundaries and architecture, with type, default, allowed values and description.
The config file holds the settings of fallow. How config works explains where fallow finds the file and how files merge.
circularDependencies
- Type:
object
Options for the circular-dependencies rule: ignoreLazyImports and allow, a list of accepted cycles. Set { "ignoreLazyImports": true } to skip import edges that load on demand or on another thread (an import() inside a function, a template import(), a lazy import.meta.glob, a worker URL, a webpack worker loader request such as worker-loader!./work.js) when fallow looks for cycles. A top-level await import(), require(), an eager glob, and an edge that also has a static import stay in the cycle graph. Default false leaves the rule unchanged.
| Key | Type | Default |
|---|---|---|
ignoreLazyImports | boolean | |
allow | string[][] |
circularDependencies.ignoreLazyImports
- Type:
boolean
Skip import edges that load their target on demand or on another thread when fallow looks for cycles. A literal import() inside a function, a template import(), a lazy import.meta.glob, a worker URL and a webpack worker loader request (worker-loader!./work.js) are lazy edges. A top-level await import(), require() and an eager import.meta.glob load before the module finishes, so they stay. An edge that also carries a static import stays. Default false.
circularDependencies.allow
- Type:
string[][]
Accepted cycles. Each entry is the list of files of one cycle, in import order, without the repeat of the first file at the end. An entry accepts a cycle that has exactly these files in this order, from any start file: ["src/a.ts", "src/b.ts", "src/c.ts"] also accepts src/b.ts -> src/c.ts -> src/a.ts. A cycle with another set of files stays reported, also when it shares an import with an accepted cycle.
Each path is relative to the project root, also in a monorepo: write packages/app/src/a.ts, not a path relative to the workspace. The match is case-sensitive on every platform. Globs are not supported. An entry needs at least 2 files and lists each file once.
An entry that matches no cycle in a run gives a circular-dependencies-allow-unmatched diagnostic. The detector lists at most 20 cycles per group of files that import each other, and no cycle with more than 12 files. An accepted cycle does not count toward the 20. An entry with more than 12 files, or with all files in a group that reached the limit, gives no diagnostic, because the detector cannot prove that it matches no cycle.
A fallow-ignore-next-line circular-dependency comment on an accepted cycle becomes a stale suppression: remove the comment when you add the entry. Default [].
boundaries
- Type:
object
Configures architecture boundary enforcement: which source directories belong to which named zone and which zones may import which others, reported as boundary-violation, boundary-coverage-violation, and boundary-call-violation findings (severity via rules.boundary-violation, default error). Set to enforce a layered/module architecture; the object holds preset (one of layered, hexagonal, feature-sliced, bulletproof, whose default zones/rules are merged in with the user-declared zones/rules taking precedence), zones (each with name, patterns, autoDiscover, optional root), rules (each with from, allow, allowTypeOnly target-zone lists), coverage (requireAllFiles plus allowUnmatched globs for files matching no zone), and calls (a forbidden list of {from, callee} banned-call rules per zone).
boundaries.preset
- Type:
string(optional)
Optional built-in preset.
Allowed values:
layered: Layered architecture.hexagonal: Hexagonal / ports-and-adapters.feature-sliced: Feature-Sliced Design.bulletproof: Bulletproof React.
boundaries.zones
- Type:
object[] - Default:
[]
Zone definitions.
| Key | Type | Default |
|---|---|---|
name | string | |
patterns | string[] | |
autoDiscover | string[] | |
root | string | |
publicFiles | string[] |
boundaries.zones[].name
- Type:
string
Zone name.
boundaries.zones[].patterns
- Type:
string[]
Membership patterns. A single * stays within one path segment; use ** to match across directories.
boundaries.zones[].autoDiscover
- Type:
string[]
Directories whose children become zones.
boundaries.zones[].root
- Type:
string(optional)
Optional subtree scope.
boundaries.zones[].publicFiles
- Type:
string[]
Globs of the public entry files of this zone.
When the list is not empty, a file of another zone may import a file of this zone only through a file that is in this zone and matches a glob. The globs use the same base as patterns. On an autoDiscover zone, each glob is relative to each discovered folder.
boundaries.rules
- Type:
object[] - Default:
[]
Zone import rules.
| Key | Type | Default |
|---|---|---|
from | string | |
allow | string[] | [] |
allowTypeOnly | string[] |
boundaries.rules[].from
- Type:
string
Source zone.
boundaries.rules[].allow
- Type:
string[] - Default:
[]
Allowed target zones.
boundaries.rules[].allowTypeOnly
- Type:
string[]
Allowed type-only targets.
boundaries.coverage
- Type:
object
Optional policy for files that match no zone.
| Key | Type | Default |
|---|---|---|
requireAllFiles | boolean | |
allowUnmatched | string[] |
boundaries.coverage.requireAllFiles
- Type:
boolean
Report every analyzed source file that does not match any boundary zone, also a file that no entry point reaches.
boundaries.coverage.allowUnmatched
- Type:
string[]
Glob patterns for files that may remain unmatched by any zone. A single * stays within one path segment; use ** to match across directories.
boundaries.calls
- Type:
object
Optional forbidden-call policy for zoned files.
| Key | Type | Default |
|---|---|---|
forbidden | object[] |
boundaries.calls.forbidden
- Type:
object[]
Callee patterns that files in a zone may not call.
boundaries.calls.forbidden[].from
- Type:
string
Zone whose files may not make matching calls.
boundaries.calls.forbidden[].callee
- Type:
string or string[]
Forbidden callee pattern(s). A pattern matches Date() and new Date(). Matching is segment-aware, not substring: child_process.* matches child_process.exec (and named imports from child_process / node:child_process), fetch matches only fetch, and a leading *. suffix-matches any object (*.innerHTML).