Format and auto-fix staged files before they become a commit - #635
Merged
Conversation
The pre-push gate checks formatting and lint over the whole tree, so a file that reaches a commit unformatted only surfaces once the push is already running - where the fix has to be amended into an existing commit. lint-staged runs prettier --write and eslint --fix on the staged paths instead, which is about 5 s against 56 s for the repo-wide lint, and leaves the push gate with nothing to report. SKIP_LINT_STAGED=1 opts out for a commit that is not about content.
Exoridus
enabled auto-merge (squash)
August 28, 2026 06:23
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
Bundle ReportChanges will decrease total bundle size by 17.31MB (-36.41%) ⬇️. This is within the configured threshold ✅ Detailed changes
Affected Assets, Files, and Routes:view changes for bundle: site-server-esmAssets Changed:
App Routes Affected:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The pre-push gate runs
format:checkandlint:allover the whole tree, so a file that reaches a commit unformatted only surfaces once the push is already running - at which point the fix has to be amended into a commit that exists. That happened on the previous branch and cost a rewrite of two commits.lint-stagedruns the writers on the staged paths instead, from the existingpre-commithook (below the default-branch guard):prettier --writeon every text format the repository formats;eslint --fix --no-warn-ignored --max-warnings=0on TypeScript undersrc,test,examples,scriptsandpackages.SKIP_LINT_STAGED=1opts out for a commit that is not about content (a rebase or merge resolution).Cost
Measured on this machine, not assumed:
pnpm lint(repository-wide, ~1500 files)eslinton 2 staged filesprettier --writeon 2 filesThe 4 s are almost entirely the type-aware program build (
projectService: true), which a single file pays too - what disappears is the scaling with file count, which is whyeslint --fixis in rather than left out.Verified
eslint --fix.no-explicit-any) fails the task and blocks the commit.