Introduction
Unreach is a powerful CLI tool that uses advanced static analysis to find truly unused code in your codebase. Unlike simple file-based tools, Unreach follows actual import/export chains to ensure 100% accuracy in detecting unused code.
What is Unreach?
Unreach is a command-line tool that deeply analyzes your codebase to identify:
- Unused packages - npm packages that are installed but never imported
- Unused imports - Import statements that import symbols never used
- Unused exports - Exported symbols that are never imported elsewhere
- Unused functions - Functions that are defined but never called
- Unused variables - Variables that are declared but never referenced
- Unused types - TypeScript types, interfaces, and enums that are never used
- Unused files - Files that are never imported or referenced
- Unused configs - Unused configuration keys in
package.jsonandtsconfig.json - Unused scripts - npm scripts that are never executed
- Unused CSS classes - CSS classes defined but never used in JSX/TSX
- Unused assets - Image and font files that are never imported
Why Unreach?
Traditional tools often miss unused code because they only check file existence or simple patterns. Unreach goes deeper:
Real Dependency Tracking
Unreach follows actual import/export chains, not just file existence. This ensures accurate detection of truly unused code by understanding how your code is actually connected.
TypeScript Support
Full support for TypeScript, including:
- Type-only imports/exports
- Type definitions
- Interface declarations
- Generic types
- Enums
Comprehensive Analysis
Unreach analyzes your entire codebase structure, including:
- JavaScript and TypeScript files
- JSX/TSX React components
- Configuration files
- Package dependencies
- CSS classes
- Asset files
How It Works
Unreach uses advanced static analysis to:
- Parse your codebase - Uses TypeScript's parser to build an Abstract Syntax Tree (AST) of all files
- Build dependency graph - Creates a graph of all imports, exports, and function calls
- Track reachability - Starting from entry points, marks all reachable code
- Identify unused code - Reports everything that isn't reachable from entry points
This approach ensures 100% accuracy - if code is truly unused, Unreach will find it.
Key Features
- ✅ Real dependency tracking - Follows actual import/export chains
- ✅ TypeScript support - Full support for TypeScript features
- ✅ Dynamic import support - Tracks dynamic imports (
import()) and conditional imports - ✅ JSX/TSX support - Analyzes React components and JSX element usage
- ✅ Entry point detection - Automatically detects entry points from
package.jsonandtsconfig.json - ✅ Test file detection - Automatically excludes test files from analysis
- ✅ Multiple export formats - Export results in JSON, CSV, TSV, Markdown, or HTML
- ✅ Configuration files - Support for
unreach.config.jsandunreach.config.ts - ✅ Watch mode - Continuously monitors files and re-scans on changes
- ✅ Interactive mode - Menu-driven interface for configuring scans
Quick Start
Get started with Unreach in seconds:
# Run with npx (no global install)
npx unreach@latest scan
# Or install globally
npm install -g unreach
# Then run
unreach scanNext Steps
- Installation - Learn how to install Unreach
- Getting Started - Run your first scan
- Features - Learn what Unreach can detect
- CLI Reference - Complete command-line reference
"Unreach: Find what you can delete without breaking your project."
