Skip to content

Fallow

Fallow is a codebase analysis tool for TypeScript and JavaScript. A single run checks for dead code, duplicated logic, and maintainability problems such as complexity hot spots.

It complements a linter: a linter examines individual files for suspicious syntax and style, while Fallow follows relationships across the project to find unused files, exports, types, and dependencies.

Install Fallow as a development dependency so everyone on the project uses the same version:

Terminal window
pnpm add --save-dev fallow

Wire the local binary into package.json:

package.json
{
"scripts": {
"fallow": "fallow"
}
}

Run the complete analysis with:

Terminal window
pnpm fallow

The bare command runs all three analysis groups. During focused work, you can run pnpm fallow dead-code, pnpm fallow dupes, or pnpm fallow health.

Fallow works without configuration. When a framework or build tool loads a file by convention, however, static analysis may not see the connection. Create a .fallowrc.json and add only those paths to ignorePatterns:

.fallowrc.json
{
"$schema": "https://raw.githubusercontent.com/fallow-rs/fallow/main/schema.json",
"entry": ["main.ts"],
"ignorePatterns": ["vite.config.ts"],
"ignoreDependencies": ["@fontsource-variable/atkinson-hyperlegible-next"]
}

The $schema entry enables validation and editor completion.

  1. Run pnpm fallow.
  2. Review each finding before deleting code or dependencies.
  3. Fix genuine findings in small, testable changes.
  4. Add a focused ignore only when usage depends on a convention Fallow cannot discover.
  5. Re-run the analysis until its output is useful and understood.

For automatic cleanup, preview changes first with pnpm fallow fix --dry-run. Commit or stash unrelated work before applying a fix without --dry-run.