New:Introducing Socket Scanning for VS Code Marketplace Extensions.Learn more →
Get Started

sweep-unused

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

sweep-unused

remove unused dependencies by analyzing your source code

latest
Source
npmnpm
Version
1.0.4
Version published
Maintainers
1
Created
Source

sweep-unused

A CLI tool that analyzes your codebase for unused dependencies and automatically removes them. Ideal for keeping package.json and node_modules clutter-free.

Features

  • Code Analysis: Uses depcheck to find unused imports
  • Two Modes:
    • Interactive: Prompts for confirmation before removing
    • Auto: Removes dependencies without asking
  • Local or CI usage: Can be run in a pre-install hook or as part of a CI pipeline

Installation

Install globally using npm:

npm install -g sweep-unused

Usage

Run sweep-unused from any project directory:

Interactive Mode

sweep-unused

This scans your project for unused dependencies, lists them, and asks if you want to remove them.

Auto Mode

sweep-unused --auto

No prompt; it immediately removes all detected unused dependencies.

Package Scripts

Add a script in your package.json:

{
  "scripts": {
    "sweep": "sweep-unused --auto"
  }
}

Then run:

npm run sweep

Contributing

Contributions are welcome! Feel free to open issues or submit pull requests on our GitHub repository:

https://github.com/sohei1l/sweep-unused

License

MIT

Keywords

dependencies

FAQs

Package last updated on 20 Feb 2025

Related posts