UNPKG

unused-exports-check

Version:

Generic scanner to detect unused TypeScript exports (API + CLI)

45 lines (34 loc) 960 B
# unused-exports-check Generic, repo-agnostic scanner to detect unused TypeScript exports. Provides both an API and a CLI. ## Install ```bash npm i -D unused-exports-check ``` ## CLI ```bash npx unused-exports-check \ --root . \ --glob 'src/**/*.ts' 'src/**/*.tsx' \ --ignore '**/generated/**' '**/*.stories.tsx' \ --fail ``` - Writes a timestamped report to `reports/` by default. - Use `--report path.txt` to customize output. ## API ```ts import { scan, assertNone } from 'unused-exports-check'; const unused = await scan({ root: process.cwd(), globs: ['src/**/*.ts','src/**/*.tsx'], ignore: ['**/generated/**', '**/*.stories.tsx'] }); assertNone(unused); // throws if any unused exports ``` ## Per-file disable pragma Add this comment anywhere in a file to skip checking it entirely: ```ts // unused-exports-check: disable ``` ## Notes - Uses tsconfig baseUrl/paths when present. - Ignores node_modules, dist, and .d.ts by default.