create-typescript-app 2.26.3 → 2.26.5
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.
|
@@ -24,14 +24,13 @@ const zRuleOptions = z.union([
|
|
|
24
24
|
])
|
|
25
25
|
])
|
|
26
26
|
]);
|
|
27
|
+
const zExtensionRuleGroup = z.object({
|
|
28
|
+
comment: z.string().optional(),
|
|
29
|
+
entries: z.record(z.string(), zRuleOptions)
|
|
30
|
+
});
|
|
27
31
|
const zExtensionRules = z.union([
|
|
28
32
|
z.record(z.string(), zRuleOptions),
|
|
29
|
-
z.array(
|
|
30
|
-
z.object({
|
|
31
|
-
comment: z.string().optional(),
|
|
32
|
-
entries: z.record(z.string(), zRuleOptions)
|
|
33
|
-
})
|
|
34
|
-
)
|
|
33
|
+
z.array(zExtensionRuleGroup)
|
|
35
34
|
]);
|
|
36
35
|
const zExtension = z.object({
|
|
37
36
|
extends: z.array(z.string()).optional(),
|
|
@@ -250,6 +249,24 @@ export default tseslint.config(
|
|
|
250
249
|
};
|
|
251
250
|
}
|
|
252
251
|
});
|
|
252
|
+
function groupByComment(rulesGroups) {
|
|
253
|
+
const byComment = /* @__PURE__ */ new Map();
|
|
254
|
+
const grouped = [];
|
|
255
|
+
for (const group of rulesGroups) {
|
|
256
|
+
const existing = byComment.get(group.comment);
|
|
257
|
+
if (existing) {
|
|
258
|
+
existing.entries = {
|
|
259
|
+
...existing.entries,
|
|
260
|
+
...group.entries
|
|
261
|
+
};
|
|
262
|
+
continue;
|
|
263
|
+
} else {
|
|
264
|
+
byComment.set(group.comment, group);
|
|
265
|
+
grouped.push(group);
|
|
266
|
+
}
|
|
267
|
+
}
|
|
268
|
+
return grouped;
|
|
269
|
+
}
|
|
253
270
|
function printExtension(extension) {
|
|
254
271
|
return [
|
|
255
272
|
"{",
|
|
@@ -268,7 +285,7 @@ function printExtensionRules(rules) {
|
|
|
268
285
|
}
|
|
269
286
|
return [
|
|
270
287
|
"{",
|
|
271
|
-
...rules.flatMap((group) => [
|
|
288
|
+
...groupByComment(rules).flatMap((group) => [
|
|
272
289
|
printGroupComment(group.comment),
|
|
273
290
|
...Object.entries(group.entries).map(
|
|
274
291
|
([ruleName, options]) => `"${ruleName}": ${JSON.stringify(options)},`
|