This repository was archived by the owner on Mar 17, 2026. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathcommitlint.config.mjs
More file actions
52 lines (52 loc) · 1.3 KB
/
commitlint.config.mjs
File metadata and controls
52 lines (52 loc) · 1.3 KB
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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
export default {
extends: ["@commitlint/config-conventional"],
plugins: [
{
rules: {
"scope-empty-for-type": (
parsed,
when = "always",
allowed = ["docs", "ci", "chore"]
) => {
const { type, scope } = parsed ?? {};
const isEmpty = !scope;
const allowEmptyForType = allowed.includes(type);
// When = "always": require scope for non-allowed types. "never" would disable requirement.
const requireScope = when !== "never" && !allowEmptyForType;
const pass = requireScope ? !isEmpty : true;
return [
pass,
pass ? undefined : `scope is required for type '${type}'`,
];
},
},
},
],
rules: {
"type-enum": [
2,
"always",
[
"feat",
"fix",
"docs",
"refactor",
"perf",
"test",
"ci",
"chore",
"revert",
],
],
"scope-enum": [
2,
"always",
["cli", "client", "server", "runtime", "engines", "proto", "deps"],
],
"scope-empty-for-type": [2, "always", ["docs", "ci", "chore"]],
// Disable line length restrictions
"body-max-line-length": [0],
"footer-max-line-length": [0],
"header-max-length": [0],
},
};