1.1.0 • Published 4 years ago

commitlint-plugin-loanmarket v1.1.0

Weekly downloads
13
License
MIT
Repository
-
Last release
4 years ago

Getting started.

Install dependencies
npm install --save-dev @commitlint/cli commitlint-plugin-loanmarket
Configure commitlint to use loanmarket commits messages style config
// commitlint.config.js
module.exports = {
  plugins: ['commitlint-plugin-loanmarket'],
  rules: {
      "jira-task-id-match": [2, "always"],
      "jira-subject-match": [2, "never"]
  }
}
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

jira-task-id-match - this rule check if commit message task id matches the jira id.

If this rule was set to always refer below for the example

// ❌ Bad commit messages
git commit -m "My commit message body"
git commit -m ":My commit message body"
// ✅ Good commit messages
git commit -m "CRM-2121, CRM-21: My commit message body"
git commit -m "CRM-1234: My commit message body"

jira-subject-empty - this rule check if subject should be empty

If this rule was set to never refer below for the example

// ❌ Bad commit messages
git commit -m "CRM-123:"
// ✅ Good commit messages
git commit -m "CRM-2121, CRM-21: My commit message body"
git commit -m "CRM-1234: My commit message body"

Author

Authored and maintained by Junrill Galvez