script-utils/commitlint-spellcheck-header
A commitlint rule that spellchecks a commit HEADER with the project’s own spellcheck configuration.
The header is the one part of a commit message that ships verbatim: a release turns every commit subject since the last tag into a - <subject> bullet of the new CHANGELOG.md section, and spellchecks that section before writing it. That check works, but it runs at release time, after the whole preflight gate, and weeks after the subject was pushed to the default branch. At that point the only fixes are rewriting published history or supplying the release notes by hand. The commit-msg hook is the last point at which the word can still be changed for free.
The header is checked AS the bullet it will become, attributed to CHANGELOG.md, so the verdict is the one the release would give: the same cspell configuration, the same words, the same ignorePaths. And it runs only where the project defines a spellcheck script, which is the condition the release applies too. A project with no spelling configuration would otherwise have its commits judged against the stock dictionaries alone, and refused over its own name.
Functions
Section titled “Functions”| Function | Description |
|---|---|
| spellcheckHeaderRule | Spellchecks the commit header as the changelog bullet it will become. Only the always condition is meaningful: never would require the header to be misspelled, so it is treated the same way rather than inverted. |
Variables
Section titled “Variables”| Variable | Description |
|---|---|
| SPELLCHECK_HEADER_RULE_NAME | The name the rule is registered under. |
| spellcheckHeaderPlugin | The commitlint plugin carrying spellcheckHeaderRule. |