Skip to content

Commit

Permalink
chore: update commitlint configuration
Browse files Browse the repository at this point in the history
This config has changed in v6.x.
  • Loading branch information
smlx committed Apr 12, 2024
1 parent 2a7e123 commit b698d43
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 16 deletions.
15 changes: 0 additions & 15 deletions .github/commitlint.config.js

This file was deleted.

29 changes: 29 additions & 0 deletions .github/commitlint.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
/* Taken from: https://github.com/wagoid/commitlint-github-action/blob/7f0a61df502599e1f1f50880aaa7ec1e2c0592f2/commitlint.config.mjs */
/* eslint-disable import/no-extraneous-dependencies */
import { maxLineLength } from '@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}`,
]
}

export default {
extends: ['@commitlint/config-conventional'],
plugins: ['commitlint-plugin-function-rules'],
rules: {
'body-max-line-length': [0],
'function-rules/body-max-line-length': [
2,
'always',
validateBodyMaxLengthIgnoringDeps,
],
},
}
2 changes: 1 addition & 1 deletion .github/workflows/lint.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ jobs:
fetch-depth: 0
- uses: wagoid/commitlint-github-action@3c75220e8d20774b68eea48e869a706ff7249b54 # v6.0.0
with:
configFile: .github/commitlint.config.js
configFile: .github/commitlint.config.mjs
lint-actions:
permissions:
contents: read
Expand Down

0 comments on commit b698d43

Please sign in to comment.