commitlint-config-yllon
v1.0.0
Published
Git规范
Downloads
4
Readme
commitlint-config-yllon
Git 规范
支持配套的 commitlint 配置,用于对 git commit message
进行校验。
安装
使用时,需要安装 @commitlint/cli:
npm install commitlint-config-yllon @commitlint/cli --save-dev
使用
在 commitlint.config.js
中集成本包:
绝对路径:
module.exports = {
extends: ['commitlint-config-yllon'],
};
如果编译器不支持绝对路径导入报错,可更换成相对路径导入。 相对路径:
{
"extends": ["./node_modules/commitlint-config-yllon"]
}
设置 git hook
可通过 husky 设置在 git commit
时触发 commitlint
。
首先安装 husky:
npm install husky --save-dev
然后执行添加commit-msg
:
npx husky add .husky/commit-msg 'npx commitlint --edit $1'
更多信息可参考 commitlint 文档。