mirror of
https://github.com/wagoid/commitlint-github-action.git
synced 2025-11-07 08:06:54 +00:00
Some packages were updated to versions that now use ECMAScript modules, so this repo was updated to use ES modules using Node.js built-in support. Update was done using the great guide from @sindresorhus: https://gist.github.com/sindresorhus/a39789f98801d908bbc7ff3ecc99d99c
28 lines
778 B
JavaScript
28 lines
778 B
JavaScript
/* eslint-disable import/no-extraneous-dependencies */
|
|
const { maxLineLength } = require('@commitlint/ensure')
|
|
|
|
const bodyMaxLineLength = 100
|
|
|
|
const validateBodyMaxLengthIgnoringDeps = (parsedCommit) => {
|
|
const { type, scope, body } = parsedCommit
|
|
const isDepsCommit =
|
|
type === 'chore' && (scope === 'deps' || scope === 'deps-dev')
|
|
|
|
return [
|
|
isDepsCommit || !body || maxLineLength(body, bodyMaxLineLength),
|
|
`body's lines must not be longer than ${bodyMaxLineLength}`,
|
|
]
|
|
}
|
|
|
|
module.exports = {
|
|
extends: ['@commitlint/config-conventional'],
|
|
plugins: ['commitlint-plugin-function-rules'],
|
|
rules: {
|
|
'body-max-line-length': [0],
|
|
'function-rules/body-max-line-length': [
|
|
2,
|
|
'always',
|
|
validateBodyMaxLengthIgnoringDeps,
|
|
],
|
|
},
|
|
}
|