We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
首先要装依赖包
npm install --save-dev @commitlint/{cli, config-conventional} npm install --save-dev husky
在根目录下添加文件commitlint.config.js
commitlint.config.js
module.exports = { extends: [ "@commitlint/config-conventional" ], rules: { 'type-enum': [2, 'always', [ 'upd', 'feat', 'fix', 'refactor', 'docs', 'chore', 'style', 'revert' ]], 'scope-empty': [2, 'never'], 'scope-case': [2, 'always', ['lower-case', 'camel-case', 'kebab-case']], 'subject-full-stop': [2, 'never', '.'], 'subject-case': [0, 'never'], 'header-max-length': [0, 'always', 72] } }
在package.json中配置husky钩子
package.json
husky
{ "scripts": { "commitmsg": "commitlint -E GIT_PARAMS" } }
完事!
rule配置说明: 由name和配置数组组成
<type>(<scope>): <subject> # 注意冒号后面有空格 <BLANK LINE> <body> <BLANK LINE> <footer>
name:[0, 'always', 72]
type-enum
常规推荐的常用type,当然不局限于此,可以随意定义
'type-case': [2, 'always', ['upper-case']] # 大写 'type-case': [2, 'never', ['upper-case']] # 小写 'subject-full-stop': [2, 'never', '.'] # subject不能一'.'结尾
The text was updated successfully, but these errors were encountered:
No branches or pull requests
如何使用
首先要装依赖包
在根目录下添加文件
commitlint.config.js
在
package.json
中配置husky
钩子完事!
配置详情
rule配置说明: 由name和配置数组组成
name:[0, 'always', 72]
type-enum
常规推荐的常用type,当然不局限于此,可以随意定义
其他
The text was updated successfully, but these errors were encountered: