@dgc-org/commitlint-config-conventional-changelog-for-jira
Shareable commitlint
config enforcing the Angular commit convention and Jira Smart Commit Syntax. Based on @commitlint/config-angular.
Use with @dgc-org/cz-conventional-changelog-for-jira, @commitlint/cli.
Getting started
npm install --save-dev @dgc-org/commitlint-config-conventional-changelog-for-jira @commitlint/cli
echo "module.exports = {extends: ['@dgc-org/commitlint-config-conventional-changelog-for-jira']};" > commitlint.config.js
Disabling commitlint
In some cases it might be useful to be able to skip linting, e.g. when lacking access to Jira or having to do nasty things in GitOps. This configuration skips the linting process altogether if either of these conditions are satisfied:
- Commit message starts with
WIP:
, e.g.WIP: the office is burning down, need to save my work
- Environment variable
COMMITLINT_DISABLE
is set totrue
(case-insensitive) or1
This mechanism should only be used in situations where there's no alternative to it, rather than to ignore fixable validation failures.
Rules
Problems
The following rules are considered problems for @dgc-org/commitlint-config-conventional-changelog-for-jira
and will yield a non-zero exit code when not met.
Consult docs/rules for a list of available rules.
type-enum
-
condition:
type
is found in value -
rule:
always
- value
[
"feat",
"fix",
"docs",
"refactor",
"test",
"style",
"build",
"ci",
"chore",
"revert",
"perf",
"wip",
]
echo "foo: some message" # fails
echo "fix: some message" # passes
type-case
-
description:
type
is in casevalue
-
rule:
always
- value
'lowerCase'
echo "FIX: some message" # fails
echo "fix: some message" # passes
type-empty
-
condition:
type
is empty -
rule:
never
echo ": some message" # fails
echo "fix: some message" # passes
scope-case
-
condition:
scope
is in casevalue
-
rule:
always
'lowerCase'
echo "fix(SCOPE): some message" # fails
echo "fix(scope): some message" # passes
subject-case
-
condition:
subject
is in one of the cases['sentence-case', 'start-case', 'pascal-case', 'upper-case']
-
rule:
never
echo "fix(SCOPE): Some message" # fails
echo "fix(SCOPE): Some Message" # fails
echo "fix(SCOPE): SomeMessage" # fails
echo "fix(SCOPE): SOMEMESSAGE" # fails
echo "fix(scope): some message" # passes
echo "fix(scope): some Message" # passes
subject-empty
-
condition:
subject
is empty -
rule:
never
echo "fix:" # fails
echo "fix: some message" # passes
subject-full-stop
-
condition:
subject
ends withvalue
-
rule:
never
- value
'.'
echo "fix: some message." # fails
echo "fix: some message" # passes
header-max-length
-
condition:
header
hasvalue
or less characters -
rule:
always
- value
72
echo "fix: some message that is way too long and breaks the line max-length by several characters" # fails
echo "fix: some message" # passes
Warnings
The following rules are considered warnings for @dgc-org/commitlint-config-conventional-changelog-for-jira
and will print warning messages when not met.
body-leading-blank
- condition: Body begins with blank line
-
rule:
always