forked from scalar/scalar
-
Notifications
You must be signed in to change notification settings - Fork 0
/
lefthook.yml
24 lines (23 loc) · 998 Bytes
/
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
# EXAMPLE USAGE:
#
# Refer for explanation to following link:
# https://github.com/evilmartians/lefthook/blob/master/docs/configuration.md
#
post-checkout:
commands:
conditional-pnpm-install:
# Run pnpm install if pnpm-lock changed between the commits we checked out.
# {1} is old-hash, {2} is current-head, {3} is 1 for a branch checkout, 0 for a file checkout
# See https://git-scm.com/docs/githooks#_post_checkout
run: 'if [ ! -z "$(git diff {1}..{2} --name-only pnpm-lock.yaml)" ]; then pnpm install -r; fi'
pre-commit:
commands:
package_format:
glob: 'pnpm-lock.yaml'
run: pnpm format:packages; git add \*package.json pnpm-lock.yaml; echo PACKAGE FILES FORMATTED
prettier:
glob: '*.{js,ts,jsx,tsx,vue,md,json,css,scss,html,yml,yaml}'
run: 'pnpm prettier --write {staged_files} && git add {staged_files}'
eslint:
glob: '*.{js,ts,jsx,tsx,vue}'
run: 'pnpm eslint {staged_files} --fix && git add {staged_files}'