-
Notifications
You must be signed in to change notification settings - Fork 3.8k
Expand file tree
/
Copy path.pre-commit-config.yaml
More file actions
41 lines (36 loc) · 1.76 KB
/
.pre-commit-config.yaml
File metadata and controls
41 lines (36 loc) · 1.76 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
default_install_hook_types: [pre-commit, post-checkout, post-merge]
repos:
- repo: local
hooks:
- id: biome-format-js
name: Biome format (JS/TS)
language: system
entry: pnpm biome format --write --no-errors-on-unmatched
files: '\.(js|jsx|ts|tsx|cjs|mjs|cts|mts)$'
pass_filenames: true
- id: eslint-fix
name: ESLint fix
language: system
entry: pnpm eslint --fix
files: '\.(js|jsx|ts|tsx|cjs|mjs|cts|mts)$'
pass_filenames: true
- id: biome-format-other
name: Biome format (JSON/YAML/CSS/HTML)
language: system
entry: pnpm biome format --write --no-errors-on-unmatched
files: '\.(json|yml|yaml|css|html)$'
pass_filenames: true
- id: post-checkout-install
name: pnpm install after checkout
language: system
entry: bash -c 'if [ "$PRE_COMMIT_FROM_REF" != "$PRE_COMMIT_TO_REF" ] && git diff --name-only "$PRE_COMMIT_FROM_REF" "$PRE_COMMIT_TO_REF" -- "**/package.json" pnpm-lock.yaml | grep -q .; then echo "Dependencies changed, running pnpm install..."; pnpm install; else echo "No dependency changes, skipping pnpm install."; fi'
stages: [post-checkout]
always_run: true
pass_filenames: false
- id: post-merge-install
name: pnpm install after merge/pull
language: system
entry: bash -c 'PREV_HEAD=$(git rev-parse --short HEAD@{1} 2>/dev/null); if [ -n "$PREV_HEAD" ] && git diff --name-only "$PREV_HEAD" HEAD -- "**/package.json" pnpm-lock.yaml | grep -q .; then echo "Dependencies changed, running pnpm install..."; pnpm install; else echo "No dependency changes, skipping pnpm install."; fi'
stages: [post-merge]
always_run: true
pass_filenames: false