Package Exports
- commitlint-config-emoji-convention
- commitlint-config-emoji-convention/index.js
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (commitlint-config-emoji-convention) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
commitlint-config-emoji-convention
Shareable commitlint configuration that enforces conventional commits and adds emoji support. Use with commitlint.
Getting Started
npm install --save-dev @commitlint/cli commitlint-config-emoji-convention
echo "export default { extends: ['emoji-convention'] }" > commitlint.config.js
The official commitlint documentation recommends using Husky to validate commit messages.
npm install --save-dev husky
npx husky init
echo "npx --no -- commitlint --edit \$1" > .husky/commit-msg
The above configuration will validate commit messages, but requires manual emoji inclusion. To automatically prepend emojis based on commit prefixes, perform the following steps:
touch .husky/prepare-commit-msg
Add the following script:
msg=$(cat "$1")
msg=$(echo $msg | sed -e "s/^init/🎉 init/")
msg=$(echo $msg | sed -e "s/^feat/✨ feat/")
msg=$(echo $msg | sed -e "s/^fix/🐛 fix/")
msg=$(echo $msg | sed -e "s/^docs/📚 docs/")
msg=$(echo $msg | sed -e "s/^style/💎 style/")
msg=$(echo $msg | sed -e "s/^refactor/📦 refactor/")
msg=$(echo $msg | sed -e "s/^perf/🚀 perf/")
msg=$(echo $msg | sed -e "s/^test/🚨 test/")
msg=$(echo $msg | sed -e "s/^build/🛠 build/")
msg=$(echo $msg | sed -e "s/^ci/⚙️ ci/")
msg=$(echo $msg | sed -e "s/^chore/♻️ chore/")
msg=$(echo $msg | sed -e "s/^revert/🗑 revert/")
echo $msg > $1
Format
<emoji> <type>(<scope>): <subject>
<BLANK LINE>
<body>
<BLANK LINE>
<footer>
Examples
✨ feat(blog): add comment section
🐛 fix: resolve null pointer exception
📚 docs(README): add contribution guidelines
- Added code of conduct
- Updated PR template
Issue: #123
Rules
Commit message rules follow the Conventional Commits specification.
Supported commit types:
- 🎉 init: Project initialization
- ✨ feat: A new feature
- 🐛 fix: A bug fix
- 📚 docs: Documentation only changes
- 💎 style: Changes that do not affect the meaning of the code (white-space, formatting, missing semi-colons, etc)
- 📦 refactor: A code change that neither fixes a bug nor adds a feature
- 🚀 perf: A code change that improves performance
- 🚨 test: Adding missing tests or correcting existing tests
- 🛠 build: Changes that affect the build system or external dependencies (example scopes: gulp, broccoli, npm)
- ⚙️ ci: Changes to our CI configuration files and scripts (example scopes: Travis, Circle, BrowserStack, SauceLabs)
- ♻️ chore: Other changes that don't modify src or test files
- 🗑 revert: Reverts a previous commit
Credits
- The initial inspiration for this project was commitlint-config-git-commit-emoji, including the
parserPreset
configuration and README structure - Emoji list and rules sourced from @commitlint/config-conventional
- The
prepare-commit-msg
hook script was adapted from Hubert Olender's gist
License
MIT © João Vitor