chore: add husky pre-commit hook and CI lint workflow

- Add husky with biome check --staged --write pre-commit hook
- Add GitHub Actions lint workflow (biome ci on PR/push to main)
- Update CONTRIBUTING.md with pre-commit and CI documentation

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
delibae 2026-03-16 17:15:58 +09:00
parent 95c4072ec1
commit 16b4c469b5
5 changed files with 51 additions and 4 deletions

24
.github/workflows/lint.yml vendored Normal file
View file

@ -0,0 +1,24 @@
name: Lint
on:
pull_request:
branches: [main]
push:
branches: [main]
jobs:
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: pnpm/action-setup@v4
- uses: actions/setup-node@v4
with:
node-version: 22
cache: pnpm
- run: pnpm install --frozen-lockfile
- name: Biome CI
run: pnpm exec biome ci

1
.husky/pre-commit Normal file
View file

@ -0,0 +1 @@
pnpm exec biome check --staged --write --no-errors-on-unmatched

View file

@ -136,15 +136,25 @@ pnpm lint:fix # auto-fix
Rust code follows standard `rustfmt` conventions.
### Pre-commit Hook
A [Husky](https://typicode.github.io/husky/) pre-commit hook runs automatically on every commit. It checks and auto-fixes staged files via `biome check --staged --write`, so lint issues are caught before they reach the repository.
The hook is set up automatically when you run `pnpm install`.
### CI
A GitHub Actions workflow runs `biome ci` on every pull request and push to `main`. PRs that fail lint checks cannot be merged.
## Pull Request Process
1. Fork the repository
2. Create a feature branch (`git checkout -b feat/my-feature`)
3. Make your changes
4. Run tests: `pnpm test` (frontend) and `cargo test` (Rust)
5. Run `pnpm lint` to ensure code quality
6. Commit with a descriptive message
7. Push to your fork and open a PR
5. Commit — the pre-commit hook will auto-fix lint issues on staged files
6. Push to your fork and open a PR
7. CI will verify lint and tests pass
### Commit Convention

View file

@ -17,10 +17,12 @@
"build:desktop": "pnpm --filter=@claude-prism/desktop tauri build",
"lint": "pnpm exec biome check",
"lint:fix": "pnpm exec biome check --fix",
"release": "echo 'To release: git tag v<version> && git push origin v<version>'"
"release": "echo 'To release: git tag v<version> && git push origin v<version>'",
"prepare": "husky"
},
"devDependencies": {
"@biomejs/biome": "^2.3.13",
"husky": "^9.1.7",
"turbo": "^2.7.6"
},
"packageManager": "pnpm@10.28.2",

10
pnpm-lock.yaml generated
View file

@ -18,6 +18,9 @@ importers:
'@biomejs/biome':
specifier: ^2.3.13
version: 2.3.13
husky:
specifier: ^9.1.7
version: 9.1.7
turbo:
specifier: ^2.7.6
version: 2.7.6
@ -4538,6 +4541,11 @@ packages:
humanize-ms@1.2.1:
resolution: {integrity: sha512-Fl70vYtsAFb/C06PTS9dZBo7ihau+Tu/DNCk/OyHhea07S+aeMWpFFkUaXRa8fI+ScZbEI8dfSxwY7gxZ9SAVQ==}
husky@9.1.7:
resolution: {integrity: sha512-5gs5ytaNjBrh5Ow3zrvdUUY+0VxIuWVL4i9irt6friV+BqdCfmV11CQTWMiBYWHbXhco+J1kHfTOUkePhCDvMA==}
engines: {node: '>=18'}
hasBin: true
iconv-lite@0.6.3:
resolution: {integrity: sha512-4fCk79wshMdzMp2rH06qWrJE4iolqLhCUH+OiuIgU++RB0+94NlDL81atO7GX55uUKueo0txHNtvEyI6D7WdMw==}
engines: {node: '>=0.10.0'}
@ -11524,6 +11532,8 @@ snapshots:
dependencies:
ms: 2.1.3
husky@9.1.7: {}
iconv-lite@0.6.3:
dependencies:
safer-buffer: 2.1.2