Skip to content

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.

License

Notifications You must be signed in to change notification settings

denisoed/dead-code-checker

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

77 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

๐Ÿš€ Dead Code Checker - Eliminate Dead Code, Boost Performance

License: MIT npm version Downloads

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.

Preview

โšก Why Dead Code is Killing Your Productivity

Every day, developers waste 2-3 hours navigating through unused code that:

  • ๐Ÿ“ˆ Increases bundle sizes - slowing down your apps
  • ๐Ÿง  Creates cognitive overload - making code reviews painful
  • ๐Ÿ› Hides real bugs - in a sea of unused functions
  • โฑ๏ธ Slows down refactoring - fear of breaking "mystery" code
  • ๐Ÿ’ธ Costs money - in CI/CD time and deployment overhead

The solution? Automated dead code detection that works in seconds, not hours.

โœจ Transform Your Codebase in Minutes

# 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:

  • โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆ - Visual progress bar
  • 85% - Completion percentage
  • 1,058/1,247 - Current/Total files processed
  • ๐Ÿ“– Reading files - Current stage (Collecting โ†’ Reading โ†’ Processing โ†’ Analyzing)
  • ๐Ÿ“„ filename.tsx - Currently processing file

๐ŸŽฏ Instant Results:

  • Find all unused functions and variables
  • Get exact file locations and line numbers
  • Remove dead code with confidence
  • Reduce bundle size immediately
  • NEW: Real-time progress tracking with current file display

๐Ÿ† Real Impact, Real Results

Before vs After

โŒ Before: 847 KB bundle size, 2,341 unused variables
โœ… After:  592 KB bundle size, 0 unused code (-30% size!)

๐Ÿš€ Key Features That Save You Time

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

๐Ÿ“ฑ Supports Everything You Build

Frontend Backend Universal
โš›๏ธ React ๐Ÿš€ Node.js ๐Ÿ“ฆ TypeScript
๐ŸŸข Vue.js ๐Ÿ”ง Express ๐Ÿ“‹ JavaScript
๐Ÿ…ฐ๏ธ Angular โšก Fastify ๐Ÿ”— ES Modules
๐Ÿ“ฑ React Native ๐Ÿ› ๏ธ NestJS ๐Ÿ“„ CommonJS

โšก Quick Start - Get Results in 30 Seconds

๐ŸŽฏ Option 1: Instant Scan (Recommended)

# 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

๐Ÿ› ๏ธ Option 2: Install for Regular Use

# Install globally for repeated use
npm install -g dead-code-checker

# Or add to your project
npm install dead-code-checker --save-dev

๐ŸŽฎ Advanced Options

# 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

๐Ÿข Perfect for Professional Teams

๐Ÿ”„ CI/CD Integration

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

๐Ÿ“Š API Integration

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`);

๐Ÿ“ˆ ROI Calculator

For a team of 5 developers:

  • Time saved per week: 10 hours (dead code navigation)
  • Bundle size reduction: 20-30% average
  • Faster builds: 15-25% improvement
  • Yearly value: $50,000+ in developer productivity

Start saving time today - it's free and takes 30 seconds.

๐ŸŽฏ Command Reference

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

๐ŸŽฌ Live Examples

Report

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

๐Ÿค Join the Community

  • ๐ŸŒŸ Star us on GitHub if this tool saved you time
  • ๐Ÿ› Report issues to help us improve
  • ๐Ÿ’ก Suggest features for the roadmap
  • ๐Ÿค Contribute and help other developers

๐Ÿš€ Start Cleaning Your Code Now

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.


๐Ÿ“œ License

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.

About

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.

Resources

License

Stars

Watchers

Forks

Packages

No packages published