-
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcommitlint.config.mjs
More file actions
24 lines (22 loc) · 840 Bytes
/
Copy pathcommitlint.config.mjs
File metadata and controls
24 lines (22 loc) · 840 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
const DEPENDABOT = /Signed-off-by: dependabot\[bot\]/
const HUMAN_LIMIT = 200
const DEPENDABOT_LIMIT = 400
const bodyMaxLineLength = (parsed) => {
const isDependabot = DEPENDABOT.test(parsed?.raw ?? '')
const limit = isDependabot ? DEPENDABOT_LIMIT : HUMAN_LIMIT
const body = parsed?.body
if (!body) return [true]
const ok = body.split(/\r?\n/).every(
(line) => line.length <= limit || /https?:\/\/\S+/.test(line)
)
return [ok, `body's lines must not be longer than ${limit} characters`]
}
export default {
extends: ['@commitlint/config-conventional'],
plugins: ['commitlint-plugin-function-rules'],
rules: {
'subject-case': [2, 'never', ['upper-case']],
'body-max-line-length': [0],
'function-rules/body-max-line-length': [2, 'always', bodyMaxLineLength],
},
}