Skip to content

Commitlint

See the official documentation.

Terminal window
npm i -D @commitlint/cli @commitlint/config-conventional

These are basic .commitlintrc.json settings.

.commitlintrc.json
{
"$schema": "https://json.schemastore.org/commitlintrc.json",
"extends": ["@commitlint/config-conventional"]
}

Commitlint checks if your commit messages meet the conventional commit format.

Example of valid commit messages:

feat: add new feature
fix: resolve bug in component
docs: update README
chore: update dependencies
style: format code

When configured with husky’s commit-msg hook, it will automatically validate commit messages:

.husky/commit-msg
npx --no -- commitlint --edit $1