Commitlint
Prerequisites:
Install Commitlint
Configure Commitlint
Use the config file extension that matches your repo:
If your repo is ESM (
"type": "module"), use.commitlintrc.js.Otherwise, use
.commitlintrc.mjs.
Create .commitlintrc.js (ESM):
Options
Export | Type | Use when | Notes |
|---|---|---|---|
| object | Default commit message policy | This is what our repos use by default. |
| object | Same as above | Alias of |
| object | You want PR/issues references required | Adds |
Rules enforced (summary)
Rule | Value |
|---|---|
Header max length |
|
Body max line length |
|
Allowed |
|
Allowed |
|
Add scripts
Troubleshooting
Using
.commitlintrc.cjs: this package is ESM, so CJS requires a dynamic import. Don’t do that unless you have no choice.