1.0.0 • Published 5 years ago

commitlint-activecollab-utils v1.0.0

Weekly downloads
5
License
MIT
Repository
github
Last release
5 years ago

commitlint-activecollab-utils

A set of utils for commitlint-activecollab package. Part of commitlint-activecollab monorepo.

Getting started.

Install dependencies
// npm

$ npm install --save-dev @commitlint/cli commitlint-plugin-activecollab-rules commitlint-config-activecollab

// yarn

$ yarn add --dev @commitlint/cli commitlint-plugin-activecollab-rules commitlint-config-activecollab
Configure commitlint to use Active Collab commits messages style config
// commitlint.config.js

module.exports = {
  plugins: ['commitlint-plugin-activecollab-rules'],
  extends: ['activecollab'],
}
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

activecollab-task-id-empty - this rule check if commit message task id is not empty.

// If your task do not have an id use a conventional task id e.g: #42
// ❌ Bad commit messages
$ git commit -m "My commit message body"
$ git commit -m ": My commit message body"
// ✅ Good commit messages
$ git commit -m "#42: My commit message body"

activecollab-task-id-max-length - this rule check if Active Collab task id length is longer that the provided value.

// Preconfigured and recommended value in commitlint-config-activecollab is 5 chars
// ❌ Bad commit messages
$ git commit -m "#10101010101: My commit message body"
// ✅ Good commit messages
$ git commit -m "#42: My commit message body"
$ git commit -m "#101: My commit message body"

activecollab-task-id-min-length - this rule check if Active Collab task id length is shorter that the provided value.

// Preconfigured and recommended value in commitlint-config-activecollab is 1 chars
// ❌ Bad commit messages
$ git commit -m "#: My commit message body"
// ✅ Good commit messages
$ git commit -m "#42: My commit message body"
$ git commit -m "#101: My commit message body"

activecollab-task-id-pattern - this rule check if task ID header and footer is separated with provided value.

// Preconfigured and recommended value in commitlint-config-activecollab is "-"
// ❌ Bad commit messages
$ git commit -m "42 :My commit message body"
$ git commit -m "#-42: My commit message body"
$ git commit -m "# 42: My commit message body"
// ✅ Good commit messages
$ git commit -m "#42: My commit message body"
$ git commit -m "#42: My commit message body"

activecollab-commit-message-separator - this rule check if commit message separator match provided separator.

// Preconfigured and recomended value in commitlint-config-activecollab is ":"
// ❌ Bad commit messages
$ git commit -m "#42/ My commit message body"
$ git commit -m "#42 - My commit message body"
$ git commit -m "#42 My commit message body"
// ✅ Good commit messages
$ git commit -m "#42: My commit message body"

activecollab-commit-status-case - this rule check if commit status is in provided case.

// Preconfigured and recomended value in commitlint-config-activecollab is "uppercase"
// ❌ Bad commit messages
$ git commit -m "[wip]#42: My commit message body"
// ✅ Good commit messages
$ git commit -m "[WIP]#42: My commit message body"

activecollab-commit-message-case - this rule check if commit message is in provided case.

// Preconfigured and recomended value in commitlint-config-activecollab is "uppercase"
// ❌ Bad commit messages
$ git commit -m "#42: my commit message body"
$ git commit -m "#42: MY COMMIT MESSAGE BODY"
// ✅ Good commit messages
$ git commit -m "#42: My commit message body"

Customise/Override commitlint-activecollab-config rules

// commitlint.config.js
module.exports = {
  plugins: ['commitlint-plugin-activecollab-rules'],
  extends: ['activecollab'],
  rules: {
  // to Customise/Override a rule
+  'activecollab-task-id-max-length': [2, 'always', 10]
  // to turn off a rule
+ 'activecollab-task-id-max-length': 0
  },
}

Author

@Rushelex/commitlint-activecollab © Rushelex, Released under the MIT License.\

The project uses the work of user Gherciu and his project commitlint-jira.