commitlint-config
The shareable commitlint config we use at Logical.
Table of Contents
Convention
- A commit type is always lowercased and must be provided at all-time.
- We use Gitmojis as commit types.
- The scope is optional but must be lowercased if used.
- Like a sentence: a commit subject must be capitalized and ends with a period.
- The message body and footer should start with a leading blank line.
- A line can't exceed 100 characters.
Getting Started
Install the development dependency:
yarn add -D @logicalhq/commitlint-config
And simply add a .commitlintrc.js
file at the project root:
module.exports = {
extends: ['@logicalhq/commitlint-config']
};
Examples
git commit -m ":tada: Initial commit." # passes
git commit -m ":sparkles:(ci) Set-up GitHub actions." # passes
git commit -m ":bento: Fix assets (logo). [#123]" # passes
git commit -m "Initial commit." # fails: no commit type.
git commit -m ":tada: Initial commit" # fails: no full-stop.
git commit -m ":unkown: Initial commit." # fails: that gitmoji doesn't exists.
Extending the rules
This convention can be extended to fit a project needs (i.e: specifying scopes):
// .commitlintrc.js
module.exports = {
extends: ['@logicalhq/commitlint-config'],
rules: {
'scope-enum': [
2,
'always',
[
'ci',
'security',
'auth',
'billing'
// ...
]
]
}
};
License
This project and Carlos Cuesta's Gitmojis are licensed under MIT.