Javascript_TypeScript - Package - commitlint
Quick Chat
commitlint 是一個用來檢查 git commit 信息格式的工具,它可以配合多種規範使用。
Guide
- conventional-changelog/commitlint
- commitlint doc
- Commit-lint学习:新手入门指南
- Commitlint vs Commitizen: Comparison for Better Git Commit Practices
Notice
- ⚠️ 此處搭配 simple-git-hooks 使用。
Install
pnpm add -D @commitlint/{cli,config-conventional}
Config
package.json
{
"simple-git-hooks": {
"pre-commit": "pnpm lint-staged && pnpm check",
"commit-msg": "pnpx commitlint --edit $1"
},
}
commitlint.config.js
export default {
extends: ['@commitlint/config-conventional'],
};