chore: commit message限制引入

This commit is contained in:
OBKoro1 2020-12-25 14:45:44 +08:00
parent 13fc08475f
commit a03721f62c
2 changed files with 29 additions and 2 deletions

24
commitlint.config.js Normal file
View File

@ -0,0 +1,24 @@
module.exports = {
extends: ['@commitlint/config-conventional'],
rules: {
'subject-case': [0],
'scope-case': [0],
'type-enum': [
2,
'always',
[
'feat', // 增加新功能
'fix', // 修复bug
'build', // 构造工具的或者外部依赖的改动例如webpacknpm
'chore', // 不修改src或者test的其余修改例如构建过程或辅助工具的变动
'ci', // 与CI持续集成服务有关的改动
'docs', // 只改动了文档相关的内容
'style', // 不影响代码含义的改动,例如去掉空格、改变缩进、增删分号
'perf', // 提高性能的改动
'refactor', // 代码重构时使用
'revert', // 执行git revert打印的message
'test', // 添加测试或者修改现有测试
],
],
},
};

View File

@ -16,7 +16,8 @@
},
"husky": {
"hooks": {
"pre-commit": "lint-staged"
"pre-commit": "lint-staged",
"commit-msg": "commitlint -e $GIT_PARAMS"
}
},
"lint-staged": {
@ -87,6 +88,8 @@
"github 自动commit"
],
"devDependencies": {
"@commitlint/cli": "^11.0.0",
"@commitlint/config-conventional": "^11.0.0",
"@types/glob": "^7.1.1",
"@types/mocha": "^5.2.7",
"@types/node": "^12.11.7",
@ -102,7 +105,7 @@
"ts-loader": "^6.2.1",
"typescript": "^3.9.7",
"vscode": "^1.1.36",
"webpack": "^4.41.4",
"webpack": "^4.44.2",
"webpack-cli": "^3.3.10"
},
"dependencies": {