ci: enforce oxlint/oxfmt in CI and a lefthook pre-commit hook#21
Merged
Conversation
|
🚀 Preview deployed: https://preview-21.tablo.run |
Run `bun run lint` (oxlint) and `bun run fmt:check` (oxfmt) right after install in both the production deploy and PR preview workflows, so lint and formatting violations fail fast before typecheck/test/build. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_014DWovxbG4A7Ebda7xhG9nA
Manage git hooks with Lefthook (dev dependency) instead of a hand-rolled core.hooksPath script. lefthook.yml declares a pre-commit hook that runs oxlint and oxfmt --check in parallel, mirroring the CI static checks. Lefthook installs the hooks via `lefthook install` from the `prepare` script on `bun install` (guarded so a non-git context can't break it); bypass a run with `git commit --no-verify`. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_014DWovxbG4A7Ebda7xhG9nA
7691e05 to
a9c47b5
Compare
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.
Follow-up to #20: actually enforce the linter and formatter, in CI and locally.
What
1. CI gates (
ci: enforce lint and formatting checks)bun run lint(oxlint) andbun run fmt:check(oxfmt) right afterbun installin both workflows —deploy.yml(production) andpr-preview.yml(PRs).typecheck/test/buildso the cheap static checks fail fast.2. Pre-commit hook via Lefthook (
build: add pre-commit hook via lefthook)lefthook.ymldeclares apre-commithook that runsoxlintandoxfmt --checkin parallel, mirroring the CI static checks. Bypass a run withgit commit --no-verify.lefthook install, run from the existingpreparescript onbun install(guarded with|| trueso a non-git install context can't breakprepare).Verification
lint,fmt:check,typecheck,test(79),build:web,verify:pwaall green;bun install --frozen-lockfilein sync.Note
After pulling this, contributors get the hook automatically on their next
bun install(viaprepare) — no manual setup. To enable immediately without reinstalling:bunx lefthook install.🤖 Generated with Claude Code
https://claude.ai/code/session_014DWovxbG4A7Ebda7xhG9nA