Hi, this is just a simple usage question.
I currently define a .commitlintrc.yml file with the following contents:
extends:
- '@commitlint/config-conventional'
Currently, this commit message (feat(CLI): add annotation for the flag name for a parameter/property in the CLI) fails commitlint validation with error: scope must be lower-case [scope-case]
I'd like to relax this restriction to allow the component (i.e. "CLI") to be specified in upper case so that the above commit message passes validation.
Could someone please suggest how to configure that in my .commitlintrc.yml file?
| Executable | Version |
| ---------------------: | :------ |
| commitlint --version | 11.0.0 |
| git --version | 2.62.2 |
| node --version | 12.18.3 |
Hey @padamstx , have a look at the docs here: https://commitlint.js.org/#/reference-configuration?id=configuration
There's an example that says:
/*
* Any rules defined here will override rules from @commitlint/config-conventional
*/
rules: {
'type-enum': [2, 'always', ['foo']],
},
Try to overwrite the specific rule like this but using the rule you want to overwrite:
https://commitlint.js.org/#/reference-rules?id=scope-case
Hope this helps. Let us know if you need further help.
Just to close the loop on this, I finally got around to using this info to modify our commitlint config.
This is the commitlint.config.js file I ended up with:
const Configuration = {
extends: ['@commitlint/config-conventional'],
/*
* Any rules defined here will override rules from @commitlint/config-conventional
*/
rules: {
'scope-case': [0, 'always', 'lower-case'],
'subject-case': [0, 'always', 'lower-case'],
},
};
module.exports = Configuration;
I initially had the first line coded like this:
const Configuration: Config = {
which is what was specified in the example Configuration object
but that caused a javascript syntax error. I'm not a javascript expert, but a quick google search led me to just remove the : Config part, and commitlint seemed to be perfectly happy with that.
I mention this in case the example needs to be corrected.
Anyway, thank you for the info @escapedcat !
Uhm, yeah, that's typescript, but the docs say commitlint.config.js which isn't compatible in a non-TS setup I guess. Thanks for lettign us know. We will try to update the docs here.
@padamstx would this help?:
https://github.com/conventional-changelog/commitlint/pull/2424