Find and remove dead code in TypeScript & React projects

Every growing TypeScript/React/Next.js codebase accumulates code nobody imports anymore: helpers that outlived their caller, routes that dropped off the nav, CSS classes nothing renders, components defined but never mounted. It bloats bundles, slows searches, and confuses the next person to touch the file.

DeadCode scans your project and shows exactly what is unused — across four categories — and previews every deletion before it writes a single byte. Here is the shortest path from "this repo feels heavy" to "confirmed clean."

Install

pip install git+https://github.com/Coding-Dev-Tools/deadcode.git

DeadCode is not published on public PyPI (publishing is pending). It is MIT-licensed, Python 3.10+, and runs fully offline on the free tier — no telemetry, no account required. If you use Homebrew, the tap is also available: brew tap Coding-Dev-Tools/homebrew-tap && brew install deadcode.

Scan your project

Run the scanner from your project root. It covers exports, routes, CSS classes, and components with fast regex-based scanning (deliberately dependency-free — no AST or tree-sitter to install).

deadcode scan                 # scan current directory
deadcode scan -p /path/to/project
deadcode scan --json-output  # machine-readable for CI
deadcode scan -c unused_export   # filter to one category

The four categories it catches

CategoryWhat it findsExample
unused_exportExported names never imported elsewhereexport function oldHelper() with zero consumers
dead_routeNext.js routes with no internal linksapp/legacy/page.tsx no longer linked from navigation
orphaned_cssCSS classes not referenced in JSX.oldClass in a CSS module with zero usages
unreferenced_componentReact components defined but never importedA <LegacyWidget> with no import sites

Preview, then remove

Safety is built in. deadcode remove --dry-run shows exactly what would be deleted. The actual remove command only blanks self-contained single-line findings and skips (with a warning) anything spanning multiple lines — so it never leaves half-deleted, broken code.

deadcode remove --dry-run        # preview changes, no writes
deadcode remove                  # apply removals (single-line only)
deadcode remove -c orphaned_css  # remove only orphaned CSS

Always run --dry-run and review the diff before applying.

Gate it in CI

DeadCode emits JSON, so you can fail a pipeline when dead code appears instead of letting it rot.

deadcode scan --json-output > deadcode-report.json
deadcode scan -c dead_route --fail 1      # fail if any dead routes
deadcode scan --fail 10                    # fail if findings >= 10

You can also set a fail_threshold in a .deadcode.yml config file and track trends over time with a saved baseline.

Pricing

The free tier covers CLI scanning and stats for individual devs and OSS — rate-limited, no lock-in, works offline. DeadCode Individual is $12/mo ($10/mo billed annually) for unlimited scans, auto-removal, and CI integration. Suite is $49/mo ($39/mo annually) for all 11 Coding Dev Tools CLI tools under one license. Team is $79/mo for up to 5 devs with trend analytics and shared baselines.

Where to go next

DeadCode is one of 11 tools in the Coding Dev Tools suite, built by autonomous AI. Point it at a stale branch, review the --dry-run output, and delete with confidence.

MIT, Python 3.10+, no telemetry.