deplint

raw JSON →
1.1.3 verified Fri May 01 auth: no javascript maintenance

DepLint (v1.1.3) is a lightweight CLI tool that checks that all require/import statements in your JavaScript/TypeScript code are listed as dependencies in package.json. It scans declared file patterns and verifies that every module referenced exists in the project's dependency tree. Unlike similar tools (e.g., dependency-check, eslint-plugin-import), it is unopinionated about module resolution and focuses solely on dependency declaration completeness. It requires a custom 'deplint' key in package.json to configure file patterns and top-level module directories. Release cadence is low; last release was 2019. No known alternatives with identical configuration style.

error Error: Module 'xxx' is not listed in package.json dependencies
cause An import or require references a module not present in package.json dependencies (or devDependencies, if configured).
fix
Add the module to package.json dependencies or devDependencies.
error TypeError: Cannot read property 'files' of undefined
cause The 'deplint' key in package.json is missing or has no 'files' property.
fix
Add a 'deplint' key to package.json with a 'files' array.
gotcha The 'modules' field is required and must be an array of directories that are top-level sub-components.
fix Set 'modules' to an array containing the root of your source (e.g., ["src"]), even if you have no sub-components.
gotcha depLint only checks that imported modules exist as dependencies; it does not validate semver ranges or unused dependencies.
fix Use complementary tools like 'npm-check' or 'depcheck' for unused or mismatched versions.
gotcha Glob patterns in 'files' are not recursive by default; '**' must be used for deep scans.
fix Use 'src/**/*.js' instead of 'src/*.js' to scan nested folders.
deprecated No new releases since 2019; the tool is considered feature-stable.
fix Evaluate if you need a more actively maintained alternative.
npm install deplint
yarn add deplint
pnpm add deplint

Shows how to configure deplint in package.json with scanned files and modules, then run it to catch missing dependencies.

// package.json
{
  "name": "my-project",
  "scripts": {
    "lint:deplint": "deplint"
  },
  "deplint": {
    "files": ["src/**/*.js"],
    "modules": ["src/"]
  },
  "dependencies": {
    "lodash": "^4.17.21"
  }
}

// src/index.js
const _ = require('lodash'); // OK
const foo = require('nonexistent'); // flagged by deplint