The sentence-case does not allow to other words than the first one to be capitalized, since in ensure-case it checks if other letters are in lower-case format. This is not correct, since sentence-case only requires the first word to be capitalised as well proper nouns and other words. For variable names, classes, etc it makes sense to include mixed case characters, while requiring the first letter to be capitalised.
Expected Behavior
The following should be valid:
Current Behavior
With the example above it throws a validation error:
input: Update Foo.sayBar method
subject must not be sentence-case [subject-case]
found 1 problems, 0 warnings
Affected packages
Possible Solution
I can make a PR, but I'll leave this open to discussion. I think that according to the grammar rule the only validation should be about checking if the first letter is capitalised:
// ...
case 'sentencecase':
return ensureCase(raw.charAt(0), 'upper-case');
// ...
Steps to Reproduce (for bugs)
- Add the rule:
'subject-case': [2, 'always', 'sentence-case']
- Create a commit message with the subject:
Add Foo
| Executable |
Version |
commitlint --version |
5.1.1 |
git --version |
2.14.3 |
node --version |
8.9.0 |
The
sentence-casedoes not allow to other words than the first one to be capitalized, since in ensure-case it checks if other letters are in lower-case format. This is not correct, since sentence-case only requires the first word to be capitalised as well proper nouns and other words. For variable names, classes, etc it makes sense to include mixed case characters, while requiring the first letter to be capitalised.Expected Behavior
The following should be valid:
Current Behavior
With the example above it throws a validation error:
Affected packages
Possible Solution
I can make a PR, but I'll leave this open to discussion. I think that according to the grammar rule the only validation should be about checking if the first letter is capitalised:
Steps to Reproduce (for bugs)
'subject-case': [2, 'always', 'sentence-case']Add Foocommitlint --versiongit --versionnode --version