commitlint-plugin-shr-jira
v1.0.6
Published
A plugin that implement all jira commits messages style rules and validate commit messages
Downloads
9,459
Maintainers
Readme
For Tips and Advanced Usage you can read this Blog Post
Getting started.
Install dependencies
npm install --save-dev @commitlint/cli commitlint-config-jira-jquery commitlint-plugin-shr-jira
- commitlint-config-jira-jquery - is a recomended config who contain preconfigured rules for jira commits messages style. See all rules in description below
- commitlint-plugin-shr-jira - is a plugin that implement all jira commits messages style rules and validate commit messages
Configure commitlint to use jira commits messages style config
// commitlint.config.js || commitlintrc.js
module.exports = {
plugins: ['commitlint-plugin-shr-jira'],
extends: ['jira-jquery'],
}
To lint commits before they are created you can use Husky's 'commit-msg' hook
// package.json
{
"husky": {
"hooks": {
"commit-msg": "commitlint -E HUSKY_GIT_PARAMS"
}
}
}
Rules
// You must follow this rule
<type>[<scope>(optional)]: [<ticket-id>(uppercase-number)] <title>
[optional body]
[optional footer(s)]
Notes: The attributes must be based on this below:
- type: build, ci, docs, fix, feat, perf, refactor, style, test, chore
- scope: fatal, major, minor, ui, http, compiler, etc.
- ticket_id: Jira’s ticket ID
- title: meaningful, imperative mood, 60-character long, no capitalization, no ending dot (.)
Examples
// ❌ Bad commit messages
git commit -m"My commit message body"
git commit -m":My commit message body"
git commit -m"feat: My commit message body"
git commit -m"feat: [Va-123] my commit message body"
git commit -m"feat: [VA-123h] my commit message body"
git commit -m"feat: [VA-123] my commit message body."
// ✅ Good commit messages
git commit -m"feat[major]: [SHRA-3331] add the commitlint plugin"
git commit -m"feat: [SHRA-3331] add the commitlint plugin"