No dead code — unused exports, components, and functions
Why it matters
Dead code — unused components, unexported utility modules, unreachable API routes — imposes a cognitive tax on every developer who reads the codebase. Is this file used? Was it intentionally removed? Should I modify it or ignore it? ISO 25010 maintainability.analysability degrades as dead code accumulates. It also creates false positives in security reviews: an unused API route with no authentication looks like a security gap even if nothing calls it. AI-generated codebases accumulate dead code across sessions as earlier implementations get replaced without cleanup.
Severity rationale
Medium because substantial dead code increases cognitive overhead and misleads security reviews, but does not break runtime behavior until a dead module is incorrectly believed to be unreachable and then unexpectedly invoked.
Remediation
Find unused exports and modules automatically:
npx ts-prune # finds unused TypeScript exports
# or
npx knip # comprehensive dead code detection
Before deleting, confirm with git log that code wasn't recently added and is genuinely unreachable. Prevent accumulation with:
"no-unused-vars": ["warn", { "vars": "all", "args": "after-used" }]
Delete confirmed dead code and commit with a descriptive message — git history preserves it if recovery is ever needed.
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
- iso-25010:2011 · maintainability.modularity — Modularity
Taxons
History
- 2026-04-18·v1.0.0·Initial import from code-maintainability·automated