-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathlefthook.yml
More file actions
35 lines (30 loc) · 1.12 KB
/
lefthook.yml
File metadata and controls
35 lines (30 loc) · 1.12 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
post-merge:
scripts:
prepare.sh:
runner: bash
pre-push:
scripts:
check.sh:
runner: bash
pre-commit:
commands:
cleanup:
glob: '**/*.{cjs,css,cts,htm,html,java,js,json,json5,jsonc,jsx,md,mjs,mts,scss,ts,tsx,vue,yaml,yml}'
run: |-
eslint_files="$(printf '%s\n' {staged_files} | grep -E '(\.cjs$|\.cts$|\.js$|\.jsx$|\.mjs$|\.mts$|\.ts$|\.tsx$)' || true)"
package_json_files="$(printf '%s\n' {staged_files} | grep -E '(^|/)package\.json$' || true)"
node node_modules/.bin/prettier --cache --write --ignore-unknown -- {staged_files}
if [ -n "$eslint_files" ]; then
node node_modules/.bin/eslint --color --fix -- $eslint_files
fi
if [ -n "$package_json_files" ]; then
node node_modules/.bin/sort-package-json -- $package_json_files
fi
git add -- {staged_files}
check-migrations:
glob: '**/migration.sql'
run: |-
if grep -q 'Warnings:' {staged_files}; then
echo "Migration SQL files ({staged_files}) contain warnings! Please solve the warnings and commit again."
exit 1
fi