Documentation Index
Fetch the complete documentation index at: https://docs.fallow.tools/llms.txt
Use this file to discover all available pages before exploring further.
fallow dead-code enforces architecture boundaries by checking that imports between directories follow your rules. Define and declare which zones may import from which.
Boundary violations are included in
fallow dead-code output by default. Use --boundary-violations to show only boundary issues.Quick start with presets
The fastest way to add boundaries is with a built-in preset. Fallow ships four presets for common architecture patterns:fallow list --boundaries to see the expanded zones and rules:
$ fallow list --boundaries
Presets
- Bulletproof
- Layered
- Hexagonal
- Feature-Sliced
A widely used React/Next.js pattern. Feature modules are isolated from each other; shared utilities and server infrastructure form the base layers.4 logical zones: The
app, features, shared, server. The features zone auto-discovers immediate child directories so sibling features are isolated as features/<name> zones.shared zone covers: components, hooks, lib, utils, utilities, providers, shared, types, styles, i18n.Source root detection
Preset zone patterns use{rootDir}/{zone}/**. Fallow auto-detects the source root from tsconfig.json:
tsconfig.json
rootDir is found, fallow falls back to src.
Custom zones and rules
For full control, define zones and rules directly:How zones work
- A file belongs to the first zone whose pattern matches (first-match wins)
- Files that don’t match any zone are unrestricted: they can import from and be imported by any zone
- Self-imports are always allowed (files in the same zone can freely import each other)
- A zone with no rule entry is unrestricted: it can import from any zone
- A zone with a rule and an empty
allowlist is isolated: it cannot import from other zones
Auto-discovered feature zones
UseautoDiscover when one logical zone should create one concrete zone per child directory. This is useful for feature-module architectures where src/features/auth and src/features/billing should be isolated from each other without writing a zone and rule for every feature.
src/features/auth and src/features/billing exist, fallow expands this to features/auth and features/billing. Rules that reference the logical features parent apply to every discovered feature. Explicit child rules, such as from: "features/auth", override generated parent rules.
Subtree scope (root)
Monorepos with per-package boundaries usually have the same internal directory layout under each package (packages/app/src/, packages/core/src/, …). Writing flat patterns from the project root forces zone definitions to scale with the cross product of (zones, packages):
root on a zone to scope its patterns to a subtree. At classification time, fallow checks that the file’s path starts with the root prefix and strips that prefix before matching the patterns against the remainder. Files outside the subtree never match the zone.
packages/app/src/login.tsx classifies as ui and packages/core/src/order.ts classifies as domain. Adding packages/billing/ later only requires another zone entry with the same patterns: ["src/**"] and a different root.
Trailing slashes and a leading ./ are normalized for you, so "packages/app", "packages/app/", and "./packages/app/" are equivalent. Backslashes are converted to forward slashes.
Overriding preset zones
Start from a preset and customize specific zones or rules. Zones with the same name replace the preset zone; rules with the samefrom replace the preset rule.
adapters and ports from the hexagonal preset but replaces the domain zone pattern with src/core/**.
Suppressing violations
Suppress individual findings with inline comments:off:
Output formats
Boundary violations appear in all output formats:- Human
- JSON
- Compact
$ fallow dead-code --boundary-violations
Inspecting your boundaries
Usefallow list --boundaries to verify your configuration before running analysis:
Fallow warns when a zone matches zero files. This usually means the glob pattern doesn’t match your directory structure. Run
fallow list --boundaries to check file counts per zone.See also
fallow dead-code
CLI reference for the dead code command, including all issue type filters.
Rules & Severity
Set boundary violations to error, warn, or off.
Inline Suppression
Suppress individual findings in source code.