-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy path.pre-commit-config.yaml
More file actions
197 lines (174 loc) · 4.82 KB
/
.pre-commit-config.yaml
File metadata and controls
197 lines (174 loc) · 4.82 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
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
# Prek configuration - https://prek.j178.dev/
# Minimum prek version required
minimum_prek_version: "0.2.23"
# Default settings for all repos
default_language_version:
python: python3.11
node: "22.0.0"
default_stages: [pre-commit, pre-push]
# Global file filters
files: ""
exclude: |
(?x)^(
# Dependencies
.*/node_modules/.*|
.*/__pycache__/.*|
.*/\.venv/.*|
.*/.cache/.*|
# Generated files
.*/migrations/versions/.*|
apps/next/api/.*|
# Assets (generated/external)
.*\.(svg|png|jpg|jpeg|gif|ico|woff|woff2|ttf|eot)$|
.*/public/.*\.svg|
# Data & logs
data/.*|
.*\.log|
# Lock files
bun\.lock|
pnpm-lock\.yaml|
uv\.lock
)$
repos:
# ===============================
# Built-in fast hooks (zero setup, no network)
# ===============================
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v5.0.0
hooks:
- id: trailing-whitespace
name: ✂️ Trim trailing whitespace
args: ["--markdown-linebreak-ext=md,markdown"]
priority: 0
- id: end-of-file-fixer
name: 🔚 Fix EOF
priority: 0
- id: check-yaml
name: 🔍 Check YAML
args: ["--allow-multiple-documents"]
exclude: |
(?x)^(
docker-compose\.yml|
docker-compose\.yaml
)$
priority: 0
- id: check-json
name: 🔍 Check JSON
exclude: |
(?x)^(
# VSCode settings use JSONC (JSON with Comments)
\.vscode/.*\.json
)$
priority: 0
- id: check-toml
name: 🔍 Check TOML
priority: 0
- id: check-added-large-files
name: 🚫 Check large files
args: ["--maxkb=1000"]
priority: 0
- id: check-merge-conflict
name: 🔍 Check merge conflicts
priority: 0
- id: detect-private-key
name: 🔐 Detect private keys
priority: 0
- id: check-case-conflict
name: 🔍 Check case conflicts
priority: 0
- id: mixed-line-ending
name: 🔍 Check line endings
args: ["--fix=lf"]
priority: 0
# ===============================
# Python - Backend (apps/server)
# ===============================
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.13.0
hooks:
- id: ruff
name: 🐍 Ruff lint
args: ["--fix"]
files: ^apps/server/
priority: 10
- id: ruff-format
name: 🐍 Ruff format
files: ^apps/server/
priority: 10
# Type checking with ty (used in Makefile)
- repo: local
hooks:
- id: ty-check
name: 🔍 Type check (ty)
entry: uv run ty check
language: system
files: ^apps/server/.*\.py$
pass_filenames: false
always_run: true
priority: 20
# ===============================
# JavaScript/TypeScript - Frontend
# ===============================
- repo: local
hooks:
- id: eslint-next
name: 🔍 ESLint (Next.js)
entry: bash -c 'cd apps/next && bun run lint:fix'
language: system
files: ^apps/next/.*\.(ts|tsx|js|jsx|mjs)$
pass_filenames: false
priority: 10
- id: eslint-vue
name: 🔍 ESLint (Vue)
entry: bash -c 'cd apps/vue && bun run lint:fix'
language: system
files: ^apps/vue/.*\.(ts|vue)$
pass_filenames: false
priority: 10
# ===============================
# Docker & Infrastructure
# ===============================
- repo: https://github.com/hadolint/hadolint
rev: v2.14.0
hooks:
- id: hadolint-docker
name: 🐳 Lint Dockerfiles
files: ^apps/.*/Dockerfile.*
args: ["--ignore", "DL3008"] # Allow unpinned apt packages
priority: 10
# ===============================
# Tests
# ===============================
- repo: local
hooks:
- id: pytest
name: 🧪 Run tests
entry: uv run pytest -s -v apps/server/tests/ --cov
language: system
files: ^apps/server/.*\.py$
pass_filenames: false
stages: [pre-push]
priority: 30
# ===============================
# Documentation
# ===============================
- repo: https://github.com/pre-commit/pygrep-hooks
rev: v1.10.0
hooks:
- id: python-check-blanket-noqa
name: 🔍 Check blanket noqa
files: ^apps/server/
priority: 0
- id: python-check-blanket-type-ignore
name: 🔍 Check blanket type:ignore
files: ^apps/server/
priority: 0
# CI mode: fail fast on first error
ci:
autofix_commit_msg: "ci: auto fixes from pre-commit hooks"
autofix_prs: true
autoupdate_branch: ""
autoupdate_commit_msg: "ci: pre-commit autoupdate"
autoupdate_schedule: weekly
skip: []
submodules: false