Skip to content

Latest commit

 

History

History
48 lines (32 loc) · 999 Bytes

File metadata and controls

48 lines (32 loc) · 999 Bytes

dep-check

Find dead imports in your project. Catches imports that reference files that don't exist.

$ dep-check

Dead imports:
  src/components/Header.tsx -> ./OldButton
  src/utils/api.ts -> ./deprecated/client

2 dead imports found.

Install

curl -fsSL https://raw.githubusercontent.com/buildingopen/dep-check/main/dep-check -o ~/.local/bin/dep-check
chmod +x ~/.local/bin/dep-check

Usage

dep-check          # check all source files
dep-check --json   # JSON output

How it works

  1. git ls-files to find all tracked source files
  2. grep to extract relative imports (./ and ../)
  3. Check if each import target exists on disk (with common extensions: .ts, .tsx, .js, .jsx, .py, .go, .rs, /index.*)

Limitations

  • Only checks relative imports (./ and ../), not package imports
  • TypeScript/JavaScript, Python only (for now)
  • Does not resolve tsconfig path aliases

Requirements

  • git
  • jq (only for --json)

License

MIT