chore: add commitlint and husky

Signed-off-by: Xe Iaso <me@xeiaso.net>
This commit is contained in:
Xe Iaso
2026-02-15 12:01:13 +00:00
parent a2ba2eb34b
commit c7d780a55f
4 changed files with 906 additions and 3 deletions

8
.husky/commit-msg Normal file
View File

@@ -0,0 +1,8 @@
npx --no-install commitlint --edit "$1"
# Check if commit message contains Signed-off-by line
if ! grep -q "^Signed-off-by:" "$1"; then
echo "Commit message must contain a 'Signed-off-by:' line."
echo "Please use 'git commit --signoff' or add a Signed-off-by line to your commit message."
exit 1
fi

2
.husky/pre-commit Normal file
View File

@@ -0,0 +1,2 @@
npm run lint
npm run test

869
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@@ -14,15 +14,18 @@
"container": "npm run assets && go run ./cmd/containerbuild",
"package": "go tool yeet",
"lint": "make lint",
"prepare": "go mod download",
"format": "prettier -w . 2>&1 >/dev/null"
"prepare": "husky && go mod download",
"format": "prettier -w . 2>&1 >/dev/null && go run goimports -w ."
},
"author": "",
"license": "ISC",
"devDependencies": {
"@commitlint/cli": "^20.4.1",
"@commitlint/config-conventional": "^20.4.1",
"cssnano": "^7.1.2",
"cssnano-preset-advanced": "^7.0.10",
"esbuild": "^0.27.2",
"husky": "^9.1.7",
"playwright": "^1.52.0",
"postcss-cli": "^11.0.1",
"postcss-import": "^16.1.1",
@@ -34,6 +37,27 @@
"@aws-crypto/sha256-js": "^5.2.0",
"preact": "^10.28.2"
},
"commitlint": {
"extends": [
"@commitlint/config-conventional"
],
"rules": {
"body-max-line-length": [
2,
"always",
99999
],
"footer-max-line-length": [
2,
"always",
99999
],
"signed-off-by": [
2,
"always"
]
}
},
"prettier": {
"singleQuote": false,
"tabWidth": 2,
@@ -41,4 +65,4 @@
"trailingComma": "all",
"printWidth": 80
}
}
}