Fallow: codebase analysis for TypeScript and JavaScript
Fallow is codebase analysis for TypeScript and JavaScript that finds unused code, duplication, complexity and architecture problems in one run.
Fallow finds the code in your TypeScript or JavaScript project that nothing uses, the code that you copied, and the functions that are hard to change. It reads the whole repository and needs no config file. Run it on your machine, on each pull request, and in the loop of a coding agent.
This is the report of npx fallow on a small demo project with 16 files:
16 files analyzed
3 entry points detected (2 package.json, 1 plugin)
● Unused files (1)
src/utils/legacy-currency.ts
● Unused dependencies (1)
left-pad
● Duplicates (1 clone group)
17 lines 2 instances spread 2 dup:f42424e8
src/reports/export.ts:3-19
src/utils/summary.ts:7-23
● High complexity functions (1)
src/services/customers.ts
:9 classifyCustomer CRITICAL
Failed: dead-code (6 issues), dupes (1 clone group), health (1 above threshold): start with src/services/customers.ts
This run found a file that nothing imports, a package that no file uses, a block of 17 lines that exists in two files, and one function to split first. The full report also lists unused exports and a package that the code imports but package.json does not list. Each of these findings costs you time later: people read the old file, CI installs the unused package, and a fix in one copy of the block misses the other copy.
How fallow knows that code is unused
The first finding is the result of one walk through the project. A linter checks one file at a time, so it cannot see that no other file imports legacy-currency.ts. Fallow builds one graph of all files and their imports. It starts at the entry points, the files that something outside your code runs, such as the main file of package.json or a test file. Then it follows each import. In the graph below, the three entry points of the demo reach each file except src/utils/legacy-currency.ts:
Diagram source
flowchart LR
subgraph entry["Entry points"]
main["src/index.ts"]
seed["scripts/seed.js"]
test["src/math.test.ts"]
end
lib["src/lib/index.ts"]
format["src/lib/format.ts"]
orders["src/services/orders.ts"]
data["scripts/seed-data.js"]
helpers["src/utils/test-helpers.ts"]
legacy["src/utils/legacy-currency.ts"]
main --> lib
lib --> format
main --> orders
seed --> data
test --> helpersNo import path leads to legacy-currency.ts, so fallow reports it as an unused file. The same walk decides about each export: an export is unused when no reachable file uses it.
Start here
The fastest way to learn fallow is to run it on your own project. These three pages take you from the first command to the first removed finding:
- Install fallow, or run it with
npxand install nothing. - Try it on your project: run one command and read each part of the report.
- Fix your first findings: check a finding, remove the code, and run fallow again.
After the first cleanup, new dead code can come back with each change. Add fallow where your team changes code, so that it stops new findings:
- Check each pull request: add one workflow file, and fallow checks the code that each pull request changes.
- Use it with a coding agent: let Claude Code, Codex or Cursor check their own changes before they commit.
Do you use another tool for dead code or duplication? Fallow and linters shows which problem needs which tool. The migration pages move your settings from knip, ts-prune, jscpd, madge, dependency-cruiser and Stylelint.
What fallow analyzes
The bare fallow command runs these five analyses together. Each one has its own page with real output and the action for each finding:
- Dead code: unused files, exports, types and class members.
- Dependencies: packages that
package.jsonlists and no file uses, and packages that files use andpackage.jsondoes not list. - Duplication: blocks of code that exist in two or more places.
- Health: complexity, a score for each file, and the files to refactor first.
- Architecture: circular dependencies and imports that break your boundary rules.
You run these analyses on request: styling, feature flags, security, similar code, mutation testing, type-aware analysis and runtime coverage. To learn which functions run in production, add Fallow Cloud: it counts how often each function of your deployed app runs, and fallow shows these counts in the health report.
Next
- Next: First run. Run
npx fallowon your project and read each part of the report. - Entry points and reachability: read it first when you want to know how fallow decides before you run it.