Skip to content

chore: replace husky with lefthook#776

Open
shottah wants to merge 1 commit into
celo-org:masterfrom
shottah:chore/replace-husky-with-lefthook
Open

chore: replace husky with lefthook#776
shottah wants to merge 1 commit into
celo-org:masterfrom
shottah:chore/replace-husky-with-lefthook

Conversation

@shottah
Copy link
Copy Markdown

@shottah shottah commented May 18, 2026

Closes #691.

Replaces husky with lefthook so pre-commit formatting fixes are auto-restaged (stage_fixed: true) and one git commit is enough. Follows Biome's git hooks recipe.

Changes

  • package.json: swap husky for lefthook, point postinstall at lefthook install.
  • lefthook.yml: pre-commit runs biome check --write on staged files + prereleasecheck.sh; pre-push keeps prereleasecheck.sh.
  • .husky/ removed.

No changeset (dev tooling only).

Test plan

  • Staging an unformatted TS file, running the hook, then diffing index vs. working tree: clean — fix lands in one commit.
  • CI green.

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
@shottah shottah requested a review from a team as a code owner May 18, 2026 18:48
@changeset-bot
Copy link
Copy Markdown

changeset-bot Bot commented May 18, 2026

⚠️ No Changeset found

Latest commit: 677fc28

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

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.

Replace Husky with Lefthook

1 participant