Skip to main content
fallow fix removes unused exports and unused dependencies from your codebase. In agent workflows, fallow fix --yes --format json cleans up dead code non-interactively after code generation.
Always commit your changes before running fallow fix. Git lets you undo if needed.
1

Preview changes

Run a dry run to see exactly what would be removed without making any changes.
fallow fix --dry-run
$ fallow fix --dry-run
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 (5 exports, 1 dependency)
Run without --dry-run to apply.
2

Review the output

Check that every proposed removal is safe. Pay attention to exports consumed by external packages or dynamic imports that fallow can’t detect statically.
fallow fix --dry-run --format json
3

Apply fixes

Once you’re satisfied, apply the changes. In interactive terminals, fallow asks for confirmation before writing.
fallow fix
In CI or non-TTY environments, use --yes to skip confirmation:
fallow fix --yes
Agents typically use fallow fix --yes --format json to apply fixes non-interactively. The JSON output confirms exactly what was changed, so the agent can verify the result.
4

Verify the result

Run your build and tests to confirm nothing broke.
npm run build && npm test

What gets fixed

  • Unused exports: the export keyword is removed, keeping the declaration
  • Unused dependencies: removed from package.json
Auto-fix does not delete entire files or remove unused enum/class members. Use fallow check to identify those and remove them manually.

JSON output

For scripting, CI, and agent workflows:
fallow fix --dry-run --format json
{
  "changes": [
    {
      "type": "remove-export",
      "file": "src/components/Card/index.ts",
      "symbol": "CardFooter",
      "line": 1
    },
    {
      "type": "remove-export",
      "file": "src/providers/trpc-provider/index.tsx",
      "symbol": "TRPCProvider",
      "line": 12
    },
    {
      "type": "remove-export",
      "file": "src/server/jobs/queue.ts",
      "symbol": "enqueueJobDelayed",
      "line": 61
    },
    {
      "type": "remove-export",
      "file": "src/server/jobs/queue.ts",
      "symbol": "sweepStuckProcessingJobs",
      "line": 206
    },
    {
      "type": "remove-export",
      "file": "src/server/jobs/queue.ts",
      "symbol": "getDeadLetterJobs",
      "line": 276
    },
    {
      "type": "remove-dependency",
      "package": "@trpc/react-query"
    }
  ],
  "summary": {
    "total_changes": 6,
    "exports_removed": 5,
    "dependencies_removed": 1
  }
}

See also

CLI: fix

Full reference for the fallow fix command and its flags.

Dead Code Analysis

Understand what fallow detects before auto-fixing.