Automatically remove unused exports and dependencies from your codebase. Fallow modifies your source files in place, so treat this like a refactoring tool.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
| Flag | Description |
|---|---|
--dry-run | Preview changes without applying |
--yes, --force | Skip confirmation (required in non-TTY) |
-f, --format <FORMAT> | Output format: human (default), json |
What gets fixed
- Unused exports: the
exportkeyword is removed, keeping the declaration. For exported enums where the enum itself is never referenced outside its body in the file, the entireenumblock is deleted. - Unused dependencies: removed from
package.jsonwhen they are not imported by another workspace - Unused enum members: removed from the enum declaration. When every member of an exported enum is unused, the whole declaration is deleted in one pass instead of leaving behind an empty
export enum X {}shell. Importers in other files now reference a name that no longer exists, so run your TypeScript build to find and clean them up. - Unused pnpm catalog entries: removed from
pnpm-workspace.yamlby line-aware deletion (comments and stylistic choices in the file are preserved). Object-form entries such asreact:\n specifier: ^18.2.0are removed as one block. When the last entry of a catalog group is removed, the header is rewritten tocatalog: {}(or<name>: {}) so the file stays installable; barecatalog:with no value parses as null and pnpm errors at install time. Entries whosehardcoded_consumersis non-empty (a workspace package still pins a hardcoded version of the same package) are skipped to avoid breaking the nextpnpm install; the skip is surfaced in stderr and in the JSON output ({"type": "remove_catalog_entry", "applied": false, "skipped": true, "skip_reason": "hardcoded_consumers", "consumers": [...]}). After a successful catalog edit fallow reminds you to runpnpm installsopnpm-lock.yamlstays in sync. The JSON envelope grows a top-level"skipped"count alongside"total_fixed"for partial-fix gating in CI.
fallow dead-code to find those.
Examples
Example output
$ fallow fix
See also
Auto-fix
Details on what fallow can and cannot auto-fix.
Dead code analysis
Understand the full range of dead code fallow detects.