@code-pushup/eslint-plugin 0.5.0 → 0.5.2
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/bin.js +23 -22
- package/index.js +24 -23
- package/package.json +1 -1
package/bin.js
CHANGED
|
@@ -186,6 +186,23 @@ function getDuplicateRefsInCategoryMetrics(metrics) {
|
|
|
186
186
|
metrics.map(({ slug, type, plugin }) => `${type} :: ${plugin} / ${slug}`)
|
|
187
187
|
);
|
|
188
188
|
}
|
|
189
|
+
var categoriesSchema = z2.array(categoryConfigSchema, {
|
|
190
|
+
description: "Categorization of individual audits"
|
|
191
|
+
}).min(1).refine(
|
|
192
|
+
(categoryCfg) => !getDuplicateSlugCategories(categoryCfg),
|
|
193
|
+
(categoryCfg) => ({
|
|
194
|
+
message: duplicateSlugCategoriesErrorMsg(categoryCfg)
|
|
195
|
+
})
|
|
196
|
+
);
|
|
197
|
+
function duplicateSlugCategoriesErrorMsg(categories) {
|
|
198
|
+
const duplicateStringSlugs = getDuplicateSlugCategories(categories);
|
|
199
|
+
return `In the categories, the following slugs are duplicated: ${errorItems(
|
|
200
|
+
duplicateStringSlugs
|
|
201
|
+
)}`;
|
|
202
|
+
}
|
|
203
|
+
function getDuplicateSlugCategories(categories) {
|
|
204
|
+
return hasDuplicateStrings(categories.map(({ slug }) => slug));
|
|
205
|
+
}
|
|
189
206
|
|
|
190
207
|
// packages/models/src/lib/core-config.ts
|
|
191
208
|
import { z as z11 } from "zod";
|
|
@@ -194,10 +211,10 @@ import { z as z11 } from "zod";
|
|
|
194
211
|
import { z as z3 } from "zod";
|
|
195
212
|
var formatSchema = z3.enum(["json", "md"]);
|
|
196
213
|
var persistConfigSchema = z3.object({
|
|
197
|
-
outputDir: filePathSchema("Artifacts folder"),
|
|
198
|
-
filename: fileNameSchema(
|
|
199
|
-
"
|
|
200
|
-
),
|
|
214
|
+
outputDir: filePathSchema("Artifacts folder").optional(),
|
|
215
|
+
filename: fileNameSchema(
|
|
216
|
+
"Artifacts file name (without extension)"
|
|
217
|
+
).optional(),
|
|
201
218
|
format: z3.array(formatSchema).default(["json"]).optional()
|
|
202
219
|
// @TODO remove default or optional value and otherwise it will not set defaults.
|
|
203
220
|
});
|
|
@@ -433,17 +450,10 @@ var unrefinedCoreConfigSchema = z11.object({
|
|
|
433
450
|
description: "List of plugins to be used (official, community-provided, or custom)"
|
|
434
451
|
}),
|
|
435
452
|
/** portal configuration for persisting results */
|
|
436
|
-
persist: persistConfigSchema,
|
|
453
|
+
persist: persistConfigSchema.optional(),
|
|
437
454
|
/** portal configuration for uploading results */
|
|
438
455
|
upload: uploadConfigSchema.optional(),
|
|
439
|
-
categories:
|
|
440
|
-
description: "Categorization of individual audits"
|
|
441
|
-
}).min(1).refine(
|
|
442
|
-
(categories) => !getDuplicateSlugCategories(categories),
|
|
443
|
-
(categories) => ({
|
|
444
|
-
message: duplicateSlugCategoriesErrorMsg(categories)
|
|
445
|
-
})
|
|
446
|
-
)
|
|
456
|
+
categories: categoriesSchema
|
|
447
457
|
});
|
|
448
458
|
var coreConfigSchema = refineCoreConfig(unrefinedCoreConfigSchema);
|
|
449
459
|
function refineCoreConfig(schema) {
|
|
@@ -494,15 +504,6 @@ function getMissingRefsForCategories(coreCfg) {
|
|
|
494
504
|
}
|
|
495
505
|
return missingRefs.length ? missingRefs : false;
|
|
496
506
|
}
|
|
497
|
-
function duplicateSlugCategoriesErrorMsg(categories) {
|
|
498
|
-
const duplicateStringSlugs = getDuplicateSlugCategories(categories);
|
|
499
|
-
return `In the categories, the following slugs are duplicated: ${errorItems(
|
|
500
|
-
duplicateStringSlugs
|
|
501
|
-
)}`;
|
|
502
|
-
}
|
|
503
|
-
function getDuplicateSlugCategories(categories) {
|
|
504
|
-
return hasDuplicateStrings(categories.map(({ slug }) => slug));
|
|
505
|
-
}
|
|
506
507
|
|
|
507
508
|
// packages/models/src/lib/report.ts
|
|
508
509
|
import { z as z12 } from "zod";
|
package/index.js
CHANGED
|
@@ -5,7 +5,7 @@ import { fileURLToPath } from "url";
|
|
|
5
5
|
|
|
6
6
|
// packages/plugin-eslint/package.json
|
|
7
7
|
var name = "@code-pushup/eslint-plugin";
|
|
8
|
-
var version = "0.5.
|
|
8
|
+
var version = "0.5.2";
|
|
9
9
|
|
|
10
10
|
// packages/plugin-eslint/src/lib/config.ts
|
|
11
11
|
import { z } from "zod";
|
|
@@ -208,6 +208,23 @@ function getDuplicateRefsInCategoryMetrics(metrics) {
|
|
|
208
208
|
metrics.map(({ slug, type, plugin }) => `${type} :: ${plugin} / ${slug}`)
|
|
209
209
|
);
|
|
210
210
|
}
|
|
211
|
+
var categoriesSchema = z3.array(categoryConfigSchema, {
|
|
212
|
+
description: "Categorization of individual audits"
|
|
213
|
+
}).min(1).refine(
|
|
214
|
+
(categoryCfg) => !getDuplicateSlugCategories(categoryCfg),
|
|
215
|
+
(categoryCfg) => ({
|
|
216
|
+
message: duplicateSlugCategoriesErrorMsg(categoryCfg)
|
|
217
|
+
})
|
|
218
|
+
);
|
|
219
|
+
function duplicateSlugCategoriesErrorMsg(categories) {
|
|
220
|
+
const duplicateStringSlugs = getDuplicateSlugCategories(categories);
|
|
221
|
+
return `In the categories, the following slugs are duplicated: ${errorItems(
|
|
222
|
+
duplicateStringSlugs
|
|
223
|
+
)}`;
|
|
224
|
+
}
|
|
225
|
+
function getDuplicateSlugCategories(categories) {
|
|
226
|
+
return hasDuplicateStrings(categories.map(({ slug }) => slug));
|
|
227
|
+
}
|
|
211
228
|
|
|
212
229
|
// packages/models/src/lib/core-config.ts
|
|
213
230
|
import { z as z12 } from "zod";
|
|
@@ -216,10 +233,10 @@ import { z as z12 } from "zod";
|
|
|
216
233
|
import { z as z4 } from "zod";
|
|
217
234
|
var formatSchema = z4.enum(["json", "md"]);
|
|
218
235
|
var persistConfigSchema = z4.object({
|
|
219
|
-
outputDir: filePathSchema("Artifacts folder"),
|
|
220
|
-
filename: fileNameSchema(
|
|
221
|
-
"
|
|
222
|
-
),
|
|
236
|
+
outputDir: filePathSchema("Artifacts folder").optional(),
|
|
237
|
+
filename: fileNameSchema(
|
|
238
|
+
"Artifacts file name (without extension)"
|
|
239
|
+
).optional(),
|
|
223
240
|
format: z4.array(formatSchema).default(["json"]).optional()
|
|
224
241
|
// @TODO remove default or optional value and otherwise it will not set defaults.
|
|
225
242
|
});
|
|
@@ -455,17 +472,10 @@ var unrefinedCoreConfigSchema = z12.object({
|
|
|
455
472
|
description: "List of plugins to be used (official, community-provided, or custom)"
|
|
456
473
|
}),
|
|
457
474
|
/** portal configuration for persisting results */
|
|
458
|
-
persist: persistConfigSchema,
|
|
475
|
+
persist: persistConfigSchema.optional(),
|
|
459
476
|
/** portal configuration for uploading results */
|
|
460
477
|
upload: uploadConfigSchema.optional(),
|
|
461
|
-
categories:
|
|
462
|
-
description: "Categorization of individual audits"
|
|
463
|
-
}).min(1).refine(
|
|
464
|
-
(categories) => !getDuplicateSlugCategories(categories),
|
|
465
|
-
(categories) => ({
|
|
466
|
-
message: duplicateSlugCategoriesErrorMsg(categories)
|
|
467
|
-
})
|
|
468
|
-
)
|
|
478
|
+
categories: categoriesSchema
|
|
469
479
|
});
|
|
470
480
|
var coreConfigSchema = refineCoreConfig(unrefinedCoreConfigSchema);
|
|
471
481
|
function refineCoreConfig(schema) {
|
|
@@ -516,15 +526,6 @@ function getMissingRefsForCategories(coreCfg) {
|
|
|
516
526
|
}
|
|
517
527
|
return missingRefs.length ? missingRefs : false;
|
|
518
528
|
}
|
|
519
|
-
function duplicateSlugCategoriesErrorMsg(categories) {
|
|
520
|
-
const duplicateStringSlugs = getDuplicateSlugCategories(categories);
|
|
521
|
-
return `In the categories, the following slugs are duplicated: ${errorItems(
|
|
522
|
-
duplicateStringSlugs
|
|
523
|
-
)}`;
|
|
524
|
-
}
|
|
525
|
-
function getDuplicateSlugCategories(categories) {
|
|
526
|
-
return hasDuplicateStrings(categories.map(({ slug }) => slug));
|
|
527
|
-
}
|
|
528
529
|
|
|
529
530
|
// packages/models/src/lib/report.ts
|
|
530
531
|
import { z as z13 } from "zod";
|