Unused Code Killer
"A senior software architect continuously analyzing the health of your codebase."
Unused Code Killer is a professional-grade VS Code extension that deeply analyzes TypeScript, JavaScript, and React codebases to detect dead code, unused files, abandoned components, stale APIs, and unnecessary dependencies — with confidence scoring and safe-delete recommendations.
✨ Features
🔍 Deep Analysis Engine
- Unused File Detection — Finds files unreachable from any entry point via dependency graph analysis
- Dead Export Detection — Identifies functions, classes, and variables with zero references across the project
- Unused Component Detection — Detects React components that are never rendered anywhere
- Unused Dependency Detection — Finds npm packages listed in
package.json but never imported
- Circular Dependency Detection — Identifies circular import chains
- Unused Asset Detection [NEW V2.0] — Scans and flags orphan image, vector, and font files (
.png, .jpg, .svg, .woff2, etc.) not imported or referenced in code string literals
- Environment Variable Analyzer [NEW V2.0] — Scans
.env* files, parses keys, and reports both unused variables (defined but never accessed) and missing variables (accessed via process.env but not defined in config)
🎯 Confidence Scoring
Every issue includes a confidence score (0-100%) based on:
- Import reachability (40%)
- Reference count (20%)
- Dynamic usage risk (15%)
- Git recency (10%)
- Framework conventions (10%)
- File type risk (5%)
🛡️ Safe Delete Engine
Before deletion, a 6-point safety verification checklist runs:
- ✅ Zero static imports
- ✅ No dynamic import patterns
- ✅ Not a route/page file
- ✅ No configuration references
- ✅ Not a framework convention file
- ✅ No string-based references
Three safe actions: Delete, Archive (to .uck-archive/), or Ignore (add to .uckignore)
🖥️ Premium VS Code UI
- Sidebar TreeView with categorized results and severity icons
- Dashboard Webview with health score gauge, stat cards, and issue distribution bars
- Editor Decorations that dim/fade unused code with hover explanations
- Status Bar showing issue count and scan progress
🚀 Framework-Aware
- Auto-detects: React, Next.js (Pages + App Router), Node.js, Express
- Understands "magic" files (
_app.tsx, layout.tsx, middleware.ts, etc.)
- Respects routing conventions — never flags pages/routes as unused
📋 Requirements
- VS Code 1.85+
- Node.js 18+
- A TypeScript or JavaScript project
⚙️ Configuration
| Setting |
Default |
Description |
uck.excludePatterns |
["**/node_modules/**", ...] |
Glob patterns to exclude from analysis |
uck.confidenceThreshold |
60 |
Minimum confidence to report issues |
uck.autoScanOnSave |
false |
Auto-rescan on file save |
uck.enableDecorations |
true |
Show inline editor decorations |
uck.enableStatusBar |
true |
Show status bar item |
🎮 Commands
| Command |
Description |
UCK: Scan Project |
Run full project analysis |
UCK: Rescan Project |
Re-run analysis |
UCK: Safe Delete |
Delete/archive/ignore selected item |
UCK: Show Dashboard |
Open the dashboard panel |
📁 .uckignore
Create a .uckignore file in your project root (gitignore-style syntax):
# Ignore specific files
src/legacy/oldModule.ts
# Ignore patterns
**/generated/**
**/fixtures/**
Or add // @uck-ignore at the top of any file to skip it.
🏗️ Architecture
The extension uses a worker thread for heavy analysis to keep VS Code responsive:
- Project Scanner → Detects framework, entry points, file inventory
- AST Parser (ts-morph) → Extracts imports, exports, JSX usage, dynamic imports
- Dependency Graph → Builds directed graph with reachability analysis
- Detectors → Unused files, exports, components, dependencies
- Confidence Scorer → Multi-factor scoring with human-readable explanations
- Safe Delete Engine → Safety verification before any deletion
📄 License
MIT © Wiroxa & Shivam Kumar
Made with ❤️ by Shivam Kumar
GitHub: @shivvx | LinkedIn: @shivvx
Official Website: wiroxa.dev