pkg-doctor
Find Unused Dependencies in your JavaScript/TypeScript projects
Basic Commands:
Install globally, once:
$ npm install -g pkg-doctor
Install in project:
$ npm install -D pkg-doctor
Run:
$ pkg-doctor
Flags:
--include-all:
$ pkg-doctor --include-all
Some dependencies are not considered as unused by default such as tailwindcss, postcss, vitest, webpack etc because they are not usually imported in source files. To bypass this check use --include-all flag
--include-types:
$ pkg-doctor --include-types
Types packages are excluded by default. To bypass this check use --include-types flag
Strict Check:
$ pkg-doctor --include-types --include-all
Using --include-types and --include-all together will bypass all checks and give you the most possible raw output