chore(NO-TASK): Explain which part of a commit header failed - #6
Merged
Conversation
The config carried a top-level messages key that is not a commitlint option,
so none of it ever reached the user. What they saw instead was misleading:
when headerPattern fails to match, the parser extracts nothing, so a
misspelled type reported as type-empty and subject-empty - two errors that
never mention the real problem.
Diagnostics now come from a linchpin-header rule registered as a plugin,
which is the only way a config can supply its own message text. It names the
part that failed and suggests a fix for the common near-misses: a lowercase
task key, NOTASK for NO-TASK, and a missing scope or subject.
type-empty and subject-empty are silenced because they only ever fire as
noise alongside the real diagnosis.
nope(PROJ-123): Bad type here
before: subject may not be empty / type may not be empty
after: "nope" is not a valid type. Valid types: add, improve, ...
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Better failure output when a commit message is rejected.
Two problems
1. The
messagesblock was dead config. The config carried a top-levelmessageskey with friendly text fortype-enum,subject-caseandheader-pattern. That is not a commitlint option — none of it ever reached a user.2. What they saw instead was actively misleading. When
headerPatternfails to match, the parser extracts nothing, so the built-in rules report an empty type and subject regardless of the real cause:The subject is right there. The actual problem —
nopeis not a valid type — is never mentioned.After
It names the failing part and suggests a fix for the common near-misses:
nope(PROJ-123): …"nope" is not a valid type+ the valid listfeat(deps): …"deps" is not a valid scope+ the three valid formsfeat(proj-123): …Task keys are uppercase - try "PROJ-123"feat(NOTASK): …Write it exactly as NO-TASKfeat: No scopeThe scope is missingfeat(NO-TASK):The subject is missingHow
Diagnostics come from a
linchpin-headerrule registered viaplugins— the only way a commitlint config can supply its own message text.type-emptyandsubject-emptyare silenced, since they only ever fire as noise alongside the real diagnosis.Because this ships in the shared package, all 71 repos in the rollout get it.
Verification
feat(PROJ-123):,fix(NO-TASK):,docs(#42):,add(…),remove(…),feature(…)Task: NO-TASK
🤖 Generated with Claude Code