Skip to content

Commit 9a3a35d

Browse files
authored
chore(git): Add lefthook (#147)
Add git hooks to run a few quick checks on commit and push Note: I'm running prettier with `--log-level=silent` to work around this issue: evilmartians/lefthook#1047 If I didn't have to do that I'd rather use `- run: yarn format:check` to align the lefthook check with our package.json script to make sure they're always in sync.
1 parent 8019ec6 commit 9a3a35d

File tree

4 files changed

+152
-0
lines changed

4 files changed

+152
-0
lines changed

.prettierignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,3 +29,4 @@
2929
**/__testfixtures__
3030
**/__tests__/fixtures
3131
**/__tests__/__fixtures__
32+
**/__tests__/prisma-client

lefthook.yml

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
# EXAMPLE USAGE:
2+
#
3+
# Refer for explanation to following link:
4+
# https://lefthook.dev/configuration/
5+
#
6+
pre-push:
7+
parallel: true
8+
jobs:
9+
- run: yarn lint
10+
- run: yarn prettier --check --log-level=silent .
11+
- run: yarn check
12+
13+
pre-commit:
14+
parallel: true
15+
jobs:
16+
- name: lint staged files
17+
run: yarn eslint {staged_files}
18+
glob: '*.{js,ts,jsx,tsx}'
19+
20+
- run: yarn prettier --log-level=silent --check {staged_files}
21+
#
22+
# - name: rubocop
23+
# glob: "*.rb"
24+
# exclude:
25+
# - config/application.rb
26+
# - config/routes.rb
27+
# run: bundle exec rubocop --force-exclusion {all_files}
28+
#
29+
# - name: govet
30+
# files: git ls-files -m
31+
# glob: "*.go"
32+
# run: go vet {files}
33+
#
34+
# - script: "hello.js"
35+
# runner: node
36+
#
37+
# - script: "hello.go"
38+
# runner: go run

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,7 @@
111111
"human-id": "^4.1.1",
112112
"jest": "29.7.0",
113113
"jscodeshift": "17.0.0",
114+
"lefthook": "^1.11.14",
114115
"lerna": "8.1.9",
115116
"listr2": "7.0.2",
116117
"make-dir-cli": "4.0.0",

yarn.lock

Lines changed: 112 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21289,6 +21289,117 @@ __metadata:
2128921289
languageName: node
2129021290
linkType: hard
2129121291

21292+
"lefthook-darwin-arm64@npm:1.11.14":
21293+
version: 1.11.14
21294+
resolution: "lefthook-darwin-arm64@npm:1.11.14"
21295+
conditions: os=darwin & cpu=arm64
21296+
languageName: node
21297+
linkType: hard
21298+
21299+
"lefthook-darwin-x64@npm:1.11.14":
21300+
version: 1.11.14
21301+
resolution: "lefthook-darwin-x64@npm:1.11.14"
21302+
conditions: os=darwin & cpu=x64
21303+
languageName: node
21304+
linkType: hard
21305+
21306+
"lefthook-freebsd-arm64@npm:1.11.14":
21307+
version: 1.11.14
21308+
resolution: "lefthook-freebsd-arm64@npm:1.11.14"
21309+
conditions: os=freebsd & cpu=arm64
21310+
languageName: node
21311+
linkType: hard
21312+
21313+
"lefthook-freebsd-x64@npm:1.11.14":
21314+
version: 1.11.14
21315+
resolution: "lefthook-freebsd-x64@npm:1.11.14"
21316+
conditions: os=freebsd & cpu=x64
21317+
languageName: node
21318+
linkType: hard
21319+
21320+
"lefthook-linux-arm64@npm:1.11.14":
21321+
version: 1.11.14
21322+
resolution: "lefthook-linux-arm64@npm:1.11.14"
21323+
conditions: os=linux & cpu=arm64
21324+
languageName: node
21325+
linkType: hard
21326+
21327+
"lefthook-linux-x64@npm:1.11.14":
21328+
version: 1.11.14
21329+
resolution: "lefthook-linux-x64@npm:1.11.14"
21330+
conditions: os=linux & cpu=x64
21331+
languageName: node
21332+
linkType: hard
21333+
21334+
"lefthook-openbsd-arm64@npm:1.11.14":
21335+
version: 1.11.14
21336+
resolution: "lefthook-openbsd-arm64@npm:1.11.14"
21337+
conditions: os=openbsd & cpu=arm64
21338+
languageName: node
21339+
linkType: hard
21340+
21341+
"lefthook-openbsd-x64@npm:1.11.14":
21342+
version: 1.11.14
21343+
resolution: "lefthook-openbsd-x64@npm:1.11.14"
21344+
conditions: os=openbsd & cpu=x64
21345+
languageName: node
21346+
linkType: hard
21347+
21348+
"lefthook-windows-arm64@npm:1.11.14":
21349+
version: 1.11.14
21350+
resolution: "lefthook-windows-arm64@npm:1.11.14"
21351+
conditions: os=win32 & cpu=arm64
21352+
languageName: node
21353+
linkType: hard
21354+
21355+
"lefthook-windows-x64@npm:1.11.14":
21356+
version: 1.11.14
21357+
resolution: "lefthook-windows-x64@npm:1.11.14"
21358+
conditions: os=win32 & cpu=x64
21359+
languageName: node
21360+
linkType: hard
21361+
21362+
"lefthook@npm:^1.11.14":
21363+
version: 1.11.14
21364+
resolution: "lefthook@npm:1.11.14"
21365+
dependencies:
21366+
lefthook-darwin-arm64: "npm:1.11.14"
21367+
lefthook-darwin-x64: "npm:1.11.14"
21368+
lefthook-freebsd-arm64: "npm:1.11.14"
21369+
lefthook-freebsd-x64: "npm:1.11.14"
21370+
lefthook-linux-arm64: "npm:1.11.14"
21371+
lefthook-linux-x64: "npm:1.11.14"
21372+
lefthook-openbsd-arm64: "npm:1.11.14"
21373+
lefthook-openbsd-x64: "npm:1.11.14"
21374+
lefthook-windows-arm64: "npm:1.11.14"
21375+
lefthook-windows-x64: "npm:1.11.14"
21376+
dependenciesMeta:
21377+
lefthook-darwin-arm64:
21378+
optional: true
21379+
lefthook-darwin-x64:
21380+
optional: true
21381+
lefthook-freebsd-arm64:
21382+
optional: true
21383+
lefthook-freebsd-x64:
21384+
optional: true
21385+
lefthook-linux-arm64:
21386+
optional: true
21387+
lefthook-linux-x64:
21388+
optional: true
21389+
lefthook-openbsd-arm64:
21390+
optional: true
21391+
lefthook-openbsd-x64:
21392+
optional: true
21393+
lefthook-windows-arm64:
21394+
optional: true
21395+
lefthook-windows-x64:
21396+
optional: true
21397+
bin:
21398+
lefthook: bin/index.js
21399+
checksum: 10c0/bc2e7b9c895c1b9092846e0d2de8fafe88eabb82a4894eda80aee7dc50015caf4fcffa64f432d7473d417beed0025ab0824dc031d772d97b76ba14c3860589a1
21400+
languageName: node
21401+
linkType: hard
21402+
2129221403
"lerna@npm:8.1.9":
2129321404
version: 8.1.9
2129421405
resolution: "lerna@npm:8.1.9"
@@ -26580,6 +26691,7 @@ __metadata:
2658026691
human-id: "npm:^4.1.1"
2658126692
jest: "npm:29.7.0"
2658226693
jscodeshift: "npm:17.0.0"
26694+
lefthook: "npm:^1.11.14"
2658326695
lerna: "npm:8.1.9"
2658426696
listr2: "npm:7.0.2"
2658526697
make-dir-cli: "npm:4.0.0"

0 commit comments

Comments
 (0)