-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathlefthook.yml
More file actions
80 lines (67 loc) · 1.57 KB
/
lefthook.yml
File metadata and controls
80 lines (67 loc) · 1.57 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
# Lefthook configuration
# https://github.com/evilmartians/lefthook
# ANSI color codes
colors: true
# Skip checks for CI environment
skip_in_ci: true
# Git hooks configuration
pre-commit:
parallel: true
commands:
# Format code
format:
tags: format code style
glob: "*.{js,ts,tsx,json}"
run: pnpm format
# Lint TypeScript/JavaScript
lint:
tags: lint style
glob: "*.{js,ts,tsx}"
run: pnpm lint
# Type check
typecheck:
tags: typescript types
glob: "*.{ts,tsx}"
run: pnpm type-check
# Check for secrets
secrets:
tags: security
run: |
# Simple secret detection patterns
git diff --cached --name-only -z | xargs -0 grep -E "(api[_-]?key|secret|token|password|pwd|auth)" || true
# Validate JSON files
json-validate:
tags: validation
glob: "*.json"
run: |
for file in {files}; do
if ! jq empty "$file" 2>/dev/null; then
echo "Invalid JSON in $file"
exit 1
fi
done
commit-msg:
commands:
# Enforce conventional commits
conventional:
run: .lefthook/commit-msg/conventional-commit.sh {1}
pre-push:
commands:
# Run tests before push
test:
run: pnpm test
# Build check
build:
run: pnpm build
# Skip certain commands in specific cases
skip:
- merge: merge
- rebase: merge
# Define additional scripts
scripts:
"pre-commit.sh": |
#!/bin/bash
echo "Running pre-commit checks..."
"pre-push.sh": |
#!/bin/bash
echo "Running pre-push checks..."