forked from tsedio/tsed
-
Notifications
You must be signed in to change notification settings - Fork 0
/
commitlint.config.mjs
33 lines (29 loc) · 942 Bytes
/
commitlint.config.mjs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
import globby from "globby";
import {basename} from "node:path";
import pkg from "./package.json" assert {type: "json"};
import {RuleConfigSeverity} from "@commitlint/types";
function findPackages() {
const patterns = pkg.workspaces.packages.map((pkgPattern) => {
return `${pkgPattern}/package.json`;
});
let pkgs = globby.sync(patterns, {
cwd: process.cwd(),
});
return pkgs.map((pkg) => {
return basename(pkg.replace("/package.json", ""));
});
}
export default {
extends: ["@commitlint/config-conventional"],
rules: {
"scope-enum": [RuleConfigSeverity.Error, "always", findPackages()],
"header-max-length": [0, "always", 120]
},
ignores: [
(message) =>
message.includes("[skip ci]") ||
!!message.match(
/^((feat|fix|hotfix|tech|bugfix)\/(([0-9]+)\.?)+(\.[a-zA-Z]+)+) \(#+([0-9]+)\)/g // merge commits (matching a branch name, eg. 'feat/999.bla.bla (#123)')
)
]
};