@code-pushup/eslint-plugin 0.12.0 → 0.12.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 +7 -4
- package/index.js +8 -5
- package/package.json +1 -1
package/bin.js
CHANGED
|
@@ -36,6 +36,9 @@ function exists(value) {
|
|
|
36
36
|
return value != null;
|
|
37
37
|
}
|
|
38
38
|
function getMissingRefsForCategories(categories, plugins) {
|
|
39
|
+
if (categories.length === 0) {
|
|
40
|
+
return false;
|
|
41
|
+
}
|
|
39
42
|
const auditRefsFromCategory = categories.flatMap(
|
|
40
43
|
({ refs }) => refs.filter(({ type }) => type === "audit").map(({ plugin, slug }) => `${plugin}/${slug}`)
|
|
41
44
|
);
|
|
@@ -310,7 +313,7 @@ function getDuplicateRefsInCategoryMetrics(metrics) {
|
|
|
310
313
|
}
|
|
311
314
|
var categoriesSchema = z5.array(categoryConfigSchema, {
|
|
312
315
|
description: "Categorization of individual audits"
|
|
313
|
-
}).
|
|
316
|
+
}).refine(
|
|
314
317
|
(categoryCfg) => !getDuplicateSlugCategories(categoryCfg),
|
|
315
318
|
(categoryCfg) => ({
|
|
316
319
|
message: duplicateSlugCategoriesErrorMsg(categoryCfg)
|
|
@@ -468,15 +471,15 @@ var unrefinedCoreConfigSchema = z11.object({
|
|
|
468
471
|
persist: persistConfigSchema.optional(),
|
|
469
472
|
/** portal configuration for uploading results */
|
|
470
473
|
upload: uploadConfigSchema.optional(),
|
|
471
|
-
categories: categoriesSchema
|
|
474
|
+
categories: categoriesSchema.optional()
|
|
472
475
|
});
|
|
473
476
|
var coreConfigSchema = refineCoreConfig(unrefinedCoreConfigSchema);
|
|
474
477
|
function refineCoreConfig(schema) {
|
|
475
478
|
return schema.refine(
|
|
476
|
-
(coreCfg) => !getMissingRefsForCategories(coreCfg.categories, coreCfg.plugins),
|
|
479
|
+
(coreCfg) => !getMissingRefsForCategories(coreCfg.categories ?? [], coreCfg.plugins),
|
|
477
480
|
(coreCfg) => ({
|
|
478
481
|
message: missingRefsForCategoriesErrorMsg(
|
|
479
|
-
coreCfg.categories,
|
|
482
|
+
coreCfg.categories ?? [],
|
|
480
483
|
coreCfg.plugins
|
|
481
484
|
)
|
|
482
485
|
})
|
package/index.js
CHANGED
|
@@ -5,7 +5,7 @@ import { fileURLToPath } from "node:url";
|
|
|
5
5
|
|
|
6
6
|
// packages/plugin-eslint/package.json
|
|
7
7
|
var name = "@code-pushup/eslint-plugin";
|
|
8
|
-
var version = "0.12.
|
|
8
|
+
var version = "0.12.2";
|
|
9
9
|
|
|
10
10
|
// packages/plugin-eslint/src/lib/config.ts
|
|
11
11
|
import { z } from "zod";
|
|
@@ -58,6 +58,9 @@ function exists(value) {
|
|
|
58
58
|
return value != null;
|
|
59
59
|
}
|
|
60
60
|
function getMissingRefsForCategories(categories, plugins) {
|
|
61
|
+
if (categories.length === 0) {
|
|
62
|
+
return false;
|
|
63
|
+
}
|
|
61
64
|
const auditRefsFromCategory = categories.flatMap(
|
|
62
65
|
({ refs }) => refs.filter(({ type }) => type === "audit").map(({ plugin, slug }) => `${plugin}/${slug}`)
|
|
63
66
|
);
|
|
@@ -332,7 +335,7 @@ function getDuplicateRefsInCategoryMetrics(metrics) {
|
|
|
332
335
|
}
|
|
333
336
|
var categoriesSchema = z6.array(categoryConfigSchema, {
|
|
334
337
|
description: "Categorization of individual audits"
|
|
335
|
-
}).
|
|
338
|
+
}).refine(
|
|
336
339
|
(categoryCfg) => !getDuplicateSlugCategories(categoryCfg),
|
|
337
340
|
(categoryCfg) => ({
|
|
338
341
|
message: duplicateSlugCategoriesErrorMsg(categoryCfg)
|
|
@@ -490,15 +493,15 @@ var unrefinedCoreConfigSchema = z12.object({
|
|
|
490
493
|
persist: persistConfigSchema.optional(),
|
|
491
494
|
/** portal configuration for uploading results */
|
|
492
495
|
upload: uploadConfigSchema.optional(),
|
|
493
|
-
categories: categoriesSchema
|
|
496
|
+
categories: categoriesSchema.optional()
|
|
494
497
|
});
|
|
495
498
|
var coreConfigSchema = refineCoreConfig(unrefinedCoreConfigSchema);
|
|
496
499
|
function refineCoreConfig(schema) {
|
|
497
500
|
return schema.refine(
|
|
498
|
-
(coreCfg) => !getMissingRefsForCategories(coreCfg.categories, coreCfg.plugins),
|
|
501
|
+
(coreCfg) => !getMissingRefsForCategories(coreCfg.categories ?? [], coreCfg.plugins),
|
|
499
502
|
(coreCfg) => ({
|
|
500
503
|
message: missingRefsForCategoriesErrorMsg(
|
|
501
|
-
coreCfg.categories,
|
|
504
|
+
coreCfg.categories ?? [],
|
|
502
505
|
coreCfg.plugins
|
|
503
506
|
)
|
|
504
507
|
})
|