From e3a13fe30942f5cbeb16e91452bc318e0cbfc74a Mon Sep 17 00:00:00 2001 From: Johan Seto K <51926076+johanseto@users.noreply.github.com> Date: Tue, 19 Dec 2023 18:20:37 -0500 Subject: [PATCH] feat: add openedx commitlint.config.js This adds openedx commit lintern rules. This is inspired by the following PR: https://github.com/eduNEXT/shipyard-infrastructure/pull/25/files This fixes the footer long chars error. This is mostly based on: https://github.com/openedx/edx-lint/blob/master/commitlint.config.js In particular, limiting the length of a line in the commit body might be detrimental when including external links. --- commitlint.config.js | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 commitlint.config.js diff --git a/commitlint.config.js b/commitlint.config.js new file mode 100644 index 00000000..4726bbe1 --- /dev/null +++ b/commitlint.config.js @@ -0,0 +1,32 @@ +// See: https://commitlint.js.org/#/reference-configuration for details +// on the configuration file +module.exports = { + extends: ['@commitlint/config-conventional'], + + rules: { + 'type-enum': + [2, 'always', [ + 'revert', 'feat', 'fix', 'perf', 'docs', 'test', 'build', 'refactor', 'style', 'chore', 'temp', 'ci', + ]], + + // Default rules we want to suppress. The available list of rules can be + // found in https://commitlint.js.org/#/reference-rules + 'body-leading-blank': [0, "always"], + 'body-max-line-length': [0, "always"], + 'footer-max-line-length': [0, "always"], + 'footer-leading-blank': [0, "always"], + 'subject-case': [0, "always", []], + 'subject-full-stop': [0, "never", '.'], + }, + + ignores: [ + // Allow GitHub revert messages, like: + // Revert "introduce a bug" + // Revert "introduce a bug" (#1234) + message => /^Revert ".*"( \(#\d+\))?/.test(message), + + // BTW: commitlint has a built-in list of ignores which are also applied. + // Those include the typical "Merged" messages, so those are implicitly ignored: + // https://github.com/conventional-changelog/commitlint/blob/master/%40commitlint/is-ignored/src/defaults.ts + ], +};