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."
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.
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
| Category | What it finds | Example |
|---|---|---|
unused_export | Exported names never imported elsewhere | export function oldHelper() with zero consumers |
dead_route | Next.js routes with no internal links | app/legacy/page.tsx no longer linked from navigation |
orphaned_css | CSS classes not referenced in JSX | .oldClass in a CSS module with zero usages |
unreferenced_component | React components defined but never imported | A <LegacyWidget> with no import sites |
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.
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.
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.
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.