Skip to content

feat: add optional pre-commit hooks#36

Merged
mroderick merged 1 commit into
mainfrom
feature/commit-hooks
Jun 21, 2026
Merged

feat: add optional pre-commit hooks#36
mroderick merged 1 commit into
mainfrom
feature/commit-hooks

Conversation

@mroderick

@mroderick mroderick commented Jun 21, 2026

Copy link
Copy Markdown
Collaborator

My agent doesn't always remember the instructions in AGENTS.md, but it will respect a commit hook. I made it optional, as not everyone want to use it.


What

Adds optional Git pre-commit hooks using husky and lint-staged to run Prettier and ESLint on staged files automatically.

Why

To prevent unformatted or unlinted code from reaching CI. Addressing the repeated pattern of CI catching formatting issues that should have been caught locally.

How to enable

npm run hooks:install

This installs the hooks from .husky/. To skip them for a single commit:

git commit --no-verify

What changed

  • Added husky and lint-staged as dev dependencies
  • Added .husky/pre-commit running npx lint-staged
  • Configured lint-staged in package.json for **/*.{js,css,md,yml}
  • Added hooks:install npm script
  • Updated AGENTS.md with setup and skip instructions

@mroderick mroderick force-pushed the feature/commit-hooks branch from f43c2e6 to 89937f0 Compare June 21, 2026 12:05
@mroderick mroderick marked this pull request as ready for review June 21, 2026 12:15
@mroderick mroderick requested a review from till June 21, 2026 12:15
till
till previously approved these changes Jun 21, 2026
Install husky and lint-staged as dev dependencies.
Configure lint-staged to run prettier and eslint on staged files.
Add hooks:install script to enable hooks manually.
Update AGENTS.md with instructions for enabling and skipping hooks.
@mroderick mroderick force-pushed the feature/commit-hooks branch from b01cdd6 to 7c2daa9 Compare June 21, 2026 12:53
@mroderick mroderick requested a review from till June 21, 2026 12:56
@mroderick mroderick merged commit 38a96a0 into main Jun 21, 2026
6 checks passed
@mroderick mroderick deleted the feature/commit-hooks branch June 21, 2026 16:58
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.

2 participants