An advanced tool to detect and clean unimported components, files, functions, and unused npm packages in your JavaScript/TypeScript project.
- 🔍 detects unused exports (functions, components, variables)
- 📁 identifies files that are not imported anywhere
- 📦 finds npm packages that are installed but not used
- 🧹 provides options to clean up unused files
- 🗑️ can uninstall unused npm packages
- 🖱️ interactive mode for selective cleanup
- 🎨 new: fully interactive ui with menus and visualizations
- 👁️ file preview functionality
- 🌈 colorful and formatted output
- 💾 export results in multiple formats (json, markdown, html)
- 🔄 json output for integration with other tools
npm install -g cleanext
npx cleanext
cleanext
cleanext ./src
cleanext --fully-interactive
cleanext -fi
The interactive UI provides:
- A user-friendly menu system
- Colorful and formatted output
- File preview functionality
- Interactive file and package selection
- Multiple export formats (JSON, Markdown, HTML)
cleanext --ignore "**/*.stories.tsx" "**/*.test.js"
cleanext --clean
cleanext --uninstall
cleanext --interactive --clean --uninstall
cleanext --skip-files --skip-packages
cleanext --json
cleanext --output results.json
git clone https://github.com/esmiraldo/cleanext.git cd cleanext
npm install
npm run build
node dist/cli.js ./your-project-directory
node dist/cli.js --fully-interactive
CleanExt scans your JavaScript and TypeScript files to:
- Find all exported functions, classes, and variables
- Find all imports across your codebase
- Compare the two to identify exports that are never imported
- Identify files that are not imported anywhere
- Check package.json dependencies against actual imports
- Provide options to clean up unused code and packages
- The tool doesn't track dynamic imports (
import()
) - It may not detect imports that use string manipulation or complex patterns
- It doesn't track usage through re-exports
- Some false positives may occur for entry point files or components used only in HTML
MIT