commitlint-plugin-issue-driven-dev
v1.0.7
Published
commitlint-plugin-issue-driven-dev checks if the commit message meets the commit format for issue driven development.
Downloads
14
Readme
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
- Create an issue🙏
- Please fork it.
- Create your feature branch:
git checkout -b feat/{issue number}
- Commit your changes:
git commit -m '{type}: #{issue number} some feature'
- Push to the branch:
git push origin feat/{issue number}
- Submit a pull request
Author
Shoki Hata(sho-hata)Released under the MIT License.