Skip to content

Commit

Permalink
add the README file
Browse files Browse the repository at this point in the history
  • Loading branch information
MinhTrung2031997 committed Jun 24, 2023
1 parent a192cd0 commit 335e051
Showing 1 changed file with 76 additions and 0 deletions.
76 changes: 76 additions & 0 deletions packages/commitlint-plugin-jira-rules/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
<div align="center">
<img width="300" height="200"
src="https://raw.githubusercontent.com/Gherciu/commitlint-jira/master/logo.png">
<h1>commitlint-plugin-shr-jira</h1>
<p>A plugin that implement all jira commits messages style rules and validate commit messages. Part of <a href="https://github.com/MinhTrung2031997/commitlint-plugin">commitlint-plugin</a> monorepo.</p>
</div>

For Tips and [Advanced Usage](https://javascript.plainenglish.io/how-to-write-correct-jira-commit-messages-d9910f332273) you can read this [Blog Post](https://javascript.plainenglish.io/how-to-write-correct-jira-commit-messages-d9910f332273)

## Getting started.

##### Install dependencies

```bash
npm install --save-dev @commitlint/cli commitlint-config-jira-jquery commitlint-plugin-shr-jira
```

- [commitlint-config-jira-jquery](https://github.com/MinhTrung2031997/commitlint-plugin/tree/master/packages/commitlint-config-jira) - is a **recomended** config who contain preconfigured rules for jira commits messages style. See all rules in description below
- [commitlint-plugin-shr-jira](https://github.com/MinhTrung2031997/commitlint-plugin/tree/master/packages/commitlint-plugin-jira-rules) - is a plugin that implement all jira commits messages style rules and validate commit messages

##### Configure commitlint to use jira commits messages style config

```js
// 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

```json
// package.json
{
"husky": {
"hooks": {
"commit-msg": "commitlint -E HUSKY_GIT_PARAMS"
}
}
}
```

## Rules
```bash
// <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]: short, meaningful, imperative mood, 60-character long, no capitalization, no ending dot (.)

## Examples

```bash
// If your task do not have an id use a conventional task id e.g: IB-0000
// ❌ 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"
```






0 comments on commit 335e051

Please sign in to comment.