Skip to content

Commit 2a1b96b

Browse files
committed
chore: setup commitlint and husky
1 parent d631caf commit 2a1b96b

File tree

6 files changed

+753
-15
lines changed

6 files changed

+753
-15
lines changed

.husky/commit-msg

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
pnpm exec commitlint --config commitlint.config.cjs --edit $1

.husky/pre-push

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
pnpm lint

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@ This stack uses:
1313
- prettier
1414
- sort-package-json
1515
- publint
16+
- Commitlint
17+
- Husky (for hooks)
1618
- Circular dependency detection: madge
1719
- Release management: changesets + Github Actions
1820
- Package Registry: Github

commitlint.config.cjs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
module.exports = {
2+
extends: ["@commitlint/config-conventional"],
3+
rules: {
4+
"header-max-length": [1, "always", 160],
5+
"body-max-line-length": [1, "always", 160],
6+
},
7+
ignores: [
8+
(commit) => commit.includes("chore: upgrade deps"),
9+
],
10+
};

package.json

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
"lint": "pnpm typecheck && pnpm lint:prettier && pnpm lint:madge",
1212
"lint:madge": "bun run --bun madge --circular --extensions ts,tsx packages/",
1313
"lint:prettier": "bun run --bun prettier --check README.md .github/ ./packages",
14-
"prepare": "pnpm format:pkg",
14+
"prepare": "pnpm format:pkg && husky",
1515
"release": "pnpm run build && changeset publish",
1616
"test": "vitest --run",
1717
"test:watch": "vitest",
@@ -21,7 +21,11 @@
2121
"version-packages": "changeset version && pnpm format"
2222
},
2323
"devDependencies": {
24+
"@changesets/changelog-github": "^0.5.1",
2425
"@changesets/cli": "^2.28.1",
26+
"@commitlint/cli": "^19.8.0",
27+
"@commitlint/config-conventional": "^19.8.0",
28+
"husky": "^9.1.7",
2529
"madge": "^8.0.0",
2630
"prettier": "^3.5.3",
2731
"sort-package-json": "^3.0.0",

0 commit comments

Comments
 (0)