Closed
Description
version:
"commitlint-config-cz": "^0.12.1"
bug:
I use npm install commitlint-config-cz --save-dev
install commitlint-config-cz
,and I use it with commitizen
and cz-customizable
, but it not work.
this is my project.json
:
"config": {
"commitizen": {
"path": "node_modules/cz-customizable"
}
},
"cz-customizable": {
"config": "cz-config.js"
},
"husky": {
"hooks": {
"pre-commit": "lint-staged"
}
},
"lint-staged": {
"*.{ts,tsx}": [
"npm run lint:ts",
"npm run format",
"git add"
]
}
}
this is my commitlint.config.js
:
module.exports = {
extends: [
'cz'
]
};
this is my .cz-config.js
:
module.exports = {
types: [
{ value: 'feat✨', name: '特性: 一个新的特性' },
{ value: 'fix🐞', name: '修复: 修复一个Bug' },
{ value: 'docs📚', name: '文档: 变更的只有文档' },
{ value: 'style💅', name: '格式: 空格, 分号等格式修复' },
{ value: 'refactor🛠', name: '重构: 代码重构,注意和特性、修复区分开' },
{ value: 'perf🐎', name: '性能: 提升性能' },
{ value: 'test🏁', name: '测试: 添加一个测试' },
{ value: 'revert⏪', name: '回滚: 代码回退' },
{ value: 'chore🗯', name: '工具:开发工具变动(构建、脚手架工具等)' }
],
messages: {
type: '选择一种你的提交类型:',
customScope: '请输入修改范围(可选):',
subject: '短说明:',
body: '长说明,使用"|"换行(可选):',
footer: '关联关闭的issue,例如:#31, #34(可选):',
confirmCommit: '确定提交说明?'
},
allowCustomScopes: true,
allowBreakingChanges: ['特性', '修复'],
subjectLimit: 100
}
What's Happening
after i write those,I use git commit -m "xxxx"
directly to commit, it's still pass the check,i don't konw why,hope got you resolve! thank you!
repository
this is my repository
Activity
whizark commentedon Dec 4, 2019
@xieyezi Hi, thanks for your detailed report. At first, it seems you need separately install & setup commitlint. It should be as followings:
@commitlint/cli
.commit-msg
hook in yourpackage.json
:Commitlint works now with the following config.
In addition, your config file for cz-customizable is not
cz-config.js
but.cz-config.js
, right? You might also need to fix the follwoing lines in yourpackage.json
.BTW,
commitlint-config-cz
adds onlytype-enum
,scope-enum
rules as above (which are read from your cz-customizable config).This means commitlnt allows you to commit with empty type, empty subject by the default, so you might also want to add
type-empty
,subject-empty
rules to yourcommitlint.config.js
(see alsoscope-empty
).I hope this solves issues 😃
xieyezi commentedon Dec 4, 2019
@whizark thanks got your reply , I do what you said,but still have this problem?
xieyezi commentedon Dec 4, 2019
@whizark :this is my repository
whizark commentedon Dec 4, 2019
@xieyezi Ah, sorry for my typo in
commitlint.config.js
.subject-empty
is the correct rule name, so the following config should work.xieyezi commentedon Dec 5, 2019
@whizark hi, I try you said,but it's still like before?
repository
xieyezi commentedon Dec 5, 2019
@whizark hi, maybe some files not changes,so I delete
node_modules
files, and reinstall , it works normal finally!so thank your help ,best wishes with you!!!🤗
youngjuning commentedon Aug 11, 2021
Why not build it in?
elton11220 commentedon Jun 7, 2023
Excellent!