chore: replace husky with lefthook#776
Open
shottah wants to merge 3 commits into
Open
Conversation
Switch the git hook manager from husky to lefthook to fix the two-commit-required workflow described in celo-org#691. Husky's pre-commit ran `yarn fmt --staged`, which formatted files in the working tree but did not re-add them to the git index, so contributors had to make a second commit to include the formatting fixes. Lefthook's `stage_fixed: true` option re-stages files that hooks modify, so a single commit now lands the formatted output. Per the Biome git-hooks recipe, the pre-commit also upgrades from `format --write` to `check --write`, which runs lint + format in one pass over staged files. The pre-push hook is preserved verbatim (prereleasecheck.sh). Closes celo-org#691
|
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #776 +/- ##
=======================================
Coverage 68.34% 68.34%
=======================================
Files 152 152
Lines 8824 8824
Branches 1663 1685 +22
=======================================
Hits 6031 6031
Misses 2721 2721
Partials 72 72
🚀 New features to boost your workflow:
|
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.
Closes #691.
Replaces husky with lefthook so pre-commit formatting fixes are auto-restaged (
stage_fixed: true) and onegit commitis enough. Follows Biome's git hooks recipe.Changes
package.json: swaphuskyforlefthook, pointpostinstallatlefthook install.lefthook.yml: pre-commit runsbiome check --writeon staged files +prereleasecheck.sh; pre-push keepsprereleasecheck.sh..husky/removed.No changeset (dev tooling only).
Test plan
PR-Codex overview
This PR focuses on replacing
huskywithlefthookfor managing Git hooks and updating the corresponding configurations in the project.Detailed summary
.husky/pre-pushand.husky/pre-commit.lefthook.ymlwithpre-commitandpre-pushconfigurations.postinstallscript inpackage.jsonfromhusky installtolefthook install.package.jsonto includelefthookdependency.huskyentries fromyarn.lockand addedlefthookentries.