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