{"id":13447125,"url":"https://github.com/depcheck/depcheck","last_synced_at":"2025-05-13T15:02:57.586Z","repository":{"id":10722244,"uuid":"12973222","full_name":"depcheck/depcheck","owner":"depcheck","description":"Check your npm module for unused dependencies","archived":false,"fork":false,"pushed_at":"2025-02-27T08:33:16.000Z","size":2026,"stargazers_count":4884,"open_issues_count":117,"forks_count":223,"subscribers_count":22,"default_branch":"main","last_synced_at":"2025-05-05T22:19:36.970Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/depcheck.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null},"funding":{"github":["rumpl"],"open_collective":"depcheck"}},"created_at":"2013-09-20T12:47:55.000Z","updated_at":"2025-05-05T02:05:20.000Z","dependencies_parsed_at":"2024-02-23T22:42:02.212Z","dependency_job_id":"0b29e4db-0d15-446a-bb6f-afe8d13221bc","html_url":"https://github.com/depcheck/depcheck","commit_stats":{"total_commits":884,"total_committers":118,"mean_commits":7.491525423728813,"dds":0.5271493212669683,"last_synced_commit":"e03dbd0b615269efd17155e105c0018d64bbb2a4"},"previous_names":[],"tags_count":55,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/depcheck%2Fdepcheck","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/depcheck%2Fdepcheck/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/depcheck%2Fdepcheck/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/depcheck%2Fdepcheck/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/depcheck","download_url":"https://codeload.github.com/depcheck/depcheck/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253593638,"owners_count":21933050,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-07-31T05:01:08.883Z","updated_at":"2025-05-13T15:02:57.562Z","avatar_url":"https://github.com/depcheck.png","language":"JavaScript","readme":"# depcheck\n\n\u003e [!NOTE]  \n\u003e Depcheck is no longer actively maintained\n\nWhile it has been widely used to identify unused dependencies in JavaScript and TypeScript projects, its lack of updates means it may not work well with modern tooling and frameworks.\nWe strongly recommend switching to knip, a more actively maintained and feature-rich alternative. Knip provides better support for TypeScript, monorepos, and modern build tools, making it a more reliable choice for keeping your project dependencies clean.\nCheck out [knip.dev](https://knip.dev)\n\nDepcheck is a tool for analyzing the dependencies in a project to see: how each dependency is used, which dependencies are useless, and which dependencies are missing from `package.json`.\n\n## Status\n\n[![Build Status](https://github.com/depcheck/depcheck/workflows/ci/badge.svg)](https://github.com/depcheck/depcheck/actions)\n[![Financial Contributors on Open Collective](https://opencollective.com/depcheck/all/badge.svg?label=financial+contributors)](https://opencollective.com/depcheck) [![Build status](https://ci.appveyor.com/api/projects/status/xbooh370dinuyi0y/branch/master?svg=true)](https://ci.appveyor.com/project/lijunle/depcheck/branch/master)\n[![codecov.io](https://codecov.io/github/depcheck/depcheck/coverage.svg?branch=master)](https://codecov.io/github/depcheck/depcheck?branch=master)\n\n[![Dependencies](https://img.shields.io/librariesio/github/depcheck/depcheck)](https://libraries.io/github/depcheck/depcheck)\n\n## Installation\n\n```\nnpm install -g depcheck\n```\n\nOr simply using [npx](https://blog.npmjs.org/post/162869356040/introducing-npx-an-npm-package-runner) which is a package runner bundled in `npm`:\n\n```\n$ npx depcheck\n```\n\n_Notice:_ depcheck needs node.js \u003e= 10.\n\n## Syntax Support\n\nDepcheck not only recognizes the dependencies in JavaScript files, but also supports these syntaxes:\n\n- JavaScript (ES5, ES6 and ES7)\n- [React JSX](http://facebook.github.io/react/docs/jsx-in-depth.html)\n- [CoffeeScript](http://coffeescript.org/)\n- [TypeScript](http://www.typescriptlang.org/) (with `typescript` dependency)\n- [SASS and SCSS](http://sass-lang.com/)\n- [Vue.js](https://vuejs.org/) (with `@vue/compiler-sfc` dependency)\n\nTo get the syntax support by external dependency, please install the corresponding package explicitly. For example, for TypeScript user, install depcheck with `typescript` package:\n\n```\nnpm install -g depcheck typescript\n```\n\n## Special\n\nThe _special_ component is used to recognize the dependencies that are not generally used in the above syntax files. The following scenarios are supported by specials:\n\n- `babel` - [Babel](https://www.npmjs.com/package/babel) presets and plugins\n- `bin` - Dependencies used in npm commands, Travis scripts or other CI scripts\n- `commitizen` - [Commitizen](https://www.npmjs.com/package/commitizen) configuration adaptor\n- `eslint` - [ESLint](https://www.npmjs.com/package/eslint) configuration presets, parsers and plugins\n- `feross-standard` - [Feross standard](https://www.npmjs.com/package/standard) format parser\n- `gatsby` - [Gatsby](https://www.npmjs.com/package/gatsby) configuration parser\n- `gulp-load-plugins` - [Gulp-load-plugins](https://www.npmjs.com/package/gulp-load-plugins) lazy loaded plugins\n- `husky` - [Husky](https://www.npmjs.com/package/husky) configuration parser\n- `istanbul` - [Istanbul nyc](https://www.npmjs.com/package/nyc) configuration extensions\n- `jest` - [Jest](https://www.npmjs.com/package/jest) properties in [Jest Configuration](https://jestjs.io/docs/en/configuration)\n- `karma` - [Karma](https://www.npmjs.com/package/karma) configuration frameworks, browsers, preprocessors and reporters\n- `lint-staged` - [Lint-staged](https://www.npmjs.com/package/lint-staged) configuration parser\n- `mocha` - [Mocha](https://www.npmjs.com/package/mocha) explicit required dependencies\n- `prettier` - [Prettier](https://www.npmjs.com/package/prettier) configuration module\n- `tslint` - [TSLint](https://www.npmjs.com/package/tslint) configuration presets, parsers and plugins\n- `ttypescript` - [ttypescript](https://github.com/cevek/ttypescript) transformers\n- `webpack` - [Webpack](https://www.npmjs.com/package/webpack) loaders\n- `serverless`- [Serverless](https://www.npmjs.com/package/serverless) plugins\n\nThe logic of a special is not perfect. There might be [false alerts](#false-alert). If this happens, please open an issue for us.\n\n## Usage\n\n```\ndepcheck [directory] [arguments]\n```\n\nThe `directory` argument is the root directory of your project (where the `package.json` file is). If unspecified, defaults to current directory.\n\nAll of the arguments are optional:\n\n`--ignore-bin-package=[true|false]`: A flag to indicate if depcheck ignores the packages containing bin entry. The default value is `false`.\n\n`--skip-missing=[true|false]`: A flag to indicate if depcheck skips calculation of missing dependencies. The default value is `false`.\n\n`--json`: Output results in JSON. When not specified, depcheck outputs in human friendly format.\n\n`--oneline`: Output results as space separated string. Useful for copy/paste.\n\n`--ignores`: A comma separated array containing package names to ignore. It can be glob expressions. Example, `--ignores=\"eslint,babel-*\"`.\n\n`--ignore-dirs`: DEPRECATED, use ignore-patterns instead. A comma separated array containing directory names to ignore. Example, `--ignore-dirs=dist,coverage`.\n\n`--ignore-path`: Path to a file with patterns describing files to ignore. Files must match the .gitignore [spec](http://git-scm.com/docs/gitignore). Example, `--ignore-path=.eslintignore`.\n\n`--ignore-patterns`: Comma separated patterns describing files to ignore. Patterns must match the .gitignore [spec](http://git-scm.com/docs/gitignore). Example, `--ignore-patterns=build/Release,dist,coverage,*.log`.\n\n`--quiet`: Suppress the \"No depcheck issue\" log. Useful in a monorepo with multiple packages to focus only on packages with issues.\n\n`--help`: Show the help message.\n\n`--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.\n\n`--config=[filename]`: An external configuration file (see below).\n\n## Usage with a configuration file\n\nDepcheck can be used with an rc configuration file. In order to do so, create a .depcheckrc file in your project's package.json folder, and set the CLI keys in YAML, JSON, and JavaScript formats.\nFor example, the CLI arguments `--ignores=\"eslint,babel-*\" --skip-missing=true` would turn into:\n\n**_.depcheckrc_**\n\n```\nignores: [\"eslint\", \"babel-*\"]\nskip-missing: true\n```\n\n**Important:** if provided CLI arguments conflict with configuration file ones, the CLI ones will take precedence over the rc file ones.\n\nThe rc configuration file can also contain the following extensions: `.json`, `.yaml`, `.yml`.\n\n## API\n\nSimilar options are provided to `depcheck` function for programming:\n\n```js\nimport depcheck from 'depcheck';\n\nconst options = {\n  ignoreBinPackage: false, // ignore the packages with bin entry\n  skipMissing: false, // skip calculation of missing dependencies\n  ignorePatterns: [\n    // files matching these patterns will be ignored\n    'sandbox',\n    'dist',\n    'bower_components',\n  ],\n  ignoreMatches: [\n    // ignore dependencies that matches these globs\n    'grunt-*',\n  ],\n  parsers: {\n    // the target parsers\n    '**/*.js': depcheck.parser.es6,\n    '**/*.jsx': depcheck.parser.jsx,\n  },\n  detectors: [\n    // the target detectors\n    depcheck.detector.requireCallExpression,\n    depcheck.detector.importDeclaration,\n  ],\n  specials: [\n    // the target special parsers\n    depcheck.special.eslint,\n    depcheck.special.webpack,\n  ],\n  package: {\n    // may specify dependencies instead of parsing package.json\n    dependencies: {\n      lodash: '^4.17.15',\n    },\n    devDependencies: {\n      eslint: '^6.6.0',\n    },\n    peerDependencies: {},\n    optionalDependencies: {},\n  },\n};\n\ndepcheck('/path/to/your/project', options).then((unused) =\u003e {\n  console.log(unused.dependencies); // an array containing the unused dependencies\n  console.log(unused.devDependencies); // an array containing the unused devDependencies\n  console.log(unused.missing); // a lookup containing the dependencies missing in `package.json` and where they are used\n  console.log(unused.using); // a lookup indicating each dependency is used by which files\n  console.log(unused.invalidFiles); // files that cannot access or parse\n  console.log(unused.invalidDirs); // directories that cannot access\n});\n```\n\n## Example\n\nThe following example checks the dependencies under `/path/to/my/project` folder:\n\n```sh\n$\u003e depcheck /path/to/my/project\nUnused dependencies\n* underscore\nUnused devDependencies\n* jasmine\nMissing dependencies\n* lodash\n```\n\nIt figures out:\n\n- The dependency `underscore` is declared in the `package.json` file, but not used by any code.\n- The devDependency `jasmine` is declared in the `package.json` file, but not used by any code.\n- The dependency `lodash` is used somewhere in the code, but not declared in the `package.json` file.\n\nPlease note that, if a subfolder has a `package.json` file, it is considered another project and should be checked with another depcheck command.\n\nThe following example checks the same project, however, outputs as a JSON blob. Depcheck's JSON output is in one single line for easy pipe and computation. The [`json`](https://www.npmjs.com/package/json) command after the pipe is a node.js program to beautify the output.\n\n```js\n$\u003e depcheck /path/to/my/project --json | json\n{\n  \"dependencies\": [\n    \"underscore\"\n  ],\n  \"devDependencies\": [\n    \"jasmine\"\n  ],\n  \"missing\": {\n    \"lodash\": [\n      \"/path/to/my/project/file.using.lodash.js\"\n    ]\n  },\n  \"using\": {\n    \"react\": [\n      \"/path/to/my/project/file.using.react.jsx\",\n      \"/path/to/my/project/another.file.using.react.jsx\"\n    ],\n    \"lodash\": [\n      \"/path/to/my/project/file.using.lodash.js\"\n    ]\n  },\n  \"invalidFiles\": {\n    \"/path/to/my/project/file.having.syntax.error.js\": \"SyntaxError: \u003ccall stack here\u003e\"\n  },\n  \"invalidDirs\": {\n    \"/path/to/my/project/folder/without/permission\": \"Error: EACCES, \u003ccall stack here\u003e\"\n  }\n}\n```\n\n- The `dependencies`, `devDependencies` and `missing` properties have the same meanings in the previous example.\n- The `using` property is a lookup indicating each dependency is used by which files.\n- The value of `missing` and `using` lookup is an array. It means the dependency may be used by many files.\n- The `invalidFiles` property contains the files having syntax error or permission error. The value is the error details. However, only one error is stored in the lookup.\n- The `invalidDirs` property contains the directories having permission error. The value is the error details.\n\n## False Alert\n\nDepcheck just walks through all files and tries to find the dependencies according to some predefined rules. However, the predefined rules may not be enough or may even be wrong.\n\nThere may be some cases in which a dependency is being used but is reported as unused, or a dependency is not used but is reported as missing. These are _false alert_ situations.\n\nIf you find that depcheck is reporting a false alert, please [open an issue](https://github.com/depcheck/depcheck/issues/new) with the following information to let us know:\n\n- The output from `depcheck --json` command. Beautified JSON is better.\n- Which dependencies are considered as false alert?\n- How are you using those dependencies, what do the files look like?\n\n## Changelog\n\nWe use the [GitHub release page](https://github.com/depcheck/depcheck/releases) to manage changelog.\n\n## Contributors\n\n### Code Contributors\n\nThis project exists thanks to all the people who contribute. [[Contribute](CONTRIBUTING.md)].\n\u003ca href=\"https://github.com/depcheck/depcheck/graphs/contributors\"\u003e\u003cimg src=\"https://opencollective.com/depcheck/contributors.svg?width=890\u0026button=false\" /\u003e\u003c/a\u003e\n\n### Financial Contributors\n\nBecome a financial contributor and help us sustain our community. [[Contribute](https://opencollective.com/depcheck/contribute)]\n\n#### Individuals\n\n\u003ca href=\"https://opencollective.com/depcheck\"\u003e\u003cimg src=\"https://opencollective.com/depcheck/individuals.svg?width=890\"\u003e\u003c/a\u003e\n\n#### Organizations\n\nSupport this project with your organization. Your logo will show up here with a link to your website. [[Contribute](https://opencollective.com/depcheck/contribute)]\n\n\u003ca href=\"https://opencollective.com/depcheck/organization/0/website\"\u003e\u003cimg src=\"https://opencollective.com/depcheck/organization/0/avatar.svg\"\u003e\u003c/a\u003e\n\u003ca href=\"https://opencollective.com/depcheck/organization/1/website\"\u003e\u003cimg src=\"https://opencollective.com/depcheck/organization/1/avatar.svg\"\u003e\u003c/a\u003e\n\u003ca href=\"https://opencollective.com/depcheck/organization/2/website\"\u003e\u003cimg src=\"https://opencollective.com/depcheck/organization/2/avatar.svg\"\u003e\u003c/a\u003e\n\u003ca href=\"https://opencollective.com/depcheck/organization/3/website\"\u003e\u003cimg src=\"https://opencollective.com/depcheck/organization/3/avatar.svg\"\u003e\u003c/a\u003e\n\u003ca href=\"https://opencollective.com/depcheck/organization/4/website\"\u003e\u003cimg src=\"https://opencollective.com/depcheck/organization/4/avatar.svg\"\u003e\u003c/a\u003e\n\u003ca href=\"https://opencollective.com/depcheck/organization/5/website\"\u003e\u003cimg src=\"https://opencollective.com/depcheck/organization/5/avatar.svg\"\u003e\u003c/a\u003e\n\u003ca href=\"https://opencollective.com/depcheck/organization/6/website\"\u003e\u003cimg src=\"https://opencollective.com/depcheck/organization/6/avatar.svg\"\u003e\u003c/a\u003e\n\u003ca href=\"https://opencollective.com/depcheck/organization/7/website\"\u003e\u003cimg src=\"https://opencollective.com/depcheck/organization/7/avatar.svg\"\u003e\u003c/a\u003e\n\u003ca href=\"https://opencollective.com/depcheck/organization/8/website\"\u003e\u003cimg src=\"https://opencollective.com/depcheck/organization/8/avatar.svg\"\u003e\u003c/a\u003e\n\u003ca href=\"https://opencollective.com/depcheck/organization/9/website\"\u003e\u003cimg src=\"https://opencollective.com/depcheck/organization/9/avatar.svg\"\u003e\u003c/a\u003e\n\n## License\n\nMIT License.\n","funding_links":["https://github.com/sponsors/rumpl","https://opencollective.com/depcheck","https://opencollective.com/depcheck/contribute","https://opencollective.com/depcheck/organization/0/website","https://opencollective.com/depcheck/organization/1/website","https://opencollective.com/depcheck/organization/2/website","https://opencollective.com/depcheck/organization/3/website","https://opencollective.com/depcheck/organization/4/website","https://opencollective.com/depcheck/organization/5/website","https://opencollective.com/depcheck/organization/6/website","https://opencollective.com/depcheck/organization/7/website","https://opencollective.com/depcheck/organization/8/website","https://opencollective.com/depcheck/organization/9/website"],"categories":["JavaScript","Dependencies checker","Repository","Code review","others","Uncategorized","Packages"],"sub_categories":["NPM","Dependencies","Uncategorized"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdepcheck%2Fdepcheck","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdepcheck%2Fdepcheck","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdepcheck%2Fdepcheck/lists"}