lint commit messages with danger and commitlint
npm install danger-plugin-conventional-commitlint



A danger plugin to lint commit messages with commitlint
Install:
``sh`
npm install --save-dev danger-plugin-conventional-commitlint
At a glance:
`js
// dangerfile.js
import commitlint from 'danger-plugin-conventional-commitlint';
import configConventional from '@commitlint/config-conventional';
(async function dangerReport() {
const commitlintConfig = {
severity: 'warn',
};
await commitlint(configConventional.rules, commitlintConfig);
})();
`
> Note: you must provide your own rules to the function
commitlint([rules], [options])
#### severity
Type: String'fail' | 'warn' | 'message'
Choices: 'fail'
Default:
Danger method to call when the commit message does not pass the linter
---
#### messageReplacer
Type:
`ts`
(ruleOutcome: LintOutcome, commitMessage: string) => string;
Default:
``
There is a problem with the commit message > [Commit message] - [Error Messages]
Method to add a custom message. When not passed, a default message is shown.
Example:
`ts
const messageReplacer = (
ruleOutcome: LintOutcome,
commitMessage: string,
): string => {
const errorsDescription = ruleOutcome.errors
.map((error) =>
)
.join(''); return
Commit message: "${commitMessage}"
;
};
``See the GitHub release history.
See CONTRIBUTING.md.