-
Notifications
You must be signed in to change notification settings - Fork 4
/
lefthook.yml
40 lines (40 loc) · 1.42 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
39
40
pre-commit:
commands:
formatphp:
glob: '*.php'
run: composer run-script phpcs-fix {staged_files}
lintphp:
glob: '*.php'
run: composer run-script phpcs {staged_files}
formatstyles:
glob: '*.{css,scss}'
run: npx prettier {staged_files} --write
lintstyles:
glob: '*.{css,scss}'
run: npx stylelint {staged_files} --fix
formatjavascript:
glob: '*.{js,ts,tsx}'
run: npx prettier {staged_files} --write
lintjavascript:
glob: '*.{js,ts,tsx}'
run: npx eslint {staged_files} --fix
other:
glob: '*.{yml,json,html}'
exclude: 'group_*.json' # Exclude specific files
run: |
staged_files="$LEFTHOOK_STAGED_FILES"
for file in $staged_files
do
if [[ ! "$file" =~ ^templates/ ]]; then
npx prettier "$file" --write
fi
done
stage_fixed: true
stage: pre-commit
merge-conflict:
run: echo "Resolve merge conflicts before committing"
exit-status:
run: echo "All pre-commit checks passed"
templates-exclude:
glob: 'templates/**' # Match all files and subdirectories within templates folder
run: echo "Skipping templates folder"