Skip to main content
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
  • Unused dependencies: removed from package.json
Unused files, enum members, and class members are not auto-fixed. Use fallow check to identify 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:
 Removed export: CardFooter (src/components/Card/index.ts:1)
 Removed export: TRPCProvider (src/providers/trpc-provider/index.tsx:12)
 Removed export: enqueueJobDelayed (src/server/jobs/queue.ts:61)
 Removed export: sweepStuckProcessingJobs (src/server/jobs/queue.ts:206)
 Removed export: getDeadLetterJobs (src/server/jobs/queue.ts:276)
 Removed dependency: @trpc/react-query (package.json)

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.