PR Cleanup
Find and remove dead code introduced (or left behind) by the current branch.
Steps
- •Get the branch diff:
bash
git diff origin/main...HEAD --stat git diff origin/main...HEAD
- •
Identify candidates — scan the diff for:
- •Old functions/exports that were replaced by new ones (e.g.
queryFooreplaced byqueryFooPaginated) - •Planning artifacts (e.g.
*_PLAN.md, scratch files) that were used during development
- •Old functions/exports that were replaced by new ones (e.g.
- •
Verify each candidate is truly unused — for every function/export/file identified, search the codebase for remaining callers:
bash
# Search for callers outside the definition file
rg "functionName" --glob "**/*.{ts,tsx}"
If the only hit is the definition itself, it's dead code.
- •
Remove dead code:
- •Delete unused function/export bodies
- •Remove orphaned imports that were only needed by the deleted code
- •Delete planning or scratch files
- •
Run checks:
bash
npx tsc --noEmit && bun run lint && bun run format
Fix any errors introduced by the removals before finishing.