CLI reference for fallow dead-code. Scan entry points, trace reachable exports, and report unused files, exports, dependencies, and types.
Analyze your project for dead code. Fallow scans entry points, traces all reachable exports, and reports anything that isn’t used.
Running bare fallow now runs all analyses (dead code, duplication, and health). Use fallow dead-code to run dead code analysis only. fallow check remains as a hidden alias for fallow dead-code.
fallow dead-codefallow check # Hidden alias for fallow dead-code
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, prints a Description: line under each section header. 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.
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.
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
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
# Why is formatDate reported as unused?fallow dead-code --trace src/utils.ts:formatDate# What imports/exports does this file have?fallow dead-code --trace-file src/utils.ts# Where is lodash used?fallow dead-code --trace-dependency lodash# Pipeline performance breakdownfallow dead-code --performance
Re-export cycles ship under their own field in --format json with the cycle’s structural shape:
$ fallow dead-code --format json (excerpt)
{ "kind": "dead-code", "schema_version": 7, "re_export_cycles": [ { "files": ["src/api/index.ts", "src/api/internal/index.ts"], "kind": "multi-node", "actions": [ { "type": "fix", "kind": "refactor-re-export-cycle", "auto_fixable": false, "description": "Remove one `export * from` (or `export { ... } from`) statement on any one member to break the cycle" }, { "type": "suppress-file", "kind": "suppress-file", "auto_fixable": false, "comment": "// fallow-ignore-file re-export-cycle" } ] }, { "files": ["src/utils/index.ts"], "kind": "self-loop", "actions": [...] } ]}
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.
Use --group-by to partition issues by ownership or directory. This works with all output formats.
# Group by CODEOWNERS (auto-probes CODEOWNERS, .github/CODEOWNERS, .gitlab/CODEOWNERS, docs/CODEOWNERS)fallow dead-code --group-by owner# Group by first directory componentfallow dead-code --group-by directory# Group by workspace packagefallow dead-code --group-by package# Group by GitLab CODEOWNERS section (requires a file with [Section] headers)fallow dead-code --group-by section
With --format json, grouped output wraps the normal structure:
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.
{ "path": "src/utils.ts", "export_name": "helperFn", "line": 10, "actions": [ { "type": "remove-export", "auto_fixable": true, "description": "Remove the unused export from the public API" }, { "type": "suppress-line", "auto_fixable": false, "description": "Suppress with an inline comment above the line", "comment": "// fallow-ignore-next-line unused-export" } ]}
Each action has:
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".
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.
In human, markdown, GitHub, and GitLab output this appears as “imported in” or an “Imported elsewhere” column. Treat these as workspace placement issues: move the dependency to the consuming workspace instead of auto-removing it.
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.
# Only report stale suppressionsfallow dead-code --stale-suppressions# JSON output includes stale_suppressions arrayfallow dead-code --format json --stale-suppressions
Use /** @expected-unused */ instead of // fallow-ignore-next-line when you want fallow to alert you if a suppressed export later becomes used. Both are tracked for staleness, but @expected-unused communicates intent more clearly.