From 860772db5c48c69c3f3271e0b8ee48b00ce8ba4b Mon Sep 17 00:00:00 2001 From: Micah Abbott Date: Wed, 28 Feb 2024 10:32:58 -0500 Subject: [PATCH] chore: fix require error with commitlint Changed the commitlint config file to use a dynamic import of `commitlint/esnure` and updated the function to await the promise of the import. (This code was generated by ChatGPT and appears to fix the error with using `require('@commitlint/ensure')`) Closes: #633 Signed-off-by: Micah Abbott --- .github/commitlint.config.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/commitlint.config.js b/.github/commitlint.config.js index 56ca8dac5..996cfff08 100644 --- a/.github/commitlint.config.js +++ b/.github/commitlint.config.js @@ -1,15 +1,15 @@ /* eslint-disable import/no-extraneous-dependencies */ -const { maxLineLength } = require('@commitlint/ensure') +const validateBodyMaxLengthIgnoringDeps = async (parsedCommit) => { + const { maxLineLength } = await import('@commitlint/ensure'); -const bodyMaxLineLength = 100 - -const validateBodyMaxLengthIgnoringDeps = (parsedCommit) => { const { type, scope, body } = parsedCommit const isDepsCommit = type === 'chore' && body != null && body.includes('Updates the requirements on'); + const bodyMaxLineLength = 100; + return [ isDepsCommit || !body || maxLineLength(body, bodyMaxLineLength), `body's lines must not be longer than ${bodyMaxLineLength}`,