devoid
v0.4.0
Published
A modern dead-code analysis and usage graph engine for JavaScript/TypeScript.
Downloads
228
Maintainers
Readme
Devoid
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.
Installation
Global
npm install -g devoid
# or
pnpm add -g devoid
# or
yarn global add devoidProject
npm install -D devoid
# or
pnpm add -D devoid
# or
yarn add -D devoidCLI Usage
devoid src/Common Flags
devoid src/ --exports
devoid src/ --files
devoid src/ --locals
devoid src/ --jsonAnalysis Modes
Unused Exports
List exports that are never imported or referenced:
devoid src/ --exportsUnused Files
List files that are unreachable from the entrypoints and have no side effects:
devoid src/ --filesUnused Local Identifiers
Detect 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-localsTypes
Detect 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
Output Options
JSON
devoid src/ --jsonSummary
devoid src/ --summary-onlyVerbose
Print raw graphs for debugging:
devoid src/ --verboseInternal (Single-File) Analysis
Analyze unused identifiers within a single file only:
devoid internal src/utils/helpers.tsEnable strict local tracking:
devoid internal src/utils/helpers.ts --track-all-localsMisc Options
Ignore Paths
Ignore files or directories containing a substring:
devoid src/ --ignore dist --ignore generatedColor Control
devoid src/ --no-color
devoid src/ --colorLicense
MIT © Elijah Kotyluk
