Skip to content

Commit

Permalink
[#1] chore: commitlint 적용
Browse files Browse the repository at this point in the history
  • Loading branch information
SingTheCode committed Mar 1, 2024
1 parent 15c0cbb commit 284424c
Show file tree
Hide file tree
Showing 4 changed files with 5,787 additions and 3,659 deletions.
1 change: 1 addition & 0 deletions .husky/commit-msg
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
npx --no -- commitlint --edit $1
33 changes: 33 additions & 0 deletions commitlint.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
export default {
extends: ["@commitlint/config-conventional"],
rules: {
"type-enum": [
2,
"always",
["feat", "fix", "refactor", "chore", "docs", "style"],
],
"scope-empty": [2, "always"],
"subject-empty": [2, "always"],
"type-empty": [2, "always"],
"header-custom": [2, "always"],
// 커스텀 규칙을 직접 정의하는 대신 기본 규칙을 활용
},
plugins: [
{
rules: {
"header-custom": (parsed) => {
if (!parsed.header) {
return [false, "header is empty"];
}
const pattern =
/^\[\#\d+\]\s(feat|fix|refactor|chore|docs|style):\s.+/;
const match = pattern.test(parsed.header);
return [
match,
`header does not match pattern ${pattern.toString()}`,
];
},
},
},
],
};
Loading

0 comments on commit 284424c

Please sign in to comment.