No unused dependencies in package.json
Why it matters
Unused production dependencies add bundle weight, extend install time, and expand your attack surface — every extra package is a potential supply chain compromise vector. CWE-1357 (Reliance on Insufficiently Trustworthy Component) applies: dependencies you didn't intend to ship still ship. AI-generated codebases accumulate unused packages frequently: the model installs axios and moment in one session, then the next session uses native fetch and inline date formatting without removing the earlier additions.
Severity rationale
Medium because unused dependencies bloat the bundle and attack surface without delivering functionality, but they do not immediately break application behavior.
Remediation
Run a dependency check to find unused packages:
npx depcheck
Verify each reported unused package before removing — some packages are loaded via config rather than imports (ESLint plugins, Babel presets). For confirmed unused packages:
npm uninstall axios moment lodash
Also audit whether production dependencies have been misplaced as devDependencies or vice versa. For deeper supply chain analysis, the Dependency & Supply Chain Audit covers version pinning, lockfile integrity, and provenance checks.
DetectionPro
The detection method for this pattern is part of AuditBuffet Pro.
The full method (what to look for, pass and fail conditions, and how results get reported) ships inside the Code Maintainability Audit. The pattern definition, severity rationale, and remediation remain openly licensed under CC-BY-4.0.
External references
- iso-25010:2011 · maintainability.analysability — Analysability
- cwe · CWE-1357 — Reliance on Insufficiently Trustworthy Component
Taxons
History
- 2026-04-18·v1.0.0·Initial import from code-maintainability·automated