-
Notifications
You must be signed in to change notification settings - Fork 138
/
lefthook.yml
45 lines (44 loc) · 1.68 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
41
42
43
44
45
# https://github.com/Arkweid/lefthook/blob/master/docs/full_guide.md
pre-commit:
commands:
formatphp:
glob: '*.php'
run: ./vendor/bin/phpcbf {staged_files}
lintphp:
glob: '*.php'
run: ./vendor/bin/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
lintmarkdown:
glob: '*.{md}'
run: npx markdownlint-cli {staged_files} --fix
other:
glob: '*.{yml,json,html}'
exclude: 'group_*.json,CHANGELOG.md' # Exclude specific files, including CHANGELOG.md
run: |
staged_files="$LEFTHOOK_STAGED_FILES"
for file in $staged_files
do
if [[ ! "$file" =~ ^templates/ && "$file" != "package-lock.json" && "$file" != "composer.lock" ]]; 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"