Security News
Weekly Downloads Now Available in npm Package Search Results
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.
unused-package
Advanced tools
unused-package is a dependency analysing tool which lets you know which packages are not being used or if package is devDependency but installed as normal dependency
unused-package is a dependency analysing tool which lets you know which packages are not being used or if package is devDependency but installed as normal dependency
Using npm
npm install unused-package --save-dev
Using yarn
yarn add --dev unused-package
create a file named unused.js in root directory with below code
const check = require("unused-package");
check({ entries: ['entry path to your code'] }).then((res) => {
console.log(res) // list of packages returned by library
});
Example:
//for react projects
check({ entries: ['src'] }).then((res) => {
console.log(res)
});
//for next.js projects
check({ entries: ['pages','src','components','next.config.js'] }).then((res) => {
console.log(res)
});
Include unused.js file in your build script to check for extra packages before every build step in package.json
Example:
//for react projects
"scripts":{
"build": " node unused.js && react-scripts build",
}
//for next.js projects
"scripts":{
"build": " node unused.js && next build",
}
OR
create a seperate script to run unused.js file
"scripts":{
"detect:unused:packages": " node unused.js"
}
Note: Currently package is still in initial phase and if library returns and false positives please feel free to open an issue
FAQs
unused-package is a dependency analysing tool which lets you know which packages are not being used or if package is devDependency but installed as normal dependency
We found that unused-package demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.
Security News
A Stanford study reveals 9.5% of engineers contribute almost nothing, costing tech $90B annually, with remote work fueling the rise of "ghost engineers."
Research
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.