Skip to content

Commit 4569fd5

Browse files
authored
Merge pull request #492 from Ojoxux/cursor/migrate-to-lefthook-10aa
chore: lint-stagedとhuskyをlefthookに移行
2 parents b09ceb4 + f330871 commit 4569fd5

7 files changed

Lines changed: 250 additions & 470 deletions

File tree

.cursor/rules/01-sonory-app-requirements.mdc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,5 +41,5 @@ alwaysApply: true
4141
- OpenNext + Cloudflare Workers で `npm run deploy` 配備
4242

4343
9. **コード品質**
44-
- Biome + Husky + lint-staged で pre-commit
44+
- oxlint/oxfmt + Lefthook で pre-commit
4545
- GitHub Actions で CI(`biome ci .`, `tsc --noEmit`)

.cursor/rules/02-sonory-strict-rules.mdc

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -117,10 +117,9 @@ alwaysApply: true
117117
- CI用: `npm run ci` (`biome ci .`)
118118
- **型チェック**: `npm run lint:typecheck` (`tsc --noEmit`)
119119
- **Git フック**
120-
- Husky を `prepare` スクリプトで初期化
121-
- lint-staged で以下をコミット前に実行
122-
- `biome check --apply`
123-
- `biome format --write`
120+
- Lefthook を `prepare` スクリプトで初期化(`lefthook install`)
121+
- `lefthook.yml` で pre-commit 時に以下を実行(変更パッケージのみ)
122+
- `oxlint --fix` / `oxfmt`
124123
- `tsc --noEmit`
125124
- **CI(GitHub Actions)**
126125
1. `npm ci`

.husky/pre-commit

Lines changed: 0 additions & 65 deletions
This file was deleted.

lefthook.yml

Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
# Sonory monorepo pre-commit hooks (replaces husky + lint-staged)
2+
# https://lefthook.dev/configuration/
3+
4+
pre-commit:
5+
parallel: true
6+
jobs:
7+
# apps/web
8+
- name: web lint:fix
9+
glob: "apps/web/**/*.{js,jsx,ts,tsx}"
10+
run: npm --prefix apps/web run lint:fix
11+
stage_fixed: true
12+
- name: web format:fix
13+
glob: "apps/web/**/*.{js,jsx,ts,tsx}"
14+
run: npm --prefix apps/web run format:fix
15+
stage_fixed: true
16+
- name: web type-check
17+
glob: "apps/web/**/*.{js,jsx,ts,tsx}"
18+
run: npm --prefix apps/web exec -- tsc --noEmit --project apps/web/tsconfig.json
19+
20+
# apps/api
21+
- name: api lint:fix
22+
glob: "apps/api/**/*.{js,jsx,ts,tsx}"
23+
run: npm --prefix apps/api run lint:fix
24+
stage_fixed: true
25+
- name: api format:fix
26+
glob: "apps/api/**/*.{js,jsx,ts,tsx}"
27+
run: npm --prefix apps/api run format:fix
28+
stage_fixed: true
29+
- name: api type-check
30+
glob: "apps/api/**/*.{js,jsx,ts,tsx}"
31+
run: npm --prefix apps/api exec -- tsc --noEmit --project apps/api/tsconfig.json
32+
33+
# packages/shared-types
34+
- name: shared-types lint:fix
35+
glob: "packages/shared-types/**/*.{js,jsx,ts,tsx}"
36+
run: npm --prefix packages/shared-types run lint:fix
37+
stage_fixed: true
38+
- name: shared-types format:fix
39+
glob: "packages/shared-types/**/*.{js,jsx,ts,tsx}"
40+
run: npm --prefix packages/shared-types run format:fix
41+
stage_fixed: true
42+
- name: shared-types type-check
43+
glob: "packages/shared-types/**/*.{js,jsx,ts,tsx}"
44+
run: npm --prefix packages/shared-types exec -- tsc --noEmit --project packages/shared-types/tsconfig.json
45+
46+
# packages/utils
47+
- name: utils lint:fix
48+
glob: "packages/utils/**/*.{js,jsx,ts,tsx}"
49+
run: npm --prefix packages/utils run lint:fix
50+
stage_fixed: true
51+
- name: utils format:fix
52+
glob: "packages/utils/**/*.{js,jsx,ts,tsx}"
53+
run: npm --prefix packages/utils run format:fix
54+
stage_fixed: true
55+
- name: utils type-check
56+
glob: "packages/utils/**/*.{js,jsx,ts,tsx}"
57+
run: npm --prefix packages/utils exec -- tsc --noEmit --project packages/utils/tsconfig.json
58+
59+
# packages/python-types
60+
- name: python-types lint:fix
61+
glob: "packages/python-types/**/*.{js,jsx,ts,tsx}"
62+
run: npm --prefix packages/python-types run lint:fix
63+
stage_fixed: true
64+
- name: python-types format:fix
65+
glob: "packages/python-types/**/*.{js,jsx,ts,tsx}"
66+
run: npm --prefix packages/python-types run format:fix
67+
stage_fixed: true
68+
- name: python-types type-check
69+
glob: "packages/python-types/**/*.{js,jsx,ts,tsx}"
70+
run: npm --prefix packages/python-types exec -- tsc --noEmit --project packages/python-types/tsconfig.json
71+
72+
# packages/config (root-level oxlint/oxfmt)
73+
- name: config lint:fix
74+
glob: "packages/config/**/*.{js,jsx,ts,tsx}"
75+
run: oxlint packages/config --fix
76+
stage_fixed: true
77+
- name: config format:fix
78+
glob: "packages/config/**/*.{js,jsx,ts,tsx}"
79+
run: oxfmt packages/config --no-error-on-unmatched-pattern
80+
stage_fixed: true

lint-staged.config.mjs

Lines changed: 0 additions & 30 deletions
This file was deleted.

0 commit comments

Comments
 (0)