commitlint-plugin-issue-driven-dev
TypeScript icon, indicating that this package has built-in type declarations

1.0.7 • Public • Published

commitlint-plugin-issue-driven-dev

commitlint-plugin-issue-driven-dev checks if the commit message meets the commit format for issue driven development.

Getting started

Install dependencies

npm

npm install -D commitlint-plugin-issue-driven-dev @commitlint/{cli,config-conventional} husky

yarn

yarn add -D commitlint-plugin-issue-driven-dev @commitlint/{cli,config-conventional} husky

Configure commitlint to use issue driven development commits messages style config

// commitlint.config.js
module.exports = {
  extends: ['@commitlint/config-conventional'],
+ plugins: ['issue-driven-dev'],
+ rules: {
+   'subject-issue-number-empty-rule': [2, 'always'],
+ },
}

To lint commits before they are created you can use Husky's 'commit-msg' hook

npx husky install && npx husky add .husky/commit-msg 'npx --no-install commitlint --edit "$1"'

Rules

subject-issue-number-empty-rule - This rule checks if the commit message matches the specified pattern.

{type}: #{issue number} {subject}

// The commit message should be in the following format: "{type}: #{issue number} {subject}"
// ❌ Bad commit messages
git commit -m "add: My commit message body"
git commit -m "add: #foo My commit message body"
git commit -m "update: #2My commit message body"
// ✅ Good commit messages
git commit -m "add: #1 My commit message body"
git commit -m "update: #25 My commit message body"

Contributing

  1. Create an issue🙏
  2. Please fork it.
  3. Create your feature branch: git checkout -b feat/{issue number}
  4. Commit your changes: git commit -m '{type}: #{issue number} some feature'
  5. Push to the branch: git push origin feat/{issue number}
  6. Submit a pull request

Author

Shoki Hata(sho-hata)Released under the MIT License.

Package Sidebar

Install

npm i commitlint-plugin-issue-driven-dev

Weekly Downloads

1

Version

1.0.7

License

MIT

Unpacked Size

5.49 kB

Total Files

8

Last publish

Collaborators

  • sho-hata