Skip to content

chore: scope pre-commit formatting to staged files#46

Open
tallyhuhu wants to merge 2 commits intoPolymarket:mainfrom
tallyhuhu:chore/scope-precommit-to-staged-files
Open

chore: scope pre-commit formatting to staged files#46
tallyhuhu wants to merge 2 commits intoPolymarket:mainfrom
tallyhuhu:chore/scope-precommit-to-staged-files

Conversation

@tallyhuhu
Copy link
Copy Markdown

@tallyhuhu tallyhuhu commented Apr 20, 2026

Summary

Scope the pre-commit Biome run to staged source and test files only.

Motivation

The previous hook ran Biome with --write across the full src and tests trees on every commit. This could rewrite unrelated files outside the staged change, leaving noisy working-tree modifications after a focused commit.

Changes

  • collect staged files with git diff --cached --name-only --diff-filter=ACMR
  • filter to JS/TS files under src/ and tests/
  • skip the hook when no matching files are staged
  • run pnpm exec biome check --write only on matching staged files
  • re-add formatted files before the commit continues

Safety

This only changes local commit tooling. Runtime client behavior and public APIs are unchanged.

Testing

  • committed this hook-only change and verified the hook exits without formatting the full repository
  • verified no unrelated files were modified after commit

Note

Low Risk
Only affects local developer tooling and the commit path; no runtime or production code changes, with limited risk of friction from the new partially-staged-file guard.

Overview
Updates the Husky pre-commit hook to run Biome formatting only on staged JS/TS files under src/ and tests/, and to no-op when no matching files are staged.

The hook now blocks commits with partially staged matching files (to avoid formatting divergence), then runs pnpm exec biome check --write on the staged file list and re-stages any formatting changes.

Reviewed by Cursor Bugbot for commit 2eb3ad6. Bugbot is set up for automated code reviews on this repo. Configure here.

@tallyhuhu tallyhuhu requested a review from a team as a code owner April 20, 2026 07:27
Copy link
Copy Markdown

@cursor cursor Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 2 potential issues.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit 9ed1cad. Configure here.

Comment thread .husky/pre-commit
Comment thread .husky/pre-commit
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant