dead-hunter
v1.0.1
Published
A CLI tool that scans JavaScript and TypeScript projects for unused files, unused exports, orphan components, and dead code.
Maintainers
Readme
deadcode-hunter
A CLI tool that scans JavaScript and TypeScript projects for unused files, unused exports, orphan components, and dead code.
Installation
npm install -g dead-hunterOr run instantly:
npx dead-hunterCLI Usage
$ 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 KBCI Mode
npx dead-hunter --ciExits with code 1 if any dead code is found.
Ignore Rules
Create deadcode-hunter.config.json in your project root:
{
"ignore": [
"src/generated",
"src/legacy",
"src/vendor"
]
}Features
| 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 |
Supported File Types
.js,.ts,.jsx,.tsx
Auto-ignored: node_modules, dist, build, coverage, .git
Platforms
macOS, Linux, Windows.
Test
node test.jsLicense
MIT
