Analyze your project for dead code. Fallow scans entry points, traces all reachable exports, and reports anything that isn’t used.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.
Options
Output
| Flag | Description |
|---|---|
-f, --format <FORMAT> | Output format: human (default), json, sarif, compact, markdown, codeclimate, gitlab-codequality, pr-comment-github, pr-comment-gitlab, review-github, review-gitlab |
-q, --quiet | Suppress progress output |
--fail-on-issues | Exit with code 1 if issues are found |
--sarif-file <PATH> | Write SARIF output to a file (in addition to --format) |
--ci | CI mode: sets format to SARIF, enables fail-on-issues, suppresses progress. Individual flags can still override. |
--explain | Add metric explanations. In human format, explanations are always shown. In JSON format, adds a _meta object with metric descriptions and docs links. |
--group-by <MODE> | Group output by owner (CODEOWNERS), directory (first path component), package (workspace package), or section (GitLab CODEOWNERS [Section] headers, with owners metadata). See global flags. |
--summary | Print a one-line summary of issue counts at the end of the run. In JSON format, adds a summary counts object. |
Filtering
| Flag | Description |
|---|---|
--unused-files | Only report unused files |
--unused-exports | Only report unused exports |
--unused-types | Only report unused types |
--private-type-leaks | Opt in to private type leak API hygiene findings and only report that issue type |
--unused-deps | Only report unused dependencies |
--unused-optional-deps | Only report unused optional dependencies |
--unused-enum-members | Only report unused enum members |
--unused-class-members | Only report unused class members |
--unresolved-imports | Only report unresolved imports |
--unlisted-deps | Only report unlisted dependencies |
--duplicate-exports | Only report duplicate exports |
--circular-deps | Only report circular dependencies |
--re-export-cycles | Only report re-export cycles (barrel files re-exporting from each other in a loop, or self-loops). See explanations/dead-code#re-export-cycles |
--boundary-violations | Only report boundary violations |
--stale-suppressions | Only report stale suppression comments and @expected-unused JSDoc tags |
--type-only-deps | Only report type-only dependencies |
--unused-catalog-entries | Only report unused pnpm catalog entries |
--empty-catalog-groups | Only report empty named pnpm catalog groups |
--unresolved-catalog-references | Only report package references to missing pnpm catalog entries |
--unused-dependency-overrides | Only report unused pnpm dependency overrides |
--misconfigured-dependency-overrides | Only report malformed pnpm dependency overrides |
--include-dupes | Also run duplication analysis and cross-reference with dead code |
Scoping
| Flag | Description |
|---|---|
--file <PATH> | Scope output to specific files. Accepts multiple values. Only issues in the specified files are reported. Project-wide dependency issues are suppressed. Warns on non-existent paths. Useful for lint-staged integration. |
--include-entry-exports | Also report unused exports in entry files (package.json main/exports, framework pages, etc.). By default, exports in entry files are assumed to be consumed externally. This flag catches typos like meatdata instead of metadata in framework-convention exports. The flag is global, so it works on combined mode (fallow --include-entry-exports) and fallow audit. Configurable persistently via includeEntryExports: true in your fallow config; the CLI flag wins when set. |
Incremental
| Flag | Description |
|---|---|
--changed-since <REF> | Only check files changed since a git ref |
--baseline <PATH> | Compare against a previously saved baseline file |
--save-baseline <PATH> | Save current results as a baseline file |
--production | Production mode (exclude test/story/dev files) |
--top <N> | Show only the top N items per issue category in human output |
Regression detection
| Flag | Description |
|---|---|
--fail-on-regression | Fail if issue count increased beyond tolerance vs a regression baseline |
--tolerance <N> | Allowed increase: "2%" (percentage) or "5" (absolute). Default: "0" |
--regression-baseline <PATH> | Path to regression baseline file (default: .fallow/regression-baseline.json) |
--save-regression-baseline <PATH> | Save current issue counts as a regression baseline |
Debugging flags
Debugging flags
These flags help you understand how fallow resolves your code and where time is spent.
| Flag | Description |
|---|---|
--trace <FILE:EXPORT> | Trace usage of a specific export |
--trace-file <PATH> | Show all edges for a file |
--trace-dependency <PACKAGE> | Show where a dependency is used |
--performance | Show pipeline timing breakdown |
Examples
Regression detection
Save a regression baseline on your main branch, then compare on subsequent runs (e.g., in PR checks) to prevent issue count from growing. Workflow:-
Save a regression baseline on
main:This writes issue counts to.fallow/regression-baseline.json(or a custom path). -
On each PR, compare against the baseline:
Exits with code 1 if the total issue count exceeds the baseline plus the configured tolerance.
-
Optionally set a tolerance to allow small fluctuations:
--fail-on-regression is used with --format json, the output includes an optional regression object:
| Field | Description |
|---|---|
status | pass, exceeded, or skipped |
baseline_total | Issue count from the baseline file |
current_total | Issue count from the current run |
delta | current_total - baseline_total |
tolerance | Configured tolerance value |
tolerance_kind | percentage or absolute |
exceeded | Whether the delta exceeds the tolerance |
reason | Only present when status is skipped (e.g., baseline file not found) |
Example output
$ fallow dead-code --format compact
--format json with the cycle’s structural shape:
$ fallow dead-code --format json (excerpt)
files is sorted lexicographically; the multi-node shape carries two or more entries, the self-loop shape exactly one. See explanations/dead-code#re-export-cycles for the structural rationale.
Grouped output
Use--group-by to partition issues by ownership or directory. This works with all output formats.
--format json, grouped output wraps the normal structure:
Fix suggestions in JSON output
When using--format json, every issue includes an actions array with machine-actionable fix and suppress hints. This lets agents and CI scripts programmatically decide how to resolve each finding.
| Field | Description |
|---|---|
type | One of 14 fix action types in kebab-case (e.g. remove-export, remove-file, suppress-line, add-to-config) |
auto_fixable | true when fallow fix can handle this action automatically. Evaluated per finding, not per action type: the same type may carry true on one finding and false on another (e.g. remove-catalog-entry flips on hardcoded_consumers, the primary dependency action flips between remove-dependency / move-dependency on used_in_workspaces). Filter on this bool of each individual action, not on type. See Auto-fix for the full list of per-instance flips. |
description | Human-readable explanation of the action |
comment | (optional) The inline suppression comment to add |
note | (optional) Additional context for non-auto-fixable items |
config_key | (optional) The config key to modify, e.g. "ignoreDependencies" for dependency issues |
value | (optional) Value to write at config_key. Scalar for keys like ignoreDependencies; array of { file, exports } rule objects for ignoreExports |
value_schema | (optional) URL pointing at the JSON Schema fragment that describes value. Agents that want to validate the payload before writing it into a user’s config can fetch the linked schema and apply it |
scope | (optional) Present on duplicate_exports suppress actions as "per-location" since those span multiple files |
Re-export findings include a warning note about public API surface impact. Dependency issues use
add-to-config suppress (not inline comments) with the concrete package name and config_key: "ignoreDependencies".Additional JSON fields
When using--format json, the output may include these additional top-level objects:
entry_points
Lists all resolved entry point files that root the module graph:
summary
When --summary is used, a summary counts object is included:
private_type_leaks is present in JSON output for schema stability, but the rule is off by default. It is populated only when enabled with --private-type-leaks or with private-type-leaks set to warn or error in configuration.
used_in_workspaces
Unused dependency findings can include used_in_workspaces when a package is unused in the declaring workspace but imported elsewhere in the monorepo:
baseline_deltas
When --baseline is used, a baseline_deltas object shows changes since the baseline:
Stale suppression detection
Fallow detects// fallow-ignore comments and /** @expected-unused */ JSDoc tags that no longer match any issue. This prevents suppression comments from accumulating after the underlying issues are resolved.
| Origin | When it’s stale |
|---|---|
// fallow-ignore-next-line / // fallow-ignore-file | The suppression no longer matches any issue on the target line or in the file |
/** @expected-unused */ JSDoc tag | The tagged export is now imported by another module |
stale-suppressions rule defaults to warn. Promote to error for CI enforcement:
--format json, stale suppressions appear in the stale_suppressions array:
See also
Dead code analysis
How fallow detects dead code.
Rules configuration
Configure severity and thresholds per rule.
Production mode
Analyze only shipping code.