Skip to content

Commit 5c3257c

Browse files
committed
chore: add lefthook + commitfmt
1 parent 2eb757a commit 5c3257c

File tree

5 files changed

+222
-28
lines changed

5 files changed

+222
-28
lines changed

commitfmt.toml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
[lint.header]
2+
type-enum = ["chore", "ci", "feat", "fix", "refactor", "style", "test", "docs", "BREAKING CHANGE"]
3+
description-case = "lower-first"
4+
description-max-length = 72
5+
description-full-stop = true
6+
type-required = true
7+
8+
[lint.body]
9+
max-line-length = 72
10+
case = "upper-first"
11+
12+
[lint.footer]
13+
breaking-exclamation = true
14+
15+
[[additional-footers]]
16+
key = "Ticket-ID"
17+
branch-pattern = "(?:.*)/(?<TICKET_ID>[A-Z0-9-]+)/?(?:.*)"
18+
value = "${{ TICKET_ID }}"

lefthook.yml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
pre-commit:
2+
parallel: true
3+
commands:
4+
lint:
5+
glob: "*.{js,ts,jsx,tsx}"
6+
run: pnpm exec eslint {staged_files} --fix
7+
stage_fixed: true
8+
prepare-commit-msg:
9+
commands:
10+
format-commit-message:
11+
run: pnpm exec commitfmt
12+
pre-push:
13+
commands:
14+
check-typings:
15+
run: pnpm exec tsc --noEmit

package.json

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
"name": "mobx-tanstack-query",
33
"version": "5.2.2",
44
"scripts": {
5+
"postinstall": "pnpm dev:install-hooks",
56
"clean": "rimraf dist",
67
"check": "eslint . --fix",
78
"prebuild": "npm run clean && npm run check",
@@ -17,7 +18,8 @@
1718
"docs": "pnpm build && cd docs && pnpm dev",
1819
"docs:build": "pnpm build && cd docs && pnpm build",
1920
"docs:serve": "cd docs && pnpm preview",
20-
"dev": "pnpm test:watch"
21+
"dev": "pnpm test:watch",
22+
"dev:install-hooks": "if [ -z \"$CI\" ]; then lefthook install; fi"
2123
},
2224
"keywords": [
2325
"mobx",
@@ -38,8 +40,8 @@
3840
"url": "git://github.com/js2me/mobx-tanstack-query"
3941
},
4042
"peerDependencies": {
41-
"mobx": "^6.12.4",
42-
"@tanstack/query-core": "^5.67.2"
43+
"@tanstack/query-core": "^5.67.2",
44+
"mobx": "^6.12.4"
4345
},
4446
"dependencies": {
4547
"linked-abort-controller": "^1.1.0"
@@ -51,15 +53,17 @@
5153
"@types/react": "^18.3.3",
5254
"@vitejs/plugin-react-swc": "^3.7.2",
5355
"@vitest/coverage-istanbul": "^2.1.6",
54-
"nodemon": "^3.1.0",
56+
"commitfmt": "^1.0.0",
5557
"eslint": "^8.57.0",
5658
"js2me-eslint-config": "^1.0.6",
57-
"js2me-exports-post-build-script": "^2.0.18",
59+
"js2me-exports-post-build-script": "^3.0.2",
5860
"jsdom": "^25.0.1",
61+
"lefthook": "^1.11.13",
62+
"nodemon": "^3.1.0",
5963
"rimraf": "^6.0.1",
6064
"typescript": "^5.4.5",
6165
"vitest": "^2.1.4",
62-
"yummies": "^3.0.23"
66+
"yummies": "^3.2.9"
6367
},
6468
"packageManager": "[email protected]+sha512.140036830124618d624a2187b50d04289d5a087f326c9edfc0ccd733d76c4f52c3a313d4fc148794a2a9d81553016004e6742e8cf850670268a7387fc220c903"
6569
}

pnpm-lock.yaml

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

0 commit comments

Comments
 (0)