Skip to main content

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.

Automatically remove unused exports and dependencies from your codebase. Fallow modifies your source files in place, so treat this like a refactoring tool.
Always commit your changes before running fallow fix. This gives you a clean rollback point if anything unexpected happens.
Use --dry-run first to preview exactly what will be removed before applying any changes.
fallow fix

Options

FlagDescription
--dry-runPreview changes without applying
--yes, --forceSkip confirmation (required in non-TTY)
-f, --format <FORMAT>Output format: human (default), json

What gets fixed

  • Unused exports: the export keyword is removed, keeping the declaration. For exported enums where the enum itself is never referenced outside its body in the file, the entire enum block is deleted.
  • Unused dependencies: removed from package.json when 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.yaml by line-aware deletion (comments and stylistic choices in the file are preserved). Object-form entries such as react:\n specifier: ^18.2.0 are removed as one block. When the last entry of a catalog group is removed, the header is rewritten to catalog: {} (or <name>: {}) so the file stays installable; bare catalog: with no value parses as null and pnpm errors at install time. Entries whose hardcoded_consumers is non-empty (a workspace package still pins a hardcoded version of the same package) are skipped to avoid breaking the next pnpm 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 run pnpm install so pnpm-lock.yaml stays in sync. The JSON envelope grows a top-level "skipped" count alongside "total_fixed" for partial-fix gating in CI.
Unused files and class members are not auto-fixed. Use fallow dead-code to find those.

Examples

# See what would be removed
fallow fix --dry-run

# JSON output for scripting
fallow fix --dry-run --format json

Example output

$ fallow fix
Would remove export from src/components/Card/index.ts:1 `CardFooter`
Would remove export from src/providers/trpc-provider/index.tsx:12 `TRPCProvider`
Would remove export from src/server/jobs/queue.ts:61 `enqueueJobDelayed`
Would remove export from src/server/jobs/queue.ts:206 `sweepStuckProcessingJobs`
Would remove export from src/server/jobs/queue.ts:276 `getDeadLetterJobs`
Would remove `@trpc/react-query` from dependencies

6 changes to apply. Proceed? [y/N] y

 Applied 6 fixes (5 exports, 1 dependency)

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.