Repository navigation
chore: replace lint, format, and git hook tooling - #44
yowainwright wants to merge 1 commit into
Conversation
Replaces ESLint and Prettier with plain project Oxlint/Oxfmt configurations while keeping Chomp. Removes Husky and commitlint and replaces them with scripts/install-hooks.sh plus a small commit-message validator. The installer generates executable hooks in Git's hooks directory, preserves existing hooks, skips CI, and does not change custom hooks paths. Removes obsolete Chomp tasks. Validation: build, typecheck, lint, formatting, shell checks, 49 unit tests and 1 end-to-end test pass. Tests cover hook generation, dispatch, commit validation, preservation and CI behavior.
git hook tooling
guybedford
left a comment
There was a problem hiding this comment.
Nice follow-on, thanks! Moving to Oxlint / Oxfmt is a great simplification, the lockfile shrinks a lot, and the build + runtime matrix split in CI is a neat way to test the compiled output against production deps only. Good to see the dead chomp tasks cleaned up too.
Ran it locally on Node 26 - lint, format check, typecheck and all 49 unit + 1 e2e tests pass.
Just a few small things inline to keep parity with the previous hook setup.
| if (!messagePath) throw new Error("Provide a commit-message file path."); | ||
|
|
||
| const header = readFileSync(messagePath, "utf8").split(/\r?\n/, 1)[0]; | ||
| const format = /^(feat|fix|docs|style|refactor|perf|test|build|ci|chore|revert|breaking)(\([^)]+\))?!?: \S.*$/; |
There was a problem hiding this comment.
commitlint ignored a few message shapes by default that this regex now rejects - version commits from npm version (0.2.3, which we have in the history), Revert "...", and fixup! / squash!. Could we allow those through alongside the Merge case?
| hooks_dir=$(git rev-parse --git-path hooks) | ||
| if has_custom_hooks_path; then | ||
| printf 'core.hooksPath is already configured; leaving it unchanged.\n' >&2 | ||
| exit 1 |
There was a problem hiding this comment.
Anyone who previously ran husky install will have core.hooksPath=.husky set locally, so will hit this exit until they run git config --unset core.hooksPath. Worth a one-line note in the readme for the migration.
| #!/bin/sh | ||
| set -eu | ||
| main() { | ||
| PATH="$PWD/.bin:$PATH" |
There was a problem hiding this comment.
What is .bin here? I don't see anything in the repo creating it (this looks related to the .gitignore entry in #43).
| write_hook() { | ||
| hook_name=${1:?Missing hook name} | ||
| hook_path="$hooks_dir/$hook_name" | ||
| if hook_exists; then |
There was a problem hiding this comment.
Optional: since existing hooks are always kept, later changes to the hook bodies here won't reach anyone who has already installed. Committing the hooks to a hooks/ directory and pointing core.hooksPath at it would avoid that and the generator, but fine as-is too.
Proposed Changes