-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathlefthook.yml
38 lines (35 loc) · 1.59 KB
/
lefthook.yml
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
# Lefthook Git Hooks Configuration
# Defines automated checks and tasks for different Git operations
# Runs before pushing changes to remote
pre-push:
commands:
biome:
name: 🛡️ Guarding Against Bad Code # Descriptive name for the check
# Files to check (JavaScript, TypeScript, JSON, etc.)
glob: "*.{js,ts,cjs,mjs,d.cts,d.mts,jsx,tsx,json,jsonc}"
# Run Biome check on pushed files
# --no-errors-on-unmatched: Don't error on unmatched files
# --files-ignore-unknown: Skip unknown file types
# --colors=off: Disable color output
run: bunx @biomejs/biome check --no-errors-on-unmatched --files-ignore-unknown=true --colors=off {push_files}
# Runs before committing changes
pre-commit:
commands:
biome:
name: 🧹 Making Sure Everything is Formatted & Linted # Descriptive name
# Files to check and format
glob: "*.{js,ts,cjs,mjs,d.cts,d.mts,jsx,tsx,json,jsonc}"
# Run Biome check and auto-fix on staged files
# --write: Fix issues automatically
# --no-errors-on-unmatched: Don't error on unmatched files
# --files-ignore-unknown: Skip unknown file types
# --colors=off: Disable color output
run: bunx @biomejs/biome check --write --no-errors-on-unmatched --files-ignore-unknown=true --colors=off {staged_files}
stage_fixed: true # Stage files that were auto-fixed
# Runs when committing to validate commit message
commit-msg:
commands:
"lint commit message":
# Validate commit message format using commitlint
# {1} refers to the commit message file
run: bunx commitlint --edit {1}