Skip to content

Commit

Permalink
chore: add commitlint and husky hooks HP-2135
Browse files Browse the repository at this point in the history
  • Loading branch information
mikkojamG committed May 8, 2024
1 parent e5f4fdd commit ade8e06
Show file tree
Hide file tree
Showing 5 changed files with 675 additions and 30 deletions.
26 changes: 26 additions & 0 deletions .commitlintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
{
"extends": ["@commitlint/config-conventional"],
"rules": {
"header-max-length": [2, "always", 72],
"body-max-line-length": [2, "always", 72],
"body-leading-blank": [2, "always"],
"type-enum": [
2,
"always",
[
"build",
"chore",
"ci",
"deps",
"docs",
"feat",
"fix",
"perf",
"refactor",
"revert",
"style",
"test"
]
]
}
}
4 changes: 4 additions & 0 deletions .husky/commit-msg
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/usr/bin/env sh
. "$(dirname -- "$0")/_/husky.sh"

yarn commitlint --edit $1
4 changes: 4 additions & 0 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/usr/bin/env sh
. "$(dirname -- "$0")/_/husky.sh"

yarn test --watch=false
5 changes: 4 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@
"update-country-calling-codes": "esrun --tsconfig=./scripts/tsconfig.json scripts/update-country-calling-codes.ts",
"clear-babel-cache": "rm -rf ./node_modules/.cache/@babel",
"typecheck": "tsc --skipLibCheck --noEmit --project tsconfig.json",
"postinstall": "yarn update-runtime-env"
"postinstall": "if test \"$NODE_ENV\" != \"production\" ; then husky install ; fi && yarn update-runtime-env"
},
"browserslist": {
"production": [
Expand All @@ -110,12 +110,15 @@
]
},
"devDependencies": {
"@commitlint/cli": "^18.4.3",
"@commitlint/config-conventional": "^18.4.3",
"@graphql-codegen/cli": "^5.0.2",
"@graphql-codegen/typescript": "^4.0.6",
"@graphql-codegen/typescript-operations": "^4.2.0",
"@vitest/coverage-istanbul": "^1.3.1",
"cross-env": "^7.0.3",
"helsinki-utils": "City-of-Helsinki/helsinki-utils-js#0.1.0",
"husky": "^9.0.11",
"jsdom": "^24.0.0"
},
"resolutions": {
Expand Down
Loading

0 comments on commit ade8e06

Please sign in to comment.