Skip to content

Make the commit hook check format and lint for the changed files only - #428

Merged
captaincole merged 1 commit into
mainfrom
hook-staged-lint
Nov 28, 2026
Merged

captaincole merged 1 commit into
mainfrom
hook-staged-lint

Conversation

@captaincole

Copy link
Copy Markdown
Owner

In order to make a commit take about 2 minutes, the commit hook now checks format and lint for the staged files only, not for every file in the repository.

  • Risk: routine. GitHub still runs format and lint over the whole repository for each pull request.
  • Pattern change: format and lint of every file on each commit → of the staged files on each commit.

What changed

  • scripts/hook-lint.mjs runs Prettier (verify only) and eslint on the staged .ts, .tsx, .mjs and .js files.
  • npm run format:check and npm run lint still cover the whole repository, and the all gates check runs both.

Example outcome

Measured on a busy machine (load average about 35):

Step of the hook Before Now
Format check 80 s about 1 s
Lint 220 s about 6 s
Whole hook 6 min 29 s 2 min 2 s

Verified

  • The new hook ran on this commit and passed.
  • Lint and format on six changed engine files: 6 s and 1 s.
  • Not run locally: the whole-repository lint; the all gates check runs it.

Refs

🤖 Generated with Claude Code

Co-Authored-By: Claude <noreply@anthropic.com>
@captaincole
captaincole merged commit e2d1410 into main Nov 28, 2026
11 checks passed
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