commitlint-jira
commitlint-jira copied to clipboard
Respect Angular conventions
Hello,
I am wondering if this repository is still maintained. I hope so, because I wanted ask if you could support JIRA IDs at the end or even at second position of a commit message. I am asking because I would like to also use it together with angular commit conventions to end up with a commit like
feat: great thing JIRAID-1234orfeat: great thing (JIRAID-1234)
this would allow subsequent tooling like semantic-release and Changelog generation based on commits to deliver even nicer results.
@ITler it's still maintained))) but guys It is a package only for JIRA commit formats, not Angular formats....if you want Angular style then use https://github.com/conventional-changelog/commitlint#getting-started
Hello @Gherciu,
I know this package is not for Angular formats, but I am asking to enable it to work alongside the Angular formats. My proposal is to make commitlint configurable to allow the JIRA ID being located at the end of a commit message. I refined the initial description and kindly ask for re-opening this isse.
Thanks @ITler
@ITler were you able to find a solution? I'm trying to get a working config for the same commit format.
@antodd unfortunately not
At the moment that is not possible because is not implemented in this package. If someone needs that ..Pls feel free to open a PR for that and I'll review, merge and publish it to NPM.
I will not implement that because I think this functional is useless but if someone wants to spend time on that then I'll review and merge... If someone wants this format you can also use the standard config for commitlint and write the commit in this format : feat(PRJ-123): commit body which is pretty similar to your examples.
I think this functional is useless
Just because you use a convention, doesn't make it useless. That is why the main @commitlint package is so configurable, as people have different standards for different companies
I think the Signed off by: is a weird convention, but by no means do I think it is stupid or "useless"
if someone is still fighting with this, adding a custom plugin works
parserPreset: {
parserOpts: {
issuePrefixes: ["JIRA-"],
},
},
plugins: [
{
rules: {
// Issues should be in the footer, as per Angular Commit Styling
"issue-reference-in-footer": ({ references, footer }) => {
// First check if there is a issue reference in the commit
if (references.length === 0) {
return [true, "No issue reference found"];
}
// Make sure the issue reference is in the footer
if (footer === null) {
return [false, "Issue reference must be in the footer"];
}
// Make sure all issue references are in the footer
const footerReferences = footer.match(/JIRA-\d+/g);
if (footerReferences === null) {
return [false, "Issue reference must be in the footer"];
}
// Make sure all issue references are in the footer
if (footerReferences.length !== references.length) {
return [false, "Issue reference must be in the footer"];
}
return [true, "Issue reference found in footer"];
},
},
},
],
Some documentation I used here:
- https://commitlint.js.org/#/reference-plugins
- https://stackoverflow.com/questions/70521236/customise-commitlint-header-format