dependency-lint

raw JSON →
7.1.0 verified Fri May 01 auth: no javascript deprecated

Lints package.json dependencies and devDependencies by comparing declared modules against actual usage (requires, execs in scripts). Currently v7.1.0, stable with infrequent releases. Supports Node.js 12, 14, 16. Unlike depcheck, it also inspects shell scripts and npm run scripts for obvious misuse. Provides auto-correct mode and YAML configuration.

error dependency-lint: no configuration file found. Use --generate-config to create one.
cause Missing dependency-lint.yml in project root.
fix
Run npx dependency-lint --generate-config to create a default configuration.
error Could not parse /path/to/file.js: Unexpected token
cause JavaScript file contains syntax not supported by the parser (e.g., Flow, JSX without proper transformer).
fix
Ensure files are plain JavaScript/TypeScript without unsupported syntax. Ignore problematic files in configuration.
deprecated Package last updated September 2021. Node.js support limited to versions 12, 14, 16. Alternative: use `depcheck` or `eslint-plugin-import` for more modern linting.
fix Migrate to depcheck or npx check-dependencies.
breaking Version 7 requires Node 12+. Older versions may fail on unsupported Node versions.
fix Use Node 12, 14, or 16, or downgrade to v6.
npm install dependency-lint
yarn add dependency-lint
pnpm add dependency-lint

Run dependency-lint CLI to detect missing, unused, or mislabeled dependencies.

// No JavaScript API. Use CLI:
// Run `npx dependency-lint` in project root.
// Auto-correct: `npx dependency-lint --auto-correct`