@icebreakers/commitlint-config 1.1.0 → 1.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +67 -0
- package/dist/index.cjs +166 -332
- package/dist/index.d.cts +25 -57
- package/dist/index.d.ts +25 -57
- package/dist/index.mjs +167 -333
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -1,112 +1,23 @@
|
|
|
1
|
-
// src/
|
|
2
|
-
import
|
|
3
|
-
RuleConfigSeverity
|
|
4
|
-
} from "@commitlint/types";
|
|
1
|
+
// src/builders.ts
|
|
2
|
+
import conventionalConfig from "@commitlint/config-conventional";
|
|
5
3
|
|
|
6
|
-
// src/
|
|
7
|
-
|
|
8
|
-
var DEFAULT_HEADER_MAX_LENGTH = 100;
|
|
9
|
-
var DEFAULT_BODY_MAX_LINE_LENGTH = 100;
|
|
10
|
-
var DEFAULT_FOOTER_MAX_LINE_LENGTH = 100;
|
|
11
|
-
var DEFAULT_FULL_STOP = ".";
|
|
12
|
-
var DEFAULT_SUBJECT_FORBIDDEN_CASES = [
|
|
13
|
-
"sentence-case",
|
|
14
|
-
"start-case",
|
|
15
|
-
"pascal-case",
|
|
16
|
-
"upper-case"
|
|
17
|
-
];
|
|
18
|
-
var DEFAULT_COMMIT_TYPES = [
|
|
19
|
-
{
|
|
20
|
-
value: "build",
|
|
21
|
-
title: "Builds",
|
|
22
|
-
description: "Changes that affect the build system or external dependencies (example scopes: pnpm, webpack, docker)",
|
|
23
|
-
emoji: "\u{1F6E0}"
|
|
24
|
-
},
|
|
25
|
-
{
|
|
26
|
-
value: "chore",
|
|
27
|
-
title: "Chores",
|
|
28
|
-
description: "Other changes that don't modify src or test files",
|
|
29
|
-
emoji: "\u267B\uFE0F"
|
|
30
|
-
},
|
|
31
|
-
{
|
|
32
|
-
value: "ci",
|
|
33
|
-
title: "Continuous Integrations",
|
|
34
|
-
description: "Changes to our CI configuration files and scripts (example scopes: GitHub Actions, Travis, Circle)",
|
|
35
|
-
emoji: "\u2699\uFE0F"
|
|
36
|
-
},
|
|
37
|
-
{
|
|
38
|
-
value: "docs",
|
|
39
|
-
title: "Documentation",
|
|
40
|
-
description: "Documentation only changes",
|
|
41
|
-
emoji: "\u{1F4DA}"
|
|
42
|
-
},
|
|
43
|
-
{
|
|
44
|
-
value: "feat",
|
|
45
|
-
title: "Features",
|
|
46
|
-
description: "A new feature",
|
|
47
|
-
emoji: "\u2728"
|
|
48
|
-
},
|
|
49
|
-
{
|
|
50
|
-
value: "fix",
|
|
51
|
-
title: "Bug Fixes",
|
|
52
|
-
description: "A bug fix",
|
|
53
|
-
emoji: "\u{1F41B}"
|
|
54
|
-
},
|
|
55
|
-
{
|
|
56
|
-
value: "perf",
|
|
57
|
-
title: "Performance Improvements",
|
|
58
|
-
description: "A code change that improves performance",
|
|
59
|
-
emoji: "\u{1F680}"
|
|
60
|
-
},
|
|
61
|
-
{
|
|
62
|
-
value: "refactor",
|
|
63
|
-
title: "Code Refactoring",
|
|
64
|
-
description: "A code change that neither fixes a bug nor adds a feature",
|
|
65
|
-
emoji: "\u{1F4E6}"
|
|
66
|
-
},
|
|
67
|
-
{
|
|
68
|
-
value: "revert",
|
|
69
|
-
title: "Reverts",
|
|
70
|
-
description: "Reverts a previous commit",
|
|
71
|
-
emoji: "\u{1F5D1}"
|
|
72
|
-
},
|
|
73
|
-
{
|
|
74
|
-
value: "style",
|
|
75
|
-
title: "Styles",
|
|
76
|
-
description: "Changes that do not affect the meaning of the code (white-space, formatting, missing semi-colons, etc)",
|
|
77
|
-
emoji: "\u{1F48E}"
|
|
78
|
-
},
|
|
79
|
-
{
|
|
80
|
-
value: "test",
|
|
81
|
-
title: "Tests",
|
|
82
|
-
description: "Adding missing tests or correcting existing tests",
|
|
83
|
-
emoji: "\u{1F6A8}"
|
|
84
|
-
}
|
|
85
|
-
];
|
|
86
|
-
var DEFAULT_TYPES = DEFAULT_COMMIT_TYPES.map((type) => type.value);
|
|
87
|
-
var DEFAULT_PROMPT_SCOPE_DESCRIPTION = "What is the scope of this change (e.g. component or file name)";
|
|
88
|
-
var DEFAULT_PROMPT_TYPE_DESCRIPTION = "Select the type of change that you're committing";
|
|
89
|
-
var DEFAULT_PROMPT_SUBJECT_DESCRIPTION = "Write a short, imperative tense description of the change";
|
|
90
|
-
var DEFAULT_PROMPT_BODY_DESCRIPTION = "Provide a longer description of the change";
|
|
91
|
-
var DEFAULT_PROMPT_IS_BREAKING_DESCRIPTION = "Are there any breaking changes?";
|
|
92
|
-
var DEFAULT_PROMPT_BREAKING_BODY_DESCRIPTION = "A BREAKING CHANGE commit requires a body. Please enter a longer description of the commit itself";
|
|
93
|
-
var DEFAULT_PROMPT_BREAKING_DESCRIPTION = "Describe the breaking changes";
|
|
94
|
-
var DEFAULT_PROMPT_IS_ISSUE_AFFECTED_DESCRIPTION = "Does this change affect any open issues?";
|
|
95
|
-
var DEFAULT_PROMPT_ISSUES_BODY_DESCRIPTION = "If issues are closed, the commit requires a body. Please enter a longer description of the commit itself";
|
|
96
|
-
var DEFAULT_PROMPT_ISSUES_DESCRIPTION = 'Add issue references (e.g. "fix #123", "re #123".)';
|
|
97
|
-
var DEFAULT_EXTENDS = ["@commitlint/config-conventional"];
|
|
4
|
+
// src/types.ts
|
|
5
|
+
import { RuleConfigSeverity } from "@commitlint/types";
|
|
98
6
|
|
|
99
7
|
// src/utils.ts
|
|
100
|
-
function
|
|
8
|
+
function asArray(value) {
|
|
101
9
|
if (value === void 0) {
|
|
102
10
|
return [];
|
|
103
11
|
}
|
|
104
12
|
return Array.isArray(value) ? value : [value];
|
|
105
13
|
}
|
|
106
|
-
function
|
|
14
|
+
function mergeUnique(values) {
|
|
107
15
|
const seen = /* @__PURE__ */ new Set();
|
|
108
16
|
const result = [];
|
|
109
17
|
for (const value of values) {
|
|
18
|
+
if (value === void 0 || value === null) {
|
|
19
|
+
continue;
|
|
20
|
+
}
|
|
110
21
|
if (!seen.has(value)) {
|
|
111
22
|
seen.add(value);
|
|
112
23
|
result.push(value);
|
|
@@ -114,279 +25,202 @@ function unique(values) {
|
|
|
114
25
|
}
|
|
115
26
|
return result;
|
|
116
27
|
}
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
28
|
+
|
|
29
|
+
// src/builders.ts
|
|
30
|
+
function resolveBaseTypeRule() {
|
|
31
|
+
const rule = conventionalConfig.rules?.["type-enum"];
|
|
32
|
+
if (Array.isArray(rule)) {
|
|
33
|
+
const severity = rule[0] ?? RuleConfigSeverity.Error;
|
|
34
|
+
const condition = rule[1] ?? "always";
|
|
35
|
+
const values = rule[2] ?? [];
|
|
36
|
+
return {
|
|
37
|
+
severity,
|
|
38
|
+
condition,
|
|
39
|
+
values: [...values]
|
|
40
|
+
};
|
|
41
|
+
}
|
|
121
42
|
return {
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
43
|
+
severity: RuleConfigSeverity.Error,
|
|
44
|
+
condition: "always",
|
|
45
|
+
values: []
|
|
125
46
|
};
|
|
126
47
|
}
|
|
127
|
-
function
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
map.set(definition.value, definition);
|
|
131
|
-
}
|
|
132
|
-
for (const definition of overrides) {
|
|
133
|
-
map.set(definition.value, definition);
|
|
48
|
+
function buildTypesConfig(options) {
|
|
49
|
+
if (!options) {
|
|
50
|
+
return {};
|
|
134
51
|
}
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
);
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
52
|
+
const baseRule = resolveBaseTypeRule();
|
|
53
|
+
const additional = mergeUnique([
|
|
54
|
+
...baseRule.values,
|
|
55
|
+
...mergeUnique(options.add ?? []),
|
|
56
|
+
...mergeUnique((options.definitions ?? []).map((definition) => definition.value))
|
|
57
|
+
]);
|
|
58
|
+
let rule;
|
|
59
|
+
if (additional.length > 0) {
|
|
60
|
+
rule = [
|
|
61
|
+
options.severity ?? baseRule.severity,
|
|
62
|
+
options.condition ?? baseRule.condition,
|
|
63
|
+
additional
|
|
64
|
+
];
|
|
65
|
+
}
|
|
66
|
+
if (!options.definitions?.length) {
|
|
67
|
+
return { rule };
|
|
68
|
+
}
|
|
69
|
+
const basePromptType = conventionalConfig.prompt?.questions?.type;
|
|
70
|
+
const mergedEnum = {
|
|
71
|
+
...basePromptType?.enum ?? {}
|
|
72
|
+
};
|
|
73
|
+
for (const definition of options.definitions) {
|
|
74
|
+
const { value, title, description, emoji } = definition;
|
|
75
|
+
mergedEnum[value] = {
|
|
76
|
+
...mergedEnum[value] ?? {},
|
|
77
|
+
title,
|
|
78
|
+
description,
|
|
79
|
+
emoji
|
|
80
|
+
};
|
|
145
81
|
}
|
|
146
|
-
const
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
continue;
|
|
155
|
-
}
|
|
156
|
-
if (Array.isArray(value)) {
|
|
157
|
-
output[key] = [...value];
|
|
158
|
-
continue;
|
|
82
|
+
const prompt = {
|
|
83
|
+
...conventionalConfig.prompt ?? {},
|
|
84
|
+
questions: {
|
|
85
|
+
...conventionalConfig.prompt?.questions ?? {},
|
|
86
|
+
type: {
|
|
87
|
+
...basePromptType ?? {},
|
|
88
|
+
enum: mergedEnum
|
|
89
|
+
}
|
|
159
90
|
}
|
|
160
|
-
|
|
161
|
-
}
|
|
162
|
-
return output;
|
|
163
|
-
}
|
|
164
|
-
function removeUndefined(value) {
|
|
165
|
-
const entries = Object.entries(value).filter(([, item]) => item !== void 0);
|
|
166
|
-
return Object.fromEntries(entries);
|
|
167
|
-
}
|
|
168
|
-
|
|
169
|
-
// src/config.ts
|
|
170
|
-
function resolveExtends(entries) {
|
|
171
|
-
if (!entries) {
|
|
172
|
-
return [...DEFAULT_EXTENDS];
|
|
173
|
-
}
|
|
174
|
-
const values = toArray(entries);
|
|
175
|
-
return unique([...DEFAULT_EXTENDS, ...values]);
|
|
91
|
+
};
|
|
92
|
+
return { rule, prompt };
|
|
176
93
|
}
|
|
177
|
-
function
|
|
178
|
-
let severity = RuleConfigSeverity.Error;
|
|
179
|
-
let condition = "always";
|
|
180
|
-
let overrides = [];
|
|
181
|
-
let values;
|
|
94
|
+
function buildScopeRules(options) {
|
|
182
95
|
if (!options) {
|
|
183
|
-
|
|
184
|
-
} else if (Array.isArray(options)) {
|
|
185
|
-
values = unique(options);
|
|
186
|
-
} else {
|
|
187
|
-
severity = options.severity ?? severity;
|
|
188
|
-
condition = options.condition ?? condition;
|
|
189
|
-
overrides = options.definitions ?? [];
|
|
190
|
-
const base = options.values ? toArray(options.values) : DEFAULT_TYPES;
|
|
191
|
-
const additions = options.add ? toArray(options.add) : [];
|
|
192
|
-
values = unique([...base, ...additions]);
|
|
96
|
+
return {};
|
|
193
97
|
}
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
98
|
+
const rules = {};
|
|
99
|
+
const severity = options.severity ?? RuleConfigSeverity.Error;
|
|
100
|
+
const scopeValues = mergeUnique(asArray(options.values));
|
|
101
|
+
if (scopeValues.length > 0) {
|
|
102
|
+
rules["scope-enum"] = [severity, "always", scopeValues];
|
|
103
|
+
}
|
|
104
|
+
if (options.required !== void 0) {
|
|
105
|
+
if (options.required) {
|
|
106
|
+
rules["scope-empty"] = [severity, "never"];
|
|
107
|
+
} else {
|
|
108
|
+
rules["scope-empty"] = [RuleConfigSeverity.Disabled];
|
|
109
|
+
}
|
|
199
110
|
}
|
|
200
|
-
const
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
);
|
|
204
|
-
return {
|
|
205
|
-
definitions,
|
|
206
|
-
rule: [severity, condition, values]
|
|
207
|
-
};
|
|
208
|
-
}
|
|
209
|
-
function asCaseArray(value) {
|
|
210
|
-
if (!value) {
|
|
211
|
-
return [];
|
|
111
|
+
const scopeCases = mergeUnique(asArray(options.case));
|
|
112
|
+
if (scopeCases.length > 0) {
|
|
113
|
+
rules["scope-case"] = [severity, "always", scopeCases];
|
|
212
114
|
}
|
|
213
|
-
return
|
|
115
|
+
return rules;
|
|
214
116
|
}
|
|
215
|
-
function
|
|
117
|
+
function buildSubjectRules(options) {
|
|
216
118
|
if (!options) {
|
|
217
119
|
return {};
|
|
218
120
|
}
|
|
219
121
|
const rules = {};
|
|
220
|
-
const
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
}
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
122
|
+
const forbiddenCases = mergeUnique(asArray(options.forbidden));
|
|
123
|
+
if (forbiddenCases.length > 0) {
|
|
124
|
+
rules["subject-case"] = [
|
|
125
|
+
options.caseSeverity ?? RuleConfigSeverity.Error,
|
|
126
|
+
options.caseCondition ?? "never",
|
|
127
|
+
forbiddenCases
|
|
128
|
+
];
|
|
129
|
+
}
|
|
130
|
+
if (options.allowEmpty !== void 0) {
|
|
131
|
+
if (options.allowEmpty) {
|
|
132
|
+
rules["subject-empty"] = [RuleConfigSeverity.Disabled];
|
|
133
|
+
} else {
|
|
134
|
+
rules["subject-empty"] = [
|
|
135
|
+
options.allowEmptySeverity ?? RuleConfigSeverity.Error,
|
|
136
|
+
"never"
|
|
137
|
+
];
|
|
138
|
+
}
|
|
233
139
|
}
|
|
234
|
-
if (
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
140
|
+
if (options.fullStop !== void 0) {
|
|
141
|
+
if (options.fullStop) {
|
|
142
|
+
rules["subject-full-stop"] = [
|
|
143
|
+
options.fullStopSeverity ?? RuleConfigSeverity.Error,
|
|
144
|
+
"always",
|
|
145
|
+
options.fullStopCharacter ?? "."
|
|
146
|
+
];
|
|
147
|
+
} else {
|
|
148
|
+
rules["subject-full-stop"] = [RuleConfigSeverity.Disabled];
|
|
239
149
|
}
|
|
240
150
|
}
|
|
241
151
|
return rules;
|
|
242
152
|
}
|
|
243
|
-
function
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
const subjectCases = forbiddenCases.length > 0 ? forbiddenCases : DEFAULT_SUBJECT_FORBIDDEN_CASES;
|
|
247
|
-
const caseSeverity = options?.caseSeverity ?? RuleConfigSeverity.Error;
|
|
248
|
-
rules["subject-case"] = [caseSeverity, "never", subjectCases];
|
|
249
|
-
if (options?.allowEmpty) {
|
|
250
|
-
rules["subject-empty"] = [RuleConfigSeverity.Disabled];
|
|
251
|
-
} else {
|
|
252
|
-
const emptySeverity = options?.emptySeverity ?? RuleConfigSeverity.Error;
|
|
253
|
-
rules["subject-empty"] = [emptySeverity, "never"];
|
|
153
|
+
function buildHeaderRules(options) {
|
|
154
|
+
if (!options) {
|
|
155
|
+
return {};
|
|
254
156
|
}
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
rules["subject-full-stop"] = [fullStopSeverity, "never", fullStop];
|
|
157
|
+
const rules = {};
|
|
158
|
+
const severity = options.severity ?? RuleConfigSeverity.Error;
|
|
159
|
+
const condition = options.condition ?? "always";
|
|
160
|
+
if (options.maxLength !== void 0) {
|
|
161
|
+
rules["header-max-length"] = [severity, condition, options.maxLength];
|
|
261
162
|
}
|
|
262
163
|
return rules;
|
|
263
164
|
}
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
"footer-max-line-length": [
|
|
281
|
-
RuleConfigSeverity.Error,
|
|
282
|
-
"always",
|
|
283
|
-
DEFAULT_FOOTER_MAX_LINE_LENGTH
|
|
284
|
-
],
|
|
285
|
-
"header-trim": [RuleConfigSeverity.Error, "always"],
|
|
286
|
-
"type-case": [RuleConfigSeverity.Error, "always", "lower-case"],
|
|
287
|
-
"type-empty": [RuleConfigSeverity.Error, "never"]
|
|
288
|
-
};
|
|
289
|
-
}
|
|
290
|
-
function buildTypeEnum(definitions) {
|
|
291
|
-
return definitions.reduce(
|
|
292
|
-
(accumulator, definition) => {
|
|
293
|
-
accumulator[definition.value] = {
|
|
294
|
-
description: definition.description,
|
|
295
|
-
title: definition.title,
|
|
296
|
-
emoji: definition.emoji
|
|
297
|
-
};
|
|
298
|
-
return accumulator;
|
|
299
|
-
},
|
|
300
|
-
{}
|
|
301
|
-
);
|
|
302
|
-
}
|
|
303
|
-
function createBasePrompt(definitions) {
|
|
165
|
+
|
|
166
|
+
// src/constants.ts
|
|
167
|
+
var DEFAULT_EXTENDS = ["@commitlint/config-conventional"];
|
|
168
|
+
var DEFAULT_PARSER_PRESET = "conventional-changelog-conventionalcommits";
|
|
169
|
+
|
|
170
|
+
// src/prompt.ts
|
|
171
|
+
function mergePrompts(base, override) {
|
|
172
|
+
if (!base && !override) {
|
|
173
|
+
return void 0;
|
|
174
|
+
}
|
|
175
|
+
if (!base) {
|
|
176
|
+
return override;
|
|
177
|
+
}
|
|
178
|
+
if (!override) {
|
|
179
|
+
return base;
|
|
180
|
+
}
|
|
304
181
|
return {
|
|
182
|
+
...base,
|
|
183
|
+
...override,
|
|
305
184
|
questions: {
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
enum: buildTypeEnum(definitions)
|
|
309
|
-
},
|
|
310
|
-
scope: {
|
|
311
|
-
description: DEFAULT_PROMPT_SCOPE_DESCRIPTION
|
|
312
|
-
},
|
|
313
|
-
subject: {
|
|
314
|
-
description: DEFAULT_PROMPT_SUBJECT_DESCRIPTION
|
|
315
|
-
},
|
|
316
|
-
body: {
|
|
317
|
-
description: DEFAULT_PROMPT_BODY_DESCRIPTION
|
|
318
|
-
},
|
|
319
|
-
isBreaking: {
|
|
320
|
-
description: DEFAULT_PROMPT_IS_BREAKING_DESCRIPTION
|
|
321
|
-
},
|
|
322
|
-
breakingBody: {
|
|
323
|
-
description: DEFAULT_PROMPT_BREAKING_BODY_DESCRIPTION
|
|
324
|
-
},
|
|
325
|
-
breaking: {
|
|
326
|
-
description: DEFAULT_PROMPT_BREAKING_DESCRIPTION
|
|
327
|
-
},
|
|
328
|
-
isIssueAffected: {
|
|
329
|
-
description: DEFAULT_PROMPT_IS_ISSUE_AFFECTED_DESCRIPTION
|
|
330
|
-
},
|
|
331
|
-
issuesBody: {
|
|
332
|
-
description: DEFAULT_PROMPT_ISSUES_BODY_DESCRIPTION
|
|
333
|
-
},
|
|
334
|
-
issues: {
|
|
335
|
-
description: DEFAULT_PROMPT_ISSUES_DESCRIPTION
|
|
336
|
-
}
|
|
185
|
+
...base.questions ?? {},
|
|
186
|
+
...override.questions ?? {}
|
|
337
187
|
}
|
|
338
188
|
};
|
|
339
189
|
}
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
return mergeDeep(base, overrides);
|
|
343
|
-
}
|
|
190
|
+
|
|
191
|
+
// src/index.ts
|
|
344
192
|
function createIcebreakerCommitlintConfig(options = {}) {
|
|
345
|
-
const
|
|
346
|
-
const
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
const baseRules = createBaseRules();
|
|
193
|
+
const { types, scopes, subject, header } = options;
|
|
194
|
+
const extendsList = mergeUnique([
|
|
195
|
+
...DEFAULT_EXTENDS,
|
|
196
|
+
...mergeUnique(options.extends ?? [])
|
|
197
|
+
]);
|
|
351
198
|
const rules = {
|
|
352
|
-
...
|
|
353
|
-
|
|
354
|
-
...
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
199
|
+
...buildScopeRules(scopes),
|
|
200
|
+
...buildSubjectRules(subject),
|
|
201
|
+
...buildHeaderRules(header)
|
|
202
|
+
};
|
|
203
|
+
const typesConfig = buildTypesConfig(types);
|
|
204
|
+
if (typesConfig.rule) {
|
|
205
|
+
rules["type-enum"] = typesConfig.rule;
|
|
206
|
+
}
|
|
207
|
+
const mergedRules = {
|
|
208
|
+
...rules,
|
|
209
|
+
...options.rules ?? {}
|
|
210
|
+
};
|
|
211
|
+
const prompt = mergePrompts(typesConfig.prompt, options.prompt);
|
|
212
|
+
return {
|
|
213
|
+
extends: extendsList,
|
|
214
|
+
parserPreset: DEFAULT_PARSER_PRESET,
|
|
215
|
+
...Object.keys(mergedRules).length > 0 ? { rules: mergedRules } : {},
|
|
216
|
+
...prompt ? { prompt } : {}
|
|
358
217
|
};
|
|
359
|
-
const prompt = resolvePrompt(typeSettings.definitions, options.prompt);
|
|
360
|
-
return removeUndefined({
|
|
361
|
-
extends: extendsField,
|
|
362
|
-
formatter: options.formatter,
|
|
363
|
-
parserPreset: options.parserPreset ?? DEFAULT_PARSER_PRESET,
|
|
364
|
-
rules,
|
|
365
|
-
ignores: options.ignores,
|
|
366
|
-
defaultIgnores: options.defaultIgnores,
|
|
367
|
-
plugins: options.plugins,
|
|
368
|
-
helpUrl: options.helpUrl,
|
|
369
|
-
prompt
|
|
370
|
-
});
|
|
371
|
-
}
|
|
372
|
-
|
|
373
|
-
// src/index.ts
|
|
374
|
-
import { RuleConfigCondition, RuleConfigSeverity as RuleConfigSeverity2, TargetCaseType } from "@commitlint/types";
|
|
375
|
-
function createCommitlintConfig(options) {
|
|
376
|
-
return createIcebreakerCommitlintConfig(options);
|
|
377
218
|
}
|
|
378
219
|
function icebreaker(options) {
|
|
379
220
|
return createIcebreakerCommitlintConfig(options);
|
|
380
221
|
}
|
|
381
222
|
export {
|
|
382
|
-
|
|
383
|
-
DEFAULT_EXTENDS,
|
|
384
|
-
DEFAULT_SUBJECT_FORBIDDEN_CASES,
|
|
385
|
-
DEFAULT_TYPES,
|
|
386
|
-
RuleConfigCondition,
|
|
387
|
-
RuleConfigSeverity2 as RuleConfigSeverity,
|
|
388
|
-
TargetCaseType,
|
|
389
|
-
createCommitlintConfig,
|
|
223
|
+
RuleConfigSeverity,
|
|
390
224
|
createIcebreakerCommitlintConfig,
|
|
391
225
|
icebreaker
|
|
392
226
|
};
|