Skip to content

Commit 62cd060

Browse files
authored
build: add commitlint script and husky commit hook (#35)
1 parent 4b0a3a9 commit 62cd060

File tree

5 files changed

+622
-6
lines changed

5 files changed

+622
-6
lines changed

.husky/commit-msg

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
corepack yarn run --binaries-only commitlint --edit "$1"

.husky/pre-commit

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
# corepack yarn test

commitlint.config.mjs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
import { RuleConfigSeverity } from "@commitlint/types";
2+
3+
export default {
4+
extends: ["@commitlint/config-conventional"],
5+
rules: {
6+
// Dependabot or we like long headers...
7+
"header-max-length": [RuleConfigSeverity.Disabled, "always", 0],
8+
},
9+
};

package.json

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,9 @@
1515
"dev": "yarn run build && concurrently -k -p '[{name}]' -n TypeScript,App -c yellow.bold,cyan.bold yarn:watch yarn:dev:start",
1616
"dev:start": "fastify start --ignore-watch='.ts$' -w -l debug -P dist/src/app.js --options",
1717
"lint": "eslint",
18-
"lint:fix": "eslint --fix"
18+
"lint:fix": "eslint --fix",
19+
"commitlint": "commitlint --last --strict --verbose",
20+
"prepare": "husky"
1921
},
2022
"keywords": [],
2123
"author": "Flandia",
@@ -38,6 +40,8 @@
3840
"openid-client": "^6.6.2"
3941
},
4042
"devDependencies": {
43+
"@commitlint/cli": "^20.1.0",
44+
"@commitlint/config-conventional": "^20.0.0",
4145
"@eslint/js": "^9.31.0",
4246
"@trivago/prettier-plugin-sort-imports": "^5.2.2",
4347
"@types/jsonwebtoken": "^9",
@@ -49,6 +53,7 @@
4953
"eslint-plugin-prettier": "^5.5.3",
5054
"fastify-tsconfig": "^3.0.0",
5155
"globals": "^16.3.0",
56+
"husky": "^9.1.7",
5257
"prettier": "3.6.2",
5358
"prettier-plugin-jsdoc": "^1.3.3",
5459
"tsx": "^4.20.3",

0 commit comments

Comments
 (0)