Skip to content

chore: add husky pre-commit hook with lint-staged#1152

Draft
hydrosquall wants to merge 1 commit intovega:mainfrom
hydrosquall:cameron.yick/add-pre-commit-lint-hooks
Draft

chore: add husky pre-commit hook with lint-staged#1152
hydrosquall wants to merge 1 commit intovega:mainfrom
hydrosquall:cameron.yick/add-pre-commit-lint-hooks

Conversation

@hydrosquall
Copy link
Member

@hydrosquall hydrosquall commented Feb 8, 2026

Motivation

This PR adds pre-commit hooks to catch formatting issues locally before CI, reduce wasted CI minutes, and ensure consistent code style across the codebase (related to vega/vega#4237).

Changes

  • Adds husky@^9.1.7 for git hooks management
  • Adds lint-staged@^16.2.7 to run linters only on staged files
  • Configures pre-commit hook to run npx lint-staged
  • Adds "prepare": "husky" script to auto-initialize hooks on npm install
  • Configures lint-staged to run eslint --fix on *.{js,ts,mjs,cjs} files
  • Updates .gitignore to exclude .claude/ directory

Testing

  • Run npm install to verify the prepare script initializes husky
  • Make a change to a JS/TS file with a formatting issue
  • Stage and commit the change
  • Verify the pre-commit hook runs and auto-fixes the formatting issue
  • Verify CI passes

Enable formatting issues to be automatically handled locally
instead of only erroring in CI, reducing wasted CI minutes.

Related to vega/vega#4237

Co-Authored-By: Claude Sonnet 4.5 (1M context) <noreply@anthropic.com>
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.

1 participant