From cef3a8de8ffbe551799dd5a4eb206ee11ec25852 Mon Sep 17 00:00:00 2001 From: "dayuan.jiang" Date: Mon, 5 Jan 2026 01:11:34 +0900 Subject: [PATCH] chore: add type check and unit test git hooks --- .github/CONTRIBUTING.md | 13 +++++++++---- .husky/pre-commit | 1 + .husky/pre-push | 4 ++++ 3 files changed, 14 insertions(+), 4 deletions(-) create mode 100644 .husky/pre-push diff --git a/.github/CONTRIBUTING.md b/.github/CONTRIBUTING.md index d13a6ff..edcb118 100644 --- a/.github/CONTRIBUTING.md +++ b/.github/CONTRIBUTING.md @@ -20,7 +20,9 @@ npm run lint # Check lint errors npm run check # Run all checks (CI) ``` -Pre-commit hooks via Husky will run Biome automatically on staged files. +Git hooks via Husky run automatically: +- **Pre-commit**: Biome (format/lint) + TypeScript type check +- **Pre-push**: Unit tests For a better experience, install the [Biome VS Code extension](https://marketplace.visualstudio.com/items?itemName=biomejs.biome) for real-time linting and format-on-save. @@ -48,9 +50,12 @@ npx playwright test --ui ## Pull Requests 1. Create a feature branch -2. Make changes and ensure `npm run check` passes -3. Run tests with `npm run test && npm run test:e2e` -4. Submit PR against `main` with a clear description +2. Make changes (pre-commit runs lint + type check automatically) +3. Run E2E tests with `npm run test:e2e` +4. Push (pre-push runs unit tests automatically) +5. Submit PR against `main` with a clear description + +CI will run the full test suite on your PR. ## Issues diff --git a/.husky/pre-commit b/.husky/pre-commit index 2312dc5..ef9088d 100644 --- a/.husky/pre-commit +++ b/.husky/pre-commit @@ -1 +1,2 @@ npx lint-staged +npx tsc --noEmit diff --git a/.husky/pre-push b/.husky/pre-push new file mode 100644 index 0000000..2674c5f --- /dev/null +++ b/.husky/pre-push @@ -0,0 +1,4 @@ +# Skip if node_modules not installed (e.g., on EC2 push server) +if [ -d "node_modules" ]; then + npm run test -- --run +fi