Skip to content

Commit

Permalink
feat: add commitlint and husky
Browse files Browse the repository at this point in the history
  • Loading branch information
akira02 committed Apr 25, 2023
1 parent f037822 commit 5bb9509
Show file tree
Hide file tree
Showing 4 changed files with 598 additions and 15 deletions.
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"

npx --no -- commitlint --edit ${1}
38 changes: 38 additions & 0 deletions commitlint.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
"module.exports = {extends: ['@commitlint/config-conventional']}";

module.exports = {
extends: ['@commitlint/config-conventional'],
rules: {
'type-enum': [
2,
'always',
[
'feat',
'fix',
'docs',
'style',
'refactor',
'perf',
'test',
'build',
'ci',
'chore',
'revert',
],
],
'subject-exclamation-mark': [2, 'never'],
'body-leading-blank': [1, 'always'],
'footer-leading-blank': [1, 'always'],
'header-max-length': [2, 'always', 72],
'scope-case': [2, 'always', 'lower-case'],
'subject-case': [
2,
'never',
['sentence-case', 'start-case', 'pascal-case', 'upper-case'],
],
'subject-empty': [2, 'never'],
'subject-full-stop': [2, 'never', '.'],
'type-case': [2, 'always', 'lower-case'],
'type-empty': [2, 'never'],
},
};
8 changes: 7 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,18 @@
"lint": "turbo run lint",
"format": "prettier --write \"**/*.{ts,tsx,md}\"",
"beta-release": "turbo run build && changeset pre enter beta && changeset version && changeset publish",
"release": "turbo run build && changeset version && changeset publish"
"release": "turbo run build && changeset version && changeset publish",
"postinstall": "husky install",
"prepare": "husky install"
},
"devDependencies": {
"@changesets/cli": "^2.26.1",
"@commitlint/cli": "^17.6.1",
"@commitlint/config-angular": "^17.6.1",
"@commitlint/config-conventional": "^17.6.1",
"eslint": "^7.32.0",
"eslint-config-custom": "*",
"husky": "^8.0.0",
"prettier": "^2.5.1",
"turbo": "latest"
},
Expand Down
Loading

0 comments on commit 5bb9509

Please sign in to comment.