commitlint代码提交语句检查
安装依赖
官方网址
yarn add --dev @commitlint/{config-conventional,cli}
新建文件
echo "module.exports = {extends: ['@commitlint/config-conventional']}" > commitlint.config.js
修改package.json
"husky": { "hooks": { "pre-commit": "lint-staged", "commit-msg": "commitlint -E HUSKY_GIT_PARAMS" } },
提交信息模版
官方地址
[ 'build', 'chore', 'ci', 'docs', 'feat', 'fix', 'perf', 'refactor', 'revert', 'style', 'test' ]; echo "foo: some message" # fails echo "fix: some message" # passes