🧹 Unused Import Cleaner
Detect and remove unused imports across your codebase in seconds — with full transparency reports.
✨ Features
🔍 Smart Detection
Leverages TypeScript's own language server diagnostics (error codes 6133 & 6192) for 100% accuracy. No guessing, no false positives — the same engine VS Code uses to highlight unused code.
🗑️ Precise Removal
- Removes only the unused import names while preserving those still in use
- Handles all import styles: named
{ A, B }, default import X, namespace import * as X, aliased A as B, and CommonJS require()
- Automatically cleans up leftover blank lines
📊 Detailed Reports
After every cleanup run, get a rich, interactive report showing:
- Files scanned and files changed
- Total imports removed
- Per-file breakdown with exact import names, line numbers, and source modules
- Export to Markdown — share cleanup summaries with your team
⚡ Two Modes
| Mode |
Use Case |
| Current File |
Quick cleanup of the file you're editing |
| Entire Workspace |
Full project sweep with progress tracking |
⚙️ Fully Configurable
- Choose which file types to scan (
.ts, .tsx, .js, .jsx)
- Define exclusion patterns (
node_modules, dist, etc.)
- Toggle import organization, confirmation prompts, and auto-report display
🚀 Quick Start
Commands
Open the Command Palette (Ctrl+Shift+P / Cmd+Shift+P) and run:
| Command |
What It Does |
Import Cleaner: Clean All Unused Imports in Workspace |
Scans and cleans the entire workspace |
Import Cleaner: Clean Unused Imports in Current File |
Cleans only the active editor file |
Import Cleaner: Show Last Cleanup Report |
Reopens the most recent cleanup report |
Settings
Configure via Settings → Extensions → Unused Import Cleaner:
| Setting |
Default |
Description |
languages |
["typescript", "typescriptreact", "javascript", "javascriptreact"] |
File types to scan |
exclude |
["**/node_modules/**", "**/dist/**", "**/build/**", ...] |
Glob patterns to skip |
organizeImports |
true |
Sort and group imports after removal |
showReportAfterClean |
true |
Auto-show report after cleaning |
confirmBeforeClean |
true |
Show confirmation before workspace clean |
📋 Example Report
# Import Cleanup Report
**Generated:** 6/12/2026, 11:58:14 AM
**Scope:** workspace
**Duration:** 3.42s
**Files Scanned:** 127
**Files Changed:** 8
**Imports Removed:** 23
## src/utils/helpers.ts
| Import | Line | Module | Statement |
|-------------|------|---------|---------------------------------------------------------|
| `useEffect` | 2:10 | `react` | `import { useState, useEffect, useMemo } from 'react';` |
| `useMemo` | 2:26 | `react` | `import { useState, useEffect, useMemo } from 'react';` |
## src/components/Dashboard.tsx
| Import | Line | Module | Statement |
|---------|------|---------|------------------------------|
| `axios` | 1:8 | `axios` | `import axios from 'axios';` |
🔧 How It Works
- Scans all supported files in your workspace (respecting exclusion patterns)
- Queries TypeScript's language server for unused-import diagnostics
- Parses each import line to identify exactly which names are unused
- Applies precise text edits — removing only what's unused, keeping what's used
- Cleans up leftover blank lines and optionally organizes remaining imports
- Generates a detailed webview report with full transparency
📌 Requirements
- VS Code 1.75.0 or later
- TypeScript language server (built into VS Code)
- A
tsconfig.json or jsconfig.json in your workspace for accurate diagnostics
Stop wasting time hunting for dead imports. One command. Clean code. Full report. 🚀