A CLI tool that scans JavaScript and TypeScript projects for unused files, unused exports, orphan components, and dead code.
npm install -g dead-hunterOr run instantly:
npx dead-hunter$ npx dead-hunter
🔍 Scanning for dead code...
Scanned 47 files
❌ Unused Files:
- utils/oldAuth.js
- services/tempApi.js
⚠ Unused Exports:
- formatCurrency (utils/format.js)
- validatePhone (utils/validators.js)
⚠ Orphan Components:
- OldHeader (components/Header.jsx)
Estimated unused code size: 12.5 KB
npx dead-hunter --ciExits with code 1 if any dead code is found.
Create deadcode-hunter.config.json in your project root:
{
"ignore": [
"src/generated",
"src/legacy",
"src/vendor"
]
}| Feature | Description |
|---|---|
| Unused files | Files never imported or required by any other file |
| Unused exports | Exported functions/vars never imported elsewhere |
| Orphan components | React/Angular components not used in any other file |
| Bundle size | Estimated KB of unused code |
| CI mode | Exit code 1 when dead code found |
| Ignore config | Skip specific directories or files |
.js,.ts,.jsx,.tsx
Auto-ignored: node_modules, dist, build, coverage, .git
macOS, Linux, Windows.
node test.jsMIT