
Product
Announcing Socket Fix 2.0
Socket Fix 2.0 brings targeted CVE remediation, smarter upgrade planning, and broader ecosystem support to help developers get to zero alerts.
dead-code-checker
Advanced tools
Dead Code Checker is a tool for finding dead code in your JavaScript or TypeScript project. It helps to ensure a cleaner and more maintainable code base.
Stop wasting time on dead code. Start shipping faster, cleaner applications today.
Transform your codebase from cluttered to clean in minutes. Dead Code Checker automatically finds and eliminates unused functions and variables, reducing bundle sizes by up to 30% and making your code instantly more maintainable.
Every day, developers waste 2-3 hours navigating through unused code that:
The solution? Automated dead code detection that works in seconds, not hours.
# One command to rule them all
npx dead-code-checker -f ./src
With Real-Time Progress Tracking:
🔍 Analyzing codebase...
█████████████████████████ | 100% | 100/100 | 📁 Collecting files
███████████████████████ | 85% | 1,058/1,247 | 📖 Reading files 📄 src/components/Button.tsx
████████████████ | 60% | 748/1,247 | 🔍 Processing declarations 📄 src/utils/helpers.js
████████████████████████ | 90% | 1,122/1,247 | ⚡ Analyzing usage 📄 src/hooks/useData.ts
Progress Bar Explained:
🎯 Instant Results:
❌ Before: 847 KB bundle size, 2,341 unused variables
✅ After: 592 KB bundle size, 0 unused code (-30% size!)
Feature | Benefit | Time Saved |
---|---|---|
🔍 Smart Detection | Finds functions, variables, imports | 2-3 hours/week |
🎯 Framework Support | React, Vue, Angular, Node.js | Setup instantly |
⚙️ CI/CD Ready | Prevent dead code in PRs | Review time -50% |
📊 Detailed Reports | Exact locations + line numbers | Debug time -70% |
📊 Real-Time Progress | Live tracking of current file analysis | Never wonder if it's stuck again |
🧩 Zero Config | Works out of the box | Setup: 30 seconds |
Frontend | Backend | Universal |
---|---|---|
⚛️ React | 🚀 Node.js | 📦 TypeScript |
🟢 Vue.js | 🔧 Express | 📋 JavaScript |
🅰️ Angular | ⚡ Fastify | 🔗 ES Modules |
📱 React Native | 🛠️ NestJS | 📄 CommonJS |
# No installation needed - scan any project immediately
npx dead-code-checker -f ./src
# See results instantly:
✅ Found 23 unused functions in 12 files
📁 src/utils/helpers.ts:45 - function calculateOldMetric
📁 src/components/OldButton.tsx:12 - const unusedVariable
# Install globally for repeated use
npm install -g dead-code-checker
# Or add to your project
npm install dead-code-checker --save-dev
# Ignore specific functions/variables
dead-code-checker -f ./src -in "debugFunction,testVariable"
# Ignore entire folders
dead-code-checker -f ./src -if "tests,__mocks__"
# CI/CD mode (fails on dead code)
dead-code-checker --ci -f ./src
# Quiet mode (minimal output)
dead-code-checker --quiet -f ./src
# Disable progress bar
dead-code-checker --no-progress -f ./src
Prevent dead code from ever reaching production:
# GitHub Actions Example
name: Dead Code Check
on: [push, pull_request]
jobs:
dead-code-check:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '20'
- name: Check for dead code
run: npx dead-code-checker --ci -f ./src
Build custom workflows and integrations:
const DeadCodeChecker = require('dead-code-checker');
const checker = new DeadCodeChecker('src/', {
ignoreNames: ['debugUtils', 'testHelpers'],
ignoreFolders: ['tests', '__mocks__']
});
checker.run();
const report = checker.getReport();
// Custom reporting, Slack notifications, etc.
console.log(`Found ${report.deadCode.length} issues`);
For a team of 5 developers:
Start saving time today - it's free and takes 30 seconds.
Command | Description | Example |
---|---|---|
-f, --folder | Target folder to scan | -f ./src |
-in, --ignoreNames | Ignore specific names | -in "debug,test" |
-if, --ignoreFolders | Ignore folders | -if "tests,mocks" |
--ci | CI mode (exit code 1 if dead code found) | --ci |
-q, --quiet | Suppress all output except errors | --quiet |
--no-progress | Disable progress bar display | --no-progress |
-h, --help | Show all options | -h |
-v, --version | Show version | -v |
Clean projects feel different:
✅ No dead code found! Your codebase is clean and optimized.
Found issues? No problem:
🔍 Found 15 unused items:
📁 src/utils/helpers.ts
├─ Line 23: function oldHelper
└─ Line 45: const unusedConfig
📁 src/components/Button.tsx
└─ Line 12: const deprecatedStyle
💡 Tip: Remove these to reduce bundle size by ~18KB
Ready to eliminate dead code and boost performance?
# One command, instant results
npx dead-code-checker -f ./src
Questions? Check our examples or open an issue.
MIT License - feel free to use in commercial projects
Built with ❤️ by developers, for developers
Copyright (c) 2025 Denisoed - Making codebases cleaner, one scan at a time.
FAQs
Dead Code Checker is a tool for finding dead code in your JavaScript or TypeScript project. It helps to ensure a cleaner and more maintainable code base.
The npm package dead-code-checker receives a total of 493 weekly downloads. As such, dead-code-checker popularity was classified as not popular.
We found that dead-code-checker demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Product
Socket Fix 2.0 brings targeted CVE remediation, smarter upgrade planning, and broader ecosystem support to help developers get to zero alerts.
Security News
Socket CEO Feross Aboukhadijeh joins Risky Business Weekly to unpack recent npm phishing attacks, their limited impact, and the risks if attackers get smarter.
Product
Socket’s new Tier 1 Reachability filters out up to 80% of irrelevant CVEs, so security teams can focus on the vulnerabilities that matter.