Gathering detailed insights and metrics for sweepy
Gathering detailed insights and metrics for sweepy
Gathering detailed insights and metrics for sweepy
Gathering detailed insights and metrics for sweepy
🧹 A powerful CLI tool to detect and remove unused JS/TS/CSS files, jsx components, environment keys, exports, static assets, and npm dependencies in your codebase.
npm install sweepy
Typescript
Module System
Min. Node Version
Node Version
NPM Version
63.8
Supply Chain
95.2
Quality
84.1
Maintenance
100
Vulnerability
98.9
License
JavaScript (100%)
Total Downloads
676
Last Day
1
Last Week
14
Last Month
87
Last Year
676
MIT License
2 Stars
7 Commits
1 Watchers
1 Branches
1 Contributors
Updated on May 01, 2025
Latest Version
1.2.1
Package Id
sweepy@1.2.1
Unpacked Size
3.91 MB
Size
777.25 kB
File Count
5
NPM Version
11.1.0
Node Version
22.12.0
Published on
Apr 25, 2025
Cumulative downloads
Total Downloads
Last Day
-50%
1
Compared to previous day
Last Week
-17.6%
14
Compared to previous week
Last Month
-85.2%
87
Compared to previous month
Last Year
0%
676
Compared to previous year
Detect and eliminate unused code and leftover files in your JavaScript, TypeScript, and all your projects — including variables, modules, stylesheets, CSS selectors, config files, JSON data, HTML templates,
.env
keys, exports, aliases, dependencies, and media assets.
Sweepy is an all-in-one, AST-powered CLI tool for eliminating unused code. It helps you find:
.html
and .json
files.env
variables.babelrc
, tsconfig.*.json
)Sweepy is built for developers, teams, CI pipelines, and open-source maintainers who want to keep projects clean and efficient.
1npm install -g sweepy
1npm install --save-dev sweepy
If installed locally:
1npx sweepy [options]
Sweepy runs instantly with zero config — just install and run. To customize behavior:
1sweepy --init
Adds a "sweepy"
block to package.json
with defaults like:
Clean code starts with clean files. Keep it Sweepy! 🧹
.js
, .ts
, .jsx
, .tsx
, .css
, .scss
, .html
, .json
, and media assets (PNG, JPG, SVG, WebP)--detect config
) such as .babelrc
, .prettierrc
, .editorconfig
, and tsconfig.*.json
.env
keys in any environment--detect vars
)--detect alias
)--detect deps
)export const
, export default
)<MyComponent />
)import()
, require()
)--since <commit>
for incremental analysis--delete --confirm
, or use --interactive
for grouped selectionq
).sweepy-trash/
and are fully recoverablecustomCssSafelist
in configSweepy doesn’t just check imports—it analyzes ASTs, handles dynamic patterns, integrates with git, and gives you export-level insight with recovery safety. Unlike other tools, it covers your entire project: code, styles, variables, envs, and assets.
Feature | 🧹 Sweepy | depcheck | unimported | PurgeCSS | ts-prune | eslint-plugin-unused-imports |
---|---|---|---|---|---|---|
AST-based import/export analysis | ✅ | ❌ | ❌ | ❌ | ✅ | ❌ |
JSX <Component /> detection | ✅ | ❌ | ❌ | ❌ | ❌ | ❌ |
Export symbol usage analysis | ✅ | ❌ | ❌ | ❌ | ✅ | ✅ (imports only) |
Git-aware scanning (--since ) | ✅ | ❌ | ❌ | ❌ | ❌ | ❌ |
Unused HTML + JSON file detection | ✅ | ❌ | ❌ | ❌ | ❌ | ❌ |
Unused CSS/SCSS selectors | ✅ | ❌ | ❌ | ✅ (regex) | ❌ | ❌ |
.env key usage detection | ✅ | ❌ | ❌ | ❌ | ❌ | ❌ |
Unused variable detection (--detect vars ) | ✅ | ❌ | ❌ | ❌ | ❌ | ✅ |
Unused or duplicate config file detection | ✅ | ❌ | ❌ | ❌ | ❌ | ❌ |
Dead/misconfigured alias detection | ✅ | ❌ | ❌ | ❌ | ❌ | ❌ |
HTML + JSON report output | ✅ | ❌ | ❌ | ❌ | ❌ | ❌ |
Safe deletion with recovery | ✅ | ❌ | ❌ | ❌ | ❌ | ❌ |
Interactive file deletion UI with type grouping | ✅ | ❌ | ❌ | ❌ | ❌ | ❌ |
Alias resolution (TS/Webpack/Vite/Babel) | ✅ | ✅ | ✅ | ❌ | ⚠️ manual | ✅ |
CI-friendly dry-run mode | ✅ | ✅ | ❌ | ❌ | ❌ | ✅ |
Dynamic import / require() tracking | ✅ | ❌ | ✅ | ❌ | ❌ | ❌ |
Glob export support (export * ) | ✅ | ❌ | ❌ | ❌ | ✅ | ❌ |
.scss and CSS Modules support | ✅ | ❌ | ❌ | ❌ | ❌ | ❌ |
classnames , clsx handling | ✅ | ❌ | ❌ | ❌ | ❌ | ❌ |
CLI + package.json config support | ✅ | ❌ | ✅ | ❌ | ❌ | ❌ |
Unused + undeclared dependencies detection | ✅ | ✅ | ✅ | ❌ | ❌ | ❌ |
CSS selector safelist support | ✅ | ❌ | ❌ | ❌ | ❌ | ❌ |
1sweepy # Full scan 2sweepy --only js css # Scan JS and CSS only 3sweepy --delete --interactive # Interactive file deletion 4sweepy --export report.txt # Export results to text file 5sweepy --html-report # Generate HTML report 6sweepy --detect env exports # Detect only env and exports
Option | Description |
---|---|
--only | Filter scan to js , css , assets |
--detect | Choose detection types: html, js, css, json, assets, exports, deps, env, alias, vars, config |
--delete | Delete unused files |
--confirm | Delete without confirmation |
--interactive | Select files to delete or recover |
--dry-run | Simulate deletion (safe preview) |
--export <file> | Export results to .txt or .json |
--html-report | Generate styled HTML report |
--recover [file] | Recover a specific file |
--recover-all | Recover everything from trash |
--since <commit> | Limit scan to files changed since commit |
--init | Add default config to package.json |
--print-config | Display merged configuration |
--prune-trash | Permanently delete .sweepy-trash/ contents |
--ignore <patterns> | Glob patterns to ignore (override config) |
1export const unused = () => {} 2export default UnusedComponent
Sweepy will flag both if unused.
JSX detection:
1<MyComponent /> // matched to MyComponent.jsx or similar
Sweepy config merges from:
package.json > sweepy
.sweepyrc.json
(optional)1"sweepy": { 2 "ignore": ["dist/**", "*.test.*"], 3 "types": ["js", "css", "assets", "deps"], 4 "customAliases": { 5 "@components": "src/components", 6 "@utils": "src/utils" 7 }, 8 "customCssSafelist": [ 9 "^\\.active$", 10 "^\\.dark-mode$", 11 "^\\.btn-.*" 12 ] 13}
1sweepy --recover file.js #Recover one file 2sweepy --recover-all #Recover everything 3sweepy --prune-trash #Delete trash permanently
1sweepy --html-report
Generates a rich, visual report at sweepy-report.html
.
1sweepy --since HEAD~5 --only js css --dry-run --json
1name: Sweepy CI 2 3on: 4 push: 5 branches: [main] 6 pull_request: 7 branches: [main] 8 9jobs: 10 sweepy: 11 runs-on: ubuntu-latest 12 steps: 13 - uses: actions/checkout@v4 14 - uses: actions/setup-node@v4 15 with: 16 node-version: 20 17 - run: npm install 18 - run: npx sweepy --since HEAD~10 --json --dry-run
Check out the CHANGELOG.md for version history and release notes.
Sweepy is tested using Vitest to ensure accurate detection and safe cleanup of unused files, selectors, and dependencies.
1npm test # Run all tests once 2npm run test:watch # (optional) Watch mode for local development
Test coverage is automatically reported through GitHub Actions and Codecov.
We’d love your help! Whether it’s a tiny typo, a brand‑new feature, or a nasty bug you’ve spotted, every bit counts :D
main
npm install
then npm test
to make sure everything passesSweepy follows conventional commits and a clean‑code style.
Let's make the code world a little cleaner, together! 🧹✨
Thanks goes to these wonderful people (emoji key):
anthonyhalim150 💻 | ||||||
|
This project follows the all-contributors specification. Contributions of any kind welcome!
No vulnerabilities found.
No security vulnerabilities found.