Skip to content

Commit 7f68890

Browse files
authored
chore: simplify lefthook hooks (#121)
## Summary - Remove the formatting hook from Lefthook - Keep pre-commit lint and typecheck, and split pre-push test/build hooks ## Verification - `lefthook` pre-commit hook passed during commit - `lefthook` pre-push hook passed during push
1 parent 56b9171 commit 7f68890

3 files changed

Lines changed: 126 additions & 5 deletions

File tree

lefthook.yml

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
pre-commit:
2+
parallel: true
3+
commands:
4+
lint:
5+
run: pnpm nx affected -t lint --uncommitted --outputStyle=static
6+
7+
typecheck:
8+
run: pnpm nx affected -t typecheck --uncommitted
9+
10+
pre-push:
11+
parallel: true
12+
commands:
13+
test:
14+
run: pnpm nx affected -t test --base=origin/main --head=HEAD
15+
16+
build:
17+
run: pnpm nx affected -t build --base=origin/main --head=HEAD

package.json

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,17 @@
33
"version": "0.0.0",
44
"license": "MIT",
55
"scripts": {
6+
"prepare": "lefthook install",
67
"build:all": "nx run-many -t build",
78
"lint:all": "nx run-many -t lint",
89
"test:all": "nx run-many -t test",
910
"typecheck:all": "nx run-many -t typecheck"
1011
},
1112
"private": true,
1213
"devDependencies": {
14+
"@babel/core": "^7.25.2",
15+
"@babel/preset-env": "^7.25.3",
16+
"@babel/runtime": "7.27.6",
1317
"@eslint/js": "^9.8.0",
1418
"@nx/eslint": "22.0.4",
1519
"@nx/eslint-plugin": "22.0.4",
@@ -18,9 +22,6 @@
1822
"@nx/rollup": "22.0.4",
1923
"@nx/vite": "22.0.4",
2024
"@nx/web": "22.0.4",
21-
"@babel/core": "^7.25.2",
22-
"@babel/preset-env": "^7.25.3",
23-
"@babel/runtime": "7.27.6",
2425
"@rollup/plugin-url": "^8.0.2",
2526
"@swc-node/register": "~1.9.1",
2627
"@swc/core": "~1.5.7",
@@ -37,18 +38,19 @@
3738
"eslint-plugin-jsx-a11y": "6.10.1",
3839
"eslint-plugin-react": "7.35.0",
3940
"eslint-plugin-react-hooks": "5.0.0",
41+
"jest-cli": "^30.2.0",
4042
"jiti": "2.4.2",
4143
"jsdom": "~22.1.0",
4244
"jsonc-eslint-parser": "^2.1.0",
45+
"lefthook": "^2.1.6",
4346
"nx": "22.0.4",
4447
"prettier": "^2.6.2",
4548
"rollup": "^4.14.0",
4649
"tslib": "^2.3.0",
4750
"typescript": "5.9.3",
4851
"typescript-eslint": "8.47.0",
4952
"vite": "7.2.2",
50-
"vitest": "^3.2.4",
51-
"jest-cli": "^30.2.0"
53+
"vitest": "^3.2.4"
5254
},
5355
"packageManager": "pnpm@10.6.1+sha512.40ee09af407fa9fbb5fbfb8e1cb40fbb74c0af0c3e10e9224d7b53c7658528615b2c92450e74cfad91e3a2dcafe3ce4050d80bda71d757756d2ce2b66213e9a3"
5456
}

pnpm-lock.yaml

Lines changed: 102 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)