Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

depcheck

Package Overview
Dependencies
Maintainers
2
Versions
53
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

depcheck - npm Package Compare versions

Comparing version 0.4.7 to 0.5.9

.eslintignore

44

package.json
{
"name": "depcheck",
"version": "0.4.7",
"version": "0.5.9",
"description": "Check dependencies in your node module",
"main": "index",
"main": "dist/index.js",
"bin": {

@@ -11,22 +11,42 @@ "depcheck": "bin/depcheck"

"type": "git",
"url": "git://github.com/rumpl/depcheck.git"
"url": "git://github.com/lijunle/depcheck-es6.git"
},
"scripts": {
"test": "mocha test/index.js"
"component": "babel-node ./build/component.js > ./dist/component.json",
"compile": "babel --optional runtime src/ -d dist/",
"depcheck": "node ./bin/depcheck --ignore-bin-package=false --specials=bin,eslint",
"depcheck-web": "node ./bin/depcheck --ignore-bin-package=false --specials=bin,eslint --web-report",
"patch-version": "babel-node ./build/patch-version.js",
"prepublish": "npm run compile && npm run component",
"lint": "eslint ./src ./test ./build",
"test": "mocha --compilers js:babel/register ./test ./test/special",
"test-coverage": "babel-node ./node_modules/.bin/isparta cover node_modules/mocha/bin/_mocha -- ./test ./test/special"
},
"author": "Djordje Lukic",
"author": [
"Djordje Lukic <lukic.djordje@gmail.com>",
"Junle Li <lijunle@gmail.com>"
],
"license": "MIT",
"readmeFilename": "README.md",
"dependencies": {
"detective": "^4.0.0",
"lodash": "^3.3.0",
"minimatch": "^2.0.1",
"optimist": "~0.6.0",
"q": "^1.0.1",
"walkdir": "0.0.7"
"babel-runtime": "^5.8.25",
"babylon": "^5.8.29",
"deps-regex": "^0.1.4",
"js-yaml": "^3.4.2",
"minimatch": "^3.0.0",
"request": "^2.65.0",
"require-package-name": "^2.0.1",
"walkdir": "0.0.10",
"yargs": "^3.26.0"
},
"devDependencies": {
"babel": "^5.8.23",
"babel-eslint": "^4.1.3",
"codecov.io": "^0.1.6",
"eslint": "^1.7.3",
"eslint-config-airbnb": "0.1.0",
"isparta": "^3.0.4",
"mocha": "^2.1.0",
"should": "^5.0.1"
"should": "^7.1.0"
}
}

@@ -1,66 +0,89 @@

# depcheck [![build status](https://secure.travis-ci.org/rumpl/depcheck.png)](http://travis-ci.org/rumpl/depcheck)
# depcheck
Keeping track of your dependencies is not an easy task, especially if you have a big application.
Are you sure you are using all of the dependencies you define in your `package.json` file? One way to find out is to
look at all your files and check which modules you are using, but that's too time consuming. Or maybe you can do a
`grep` on all the files of your project, and then some `grep -v` to remove the junk. But that's a hassle too.
Keeping track of your dependencies is not an easy task, especially if you have a big project. Are you sure you are using all of the dependencies you define in your `package.json` file? One way to find out is to look at all your files and check which modules you are using, but that's too time consuming. Or maybe you can do a `grep` on all the files of your project, and then some `grep -v` to remove the junk. But that's a hassle too.
And that is why `depcheck` exists.
And that is why `depcheck` exists - it's a nifty little tool that looks at your project files and scans your code in order to find any unused dependencies.
It's a nifty little tool that looks at your `package.json` file and scans your code in order to find any unused
dependencies.
## Build Status
Using grunt ? Checkout the [grunt plugin](https://github.com/rumpl/grunt-depcheck).
[![Build Status](https://travis-ci.org/depcheck/depcheck.svg?branch=master)](https://travis-ci.org/depcheck/depcheck)
[![Build status](https://ci.appveyor.com/api/projects/status/xbooh370dinuyi0y/branch/master?svg=true)](https://ci.appveyor.com/project/lijunle/depcheck/branch/master)
[![codecov.io](https://codecov.io/github/depcheck/depcheck/coverage.svg?branch=master)](https://codecov.io/github/depcheck/depcheck?branch=master)
[![Dependency Status](https://david-dm.org/depcheck/depcheck.svg)](https://david-dm.org/depcheck/depcheck)
[![devDependency Status](https://david-dm.org/depcheck/depcheck/dev-status.svg)](https://david-dm.org/depcheck/depcheck#info=devDependencies)
## Installation
`npm install depcheck -g`
```
npm install depcheck -g
```
## Usage
As easy as **depcheck [DIRECTORY]**.
```
depcheck [directory] [arguments]
```
Where DIRECTORY is the root directory of your application (where the package.json is).
This will list all the unused dependencies in your code if any.
The `directory` argument is the root directory of your project (where the `package.json` file is). It will be the current directory when not specified.
### Options
All the arguments are optional:
`--no-dev` : by default `depcheck` looks at `dependencies` and `devDependencies`, this flag will tell it not to look at "devDependencies".
`--json` : output results to JSON
`--dev=[true|false]`: A flag indicates if depcheck looks at `devDependencies`. By default, it is `true`. It means, depcheck looks at both `dependencies` and `devDependencies`.
Or, as a lib:
```javascript
var path = require("path");
var depcheck = require("depcheck");
`--ignore-bin-package=[true|false]`: A flag indicates if depcheck ignores the packages containing bin entry. The default value is `true`.
`--json`: Output results to JSON. When not specified, depcheck outputs in human friendly format.
`--ignores`: A comma separated array containing package names to ignore. It can be glob expressions. Example, `--ignores=eslint,babel`.
`--ignores-dirs`: A comma separated array containing directory names to ignore. Example, `--ignore-dirs=dist,coverage`.
`--help`: Show the help message.
`--parsers`, `--detectors` and `--specials`: These arguments are for advanced usage. They provide an easy way to customize the file parser and dependency detection. Check [the pluggable design document](https://github.com/depcheck/depcheck/blob/master/doc/pluggable-design.md) for more information.
## API
Want to call depcheck from code? See the example:
```js
var path = require('path');
var depcheck = require('depcheck');
var options = {
"withoutDev": false, // Check against devDependencies too
"ignoreDirs": [ // Pathnames to ignore
"sandbox",
"dist",
"bower_components"
withoutDev: false, // check against devDependencies
ignoreBinPackage: false, // ignore the packages with bin entry
ignoreDirs: [ // folder with these names will be ignored
'sandbox',
'dist',
'bower_components'
],
"ignoreMatches": [ // Ignore dependencies that match these minimatch patterns
"grunt-*"
ignoreMatches: [ // ignore dependencies that matches these globs
'grunt-*'
],
parsers: { // the target parsers
'*.js': depcheck.parser.es6,
'*.jsx': depcheck.parser.jsx
},
detectors: [ // the target detectors
depcheck.detector.requireCallExpression,
depcheck.detector.importDeclaration
],
specials: [ // the target special parsers
depcheck.special.eslint,
depcheck.special.webpack
]
};
var root = path.resolve("some path");
depcheck(root, options, function(unused) {
console.log(unused.dependencies);
console.log(unused.devDependencies);
console.log(unused.invalidFiles); // JS files that couldn't be parsed
depcheck('/path/to/your/project', options, function(unused) {
console.log(unused.dependencies); // an array containing the unused dependencies
console.log(unused.devDependencies); // an array containing the unused devDependencies
console.log(unused.invalidFiles); // files that cannot access or parse
console.log(unused.invalidDirs); // directories that cannot access
});
```
## TODOs
Well, it's more of a "What do you think guys?".
There are a couple of things I would like to do if anyone is interested:
- There could be false positives, we could have a white list of modules that
you know you are using and that `depcheck` can't find in your code
## License
[MIT](http://rumpl.mit-license.org)
MIT License.

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc