Description
Expected Behavior
Would it be okay to allow the subject-case
rule handle not only latin but any other language alphabet?
Current Behavior
Currently, the subject-case
rule skips validation if message doesn't start with a latin alphabet character (only a
to z
with case irrelevant, as of now).
It became like that 5 years ago with the following change made — @commitlint/rules/src/subject-case.ts#L14.
Affected packages
- cli
- core
- prompt
- config-angular
Possible Solution
The solution, as I see it, would only require to change the RegExp that is used to filter invalid subject messages.
So, change what is used now (which only includes latin alphabet):
subject.match(/^[a-z]/i)
to a pattern with unicode support:
subject.match(/^\p{L}/ui)
where \p{L}
means any kind of letter from any language
and the u
flag enables it.
Context
Basically, if a commit subject
is written in non-English language then subject-case
rule is just skipped.
This feature would benefit someone who (for one reason or another) writes commit messages (or, rather, subject
) using different language than English but still wants to follow the commit convention.