diedeadcode
Conservative dead code detection for TypeScript and JavaScript.
ddd finds unused exports, unreachable functions, and dead code in your codebase with confidence scoring to minimize false positives.
Installation
npm install -D diedeadcode
Or run directly with npx:
npx diedeadcode .
Quick Start
ddd .
ddd . --verbose
ddd init
ddd analyze . --format json
ddd analyze . --check
Features
- Fast - Built on oxc for blazing-fast parsing
- Conservative - Confidence scoring reduces false positives
- Transitive analysis - Detects code that's only called by other dead code
- Framework-aware - Understands Next.js, Express, Jest, Vitest patterns
- Configurable - Ignore patterns, entry points, and more
Configuration
Run ddd init to generate a ddd.toml in your project root:
include = ["**/*.ts", "**/*.tsx", "**/*.js", "**/*.jsx"]
exclude = ["**/node_modules/**", "**/dist/**", "**/*.test.*"]
[entry]
files = ["src/index.ts", "src/main.ts"]
patterns = ["**/pages/**/*.tsx"]
autoDetect = true
[output]
format = "table"
minConfidence = "high"
showChains = true
Alternative Installation Methods
Cargo (Rust)
cargo install diedeadcode
Homebrew (macOS)
brew install dean0x/tap/diedeadcode
Documentation
See the GitHub repository for full documentation.
License
MIT