Dead-Code Analysis for JavaScript & TypeScript
Devoid is a fast static analyzer that detects:
- Unused exports
- Unused local identifiers (functions, variables, classes, types)
- Unused files
- Incorrect or unreachable re-exports
- Usage propagation through wildcards and barrel modules
- Import resolution via TS path aliases, directory imports, and relative paths
Devoid is powered the TypeScript Compiler API directly at runtime — no other dependencies.
npm install -g devoid
# or
pnpm add -g devoid
# or
yarn global add devoidnpm install -D devoid
# or
pnpm add -D devoid
# or
yarn add -D devoiddevoid src/devoid src/ --exports
devoid src/ --files
devoid src/ --locals
devoid src/ --jsonList exports that are never imported or referenced:
devoid src/ --exportsList files that are unreachable from the entrypoints and have no side effects:
devoid src/ --filesDetect unused classes, enums, functions, and variables within files:
devoid src/ --locals
# or
devoid src/ --identifiersEnable strict mode to include type declarations:
devoid src/ --locals --track-all-localsDetect unused exported types and local type declarations:
devoid src/ --typesTypes mode:
- Tracks type and interface usage only
- Respects import type and export type
- Follows barrel and wildcard type re-exports
- Does not require the TypeScript type checker
- Does not affect runtime export analysis
devoid src/ --jsondevoid src/ --summary-onlyPrint raw graphs for debugging:
devoid src/ --verboseAnalyze unused identifiers within a single file only:
devoid internal src/utils/helpers.tsEnable strict local tracking:
devoid internal src/utils/helpers.ts --track-all-localsIgnore files or directories containing a substring:
devoid src/ --ignore dist --ignore generateddevoid src/ --no-color
devoid src/ --colorMIT © Elijah Kotyluk