-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathlefthook.yml
More file actions
102 lines (94 loc) · 3.34 KB
/
lefthook.yml
File metadata and controls
102 lines (94 loc) · 3.34 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
# ** が0階層以上にマッチするようにする(デフォルトは1階層以上)
glob_matcher: doublestar
output:
- execution_out
pre-commit:
parallel: true
jobs:
# Formatter(ts/vue 以外。ts/vue は各 linter ジョブで oxfmt を実行)
- name: oxfmt
glob: "**/*.{css,scss,md}"
run: pnpm exec oxfmt {staged_files}
stage_fixed: true
# Linter + Formatter
- name: oxlint-root
glob: "*.ts"
exclude:
- "apps/**"
- "packages/**"
run: pnpm exec oxlint --type-aware --fix {staged_files} && pnpm exec oxfmt {staged_files}
stage_fixed: true
# packages/core: fix: oxlint + oxfmt → knip
- name: core
root: "packages/core/"
glob: "**/*.ts"
group:
piped: true
jobs:
- name: oxlint
run: pnpm exec oxlint --type-aware --fix {staged_files} && pnpm exec oxfmt {staged_files}
stage_fixed: true
- name: knip
run: pnpm -w run knip -W packages/core --fix
# packages/hololive: fix: oxlint + oxfmt → knip
- name: hololive
root: "packages/hololive/"
glob: "**/*.ts"
group:
piped: true
jobs:
- name: oxlint
run: pnpm exec oxlint --type-aware --fix {staged_files} && pnpm exec oxfmt {staged_files}
stage_fixed: true
- name: knip
run: pnpm -w run knip -W packages/hololive --fix
# packages/nijisanji: fix: oxlint + oxfmt → knip
- name: nijisanji
root: "packages/nijisanji/"
glob: "**/*.ts"
group:
piped: true
jobs:
- name: oxlint
run: pnpm exec oxlint --type-aware --fix {staged_files} && pnpm exec oxfmt {staged_files}
stage_fixed: true
- name: knip
run: pnpm -w run knip -W packages/nijisanji --fix
# apps/web: fix: oxlint + eslint + oxfmt → knip(fix 完了後の状態で解析するため piped で直列実行)
- name: web
root: apps/web/
glob: "**/*.{ts,vue,css,scss,md}"
group:
piped: true
jobs:
- name: oxlint
glob: "**/*.ts"
run: pnpm exec oxlint --type-aware --fix {staged_files}
stage_fixed: true
- name: eslint
glob: "**/*.vue"
run: pnpm exec eslint --cache --fix -c eslint.config.fix.ts {staged_files}
stage_fixed: true
- name: oxfmt
run: pnpm exec oxfmt {staged_files}
stage_fixed: true
- name: knip
glob: "**/*.{ts,vue}"
run: pnpm -w run knip -W apps/web --fix
# git pull / merge 後に lockfile の変更を検出し、pnpm install を促す
post-merge:
jobs:
- name: check-lockfile
run: |
if git diff --name-only ORIG_HEAD HEAD | grep -q "pnpm-lock.yaml"; then
printf '\033[33m⚠️ pnpm-lock.yaml has changed. Run pnpm install to update dependencies.\033[0m\n'
fi
# ブランチ切り替え後に lockfile の変更を検出し、pnpm install を促す
# {3}=1: branch checkout, {3}=0: file checkout
post-checkout:
jobs:
- name: check-lockfile
run: |
if [ "{3}" = "1" ] && git diff --name-only {1} {2} | grep -q "pnpm-lock.yaml"; then
printf '\033[33m⚠️ pnpm-lock.yaml has changed. Run pnpm install to update dependencies.\033[0m\n'
fi