The purpose of commitlint
is to lint commit messages and make sure they adhere to conventional commit standards.
Acceptable format examples are:
type(scope?): subject
fix(package): fix bug in package
chore(eslint-config): add new rule
chore: fix the monorepo ci job
commitlint
is used locally only as a first prevention of errors. The CI will also catch these errors in a job run in Code checks where the wagoid/commitlint-github-action@v4
job is used.
Checking locally improves developer experience as it provides quick feedback on mistakes
-
Add workspace reference to
@muravjev/configs-commitlint
and its peer dependencies:pnpm add -w @commitlint/cli -D
-
Add commitlint configuration file:
// .commitlintrc.js module.exports = require('@commitlint/config-conventional');
- Setup ➡ husky to schedule
commitlint
execution on commit.
- Automatic validation of commit message with
commitlint
on commit.
In case of invalid message, commit will be rejected.