Repository navigation
Expand file tree
/
Copy path.pre-commit-config.yaml
More file actions
69 lines (64 loc) · 2.38 KB
/
Copy path.pre-commit-config.yaml
File metadata and controls
69 lines (64 loc) · 2.38 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
# Withe pre-commit — a shift-left gate that mirrors CI, so the local check and CI
# never drift. Every local hook shells out to the same `npm run` scripts CI runs.
#
# commit stage : hygiene + type-check + adapter-boundary lint + changeset lint
# push stage : the full unit-test suite
#
# One-time setup per checkout (the framework is language-agnostic; run it with
# uv, which is already on this machine):
#
# uvx pre-commit install --install-hooks
#
# Bypass a hook deliberately with SKIP=<id> or `git commit --no-verify`.
minimum_pre_commit_version: "3.2.0"
default_install_hook_types: [pre-commit, pre-push]
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v6.0.0
hooks:
# Generated or fetched files are excluded from the whitespace fixers: their
# generators (drizzle-kit, the CE spec fetch, openapi-typescript) decide
# their trailing bytes, and "fixing" them only churns on regeneration.
- id: trailing-whitespace
exclude: '^(LICENSE|drizzle/|spec/openapi-community\.yaml|src/adapters/ce/generated/)'
- id: end-of-file-fixer
exclude: '^(LICENSE|drizzle/|spec/openapi-community\.yaml|src/adapters/ce/generated/)'
- id: check-yaml
- id: check-json
# The generated CE client is emitted, not hand-written.
exclude: '^src/adapters/ce/generated/'
- id: check-toml
- id: check-merge-conflict
- id: detect-private-key
- id: mixed-line-ending
args: [--fix=lf]
- id: check-added-large-files
args: [--maxkb=1024]
- repo: local
hooks:
# Fast feedback on every commit — the same commands as ci.yml.
- id: typecheck
name: tsc --noEmit
entry: npm run typecheck
language: system
pass_filenames: false
types_or: [ts, tsx]
- id: boundaries
name: adapter boundary rules
entry: npm run lint
language: system
pass_filenames: false
types_or: [ts, tsx]
- id: changeset-lint
name: changeset fragment lint (knope one-line body)
entry: sh scripts/lint-changesets.sh
language: system
files: '^\.changeset/.+\.md$'
pass_filenames: false
# The full suite before code leaves the machine.
- id: test
name: node --test
entry: npm test
language: system
pass_filenames: false
stages: [pre-push]