chore: commit hook enforcing semver commit message prefixes#139
chore: commit hook enforcing semver commit message prefixes#139
Conversation
| Accepted prefixes are: | ||
|
|
||
| "volta": { | ||
| "extends": "../../../../package.json" | ||
| } | ||
| - `feat:` to trigger a minor version bump | ||
| - `fix:` to trigger a patch version bump | ||
| - `chore:` for a commit that doesn't trigger a release/version bump |
There was a problem hiding this comment.
📝 Info: README documents only feat/fix/chore but the regex also allows scope and breaking change markers
The README at lines 87-90 lists accepted prefixes as feat:, fix:, and chore:, but does not mention that the validator also accepts optional scopes like feat(api): and breaking change indicators like feat!: or feat(api)!:. The examples in the error message of the validation script (lines 31-35) do document these, so users will see them upon failure, but it might be helpful to mention them in the README as well for discoverability.
Was this helpful? React with 👍 or 👎 to provide feedback.
| if (/^(Merge|Revert|fixup!|squash!)/.test(firstLine)) { | ||
| process.exit(0); | ||
| } |
There was a problem hiding this comment.
📝 Info: Bypass regex matches prefixes loosely, could skip validation for non-standard messages
The bypass regex /^(Merge|Revert|fixup!|squash!)/ at line 20 has no word boundary or trailing character requirement for Merge and Revert. This means a commit message like Reverted the feature flag or Merged two modules would bypass validation entirely, even though these are user-authored messages (not git-generated). Git's actual auto-generated messages are Revert "..." and Merge branch/pull request .... Adding a stricter pattern like ^(Merge |Revert "|fixup! |squash! ) would be more precise. This is unlikely to cause real issues in practice but is worth noting.
Was this helpful? React with 👍 or 👎 to provide feedback.
1516e64 to
bca1f8b
Compare
This change is