Skip to content

Commit afdfe35

Browse files
committed
prek.toml を整備し check-merge-conflict と detect-private-key を追加する
1 parent 8ca0e24 commit afdfe35

1 file changed

Lines changed: 34 additions & 5 deletions

File tree

prek.toml

Lines changed: 34 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,19 +4,48 @@
44

55
default_stages = ["pre-commit"]
66

7+
# prek 組み込みフック (オフラインで動作する Rust ネイティブ実装)
78
[[repos]]
89
repo = "builtin"
910
hooks = [
1011
{ id = "trailing-whitespace" },
1112
{ id = "end-of-file-fixer" },
1213
{ id = "check-yaml" },
1314
{ id = "check-toml" },
15+
# マージコンフリクトマーカーが残ったコミットを防ぐ
16+
{ id = "check-merge-conflict" },
17+
# 秘密鍵の誤コミットを防ぐ
18+
{ id = "detect-private-key" },
1419
]
1520

21+
# プロジェクト固有のローカルフック
22+
# priority が小さいほど先に実行される。同じ priority なら並列実行される
1623
[[repos]]
1724
repo = "local"
18-
hooks = [
19-
{ id = "check", name = "vp check", entry = "vp check", language = "system", pass_filenames = false, priority = 0 },
20-
{ id = "typecheck", name = "tsc --noEmit", entry = "pnpm exec tsc --noEmit", language = "system", pass_filenames = false, priority = 10 },
21-
{ id = "test", name = "vp test", entry = "vp test run", language = "system", pass_filenames = false, priority = 20 },
22-
]
25+
26+
# vp check: フォーマット (oxfmt) と lint (oxlint type-aware) をまとめて実行
27+
[[repos.hooks]]
28+
id = "check"
29+
name = "vp check"
30+
entry = "vp check"
31+
language = "system"
32+
pass_filenames = false
33+
priority = 0
34+
35+
# tsc --noEmit: TypeScript の型チェック
36+
[[repos.hooks]]
37+
id = "typecheck"
38+
name = "tsc --noEmit"
39+
entry = "pnpm exec tsc --noEmit"
40+
language = "system"
41+
pass_filenames = false
42+
priority = 10
43+
44+
# vp test run: vitest によるユニットテスト
45+
[[repos.hooks]]
46+
id = "test"
47+
name = "vp test"
48+
entry = "vp test run"
49+
language = "system"
50+
pass_filenames = false
51+
priority = 20

0 commit comments

Comments
 (0)