@code-pushup/eslint-plugin 0.50.0 → 0.52.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.
Files changed (3) hide show
  1. package/bin.js +111 -108
  2. package/index.js +120 -117
  3. package/package.json +6 -3
package/bin.js CHANGED
@@ -159,9 +159,27 @@ function hasNonZeroWeightedRef(refs) {
159
159
  return refs.reduce((acc, { weight }) => weight + acc, 0) !== 0;
160
160
  }
161
161
 
162
- // packages/models/src/lib/audit.ts
162
+ // packages/models/src/lib/source.ts
163
163
  import { z as z2 } from "zod";
164
- var auditSchema = z2.object({
164
+ var sourceFileLocationSchema = z2.object(
165
+ {
166
+ file: filePathSchema.describe("Relative path to source file in Git repo"),
167
+ position: z2.object(
168
+ {
169
+ startLine: positiveIntSchema.describe("Start line"),
170
+ startColumn: positiveIntSchema.describe("Start column").optional(),
171
+ endLine: positiveIntSchema.describe("End line").optional(),
172
+ endColumn: positiveIntSchema.describe("End column").optional()
173
+ },
174
+ { description: "Location in file" }
175
+ ).optional()
176
+ },
177
+ { description: "Source file location" }
178
+ );
179
+
180
+ // packages/models/src/lib/audit.ts
181
+ import { z as z3 } from "zod";
182
+ var auditSchema = z3.object({
165
183
  slug: slugSchema.describe("ID (unique within plugin)")
166
184
  }).merge(
167
185
  metaSchema({
@@ -171,7 +189,7 @@ var auditSchema = z2.object({
171
189
  description: "List of scorable metrics for the given plugin"
172
190
  })
173
191
  );
174
- var pluginAuditsSchema = z2.array(auditSchema, {
192
+ var pluginAuditsSchema = z3.array(auditSchema, {
175
193
  description: "List of audits maintained in a plugin"
176
194
  }).min(1).refine(
177
195
  (auditMetadata) => !getDuplicateSlugsInAudits(auditMetadata),
@@ -190,31 +208,16 @@ function getDuplicateSlugsInAudits(audits) {
190
208
  }
191
209
 
192
210
  // packages/models/src/lib/audit-output.ts
193
- import { z as z5 } from "zod";
211
+ import { z as z6 } from "zod";
194
212
 
195
213
  // packages/models/src/lib/issue.ts
196
- import { z as z3 } from "zod";
197
- var sourceFileLocationSchema = z3.object(
198
- {
199
- file: filePathSchema.describe("Relative path to source file in Git repo"),
200
- position: z3.object(
201
- {
202
- startLine: positiveIntSchema.describe("Start line"),
203
- startColumn: positiveIntSchema.describe("Start column").optional(),
204
- endLine: positiveIntSchema.describe("End line").optional(),
205
- endColumn: positiveIntSchema.describe("End column").optional()
206
- },
207
- { description: "Location in file" }
208
- ).optional()
209
- },
210
- { description: "Source file location" }
211
- );
212
- var issueSeveritySchema = z3.enum(["info", "warning", "error"], {
214
+ import { z as z4 } from "zod";
215
+ var issueSeveritySchema = z4.enum(["info", "warning", "error"], {
213
216
  description: "Severity level"
214
217
  });
215
- var issueSchema = z3.object(
218
+ var issueSchema = z4.object(
216
219
  {
217
- message: z3.string({ description: "Descriptive error message" }).max(MAX_ISSUE_MESSAGE_LENGTH),
220
+ message: z4.string({ description: "Descriptive error message" }).max(MAX_ISSUE_MESSAGE_LENGTH),
218
221
  severity: issueSeveritySchema,
219
222
  source: sourceFileLocationSchema.optional()
220
223
  },
@@ -222,60 +225,60 @@ var issueSchema = z3.object(
222
225
  );
223
226
 
224
227
  // packages/models/src/lib/table.ts
225
- import { z as z4 } from "zod";
226
- var tableAlignmentSchema = z4.enum(["left", "center", "right"], {
228
+ import { z as z5 } from "zod";
229
+ var tableAlignmentSchema = z5.enum(["left", "center", "right"], {
227
230
  description: "Cell alignment"
228
231
  });
229
- var tableColumnObjectSchema = z4.object({
230
- key: z4.string(),
231
- label: z4.string().optional(),
232
+ var tableColumnObjectSchema = z5.object({
233
+ key: z5.string(),
234
+ label: z5.string().optional(),
232
235
  align: tableAlignmentSchema.optional()
233
236
  });
234
- var tableRowObjectSchema = z4.record(tableCellValueSchema, {
237
+ var tableRowObjectSchema = z5.record(tableCellValueSchema, {
235
238
  description: "Object row"
236
239
  });
237
- var tableRowPrimitiveSchema = z4.array(tableCellValueSchema, {
240
+ var tableRowPrimitiveSchema = z5.array(tableCellValueSchema, {
238
241
  description: "Primitive row"
239
242
  });
240
- var tableSharedSchema = z4.object({
241
- title: z4.string().optional().describe("Display title for table")
243
+ var tableSharedSchema = z5.object({
244
+ title: z5.string().optional().describe("Display title for table")
242
245
  });
243
246
  var tablePrimitiveSchema = tableSharedSchema.merge(
244
- z4.object(
247
+ z5.object(
245
248
  {
246
- columns: z4.array(tableAlignmentSchema).optional(),
247
- rows: z4.array(tableRowPrimitiveSchema)
249
+ columns: z5.array(tableAlignmentSchema).optional(),
250
+ rows: z5.array(tableRowPrimitiveSchema)
248
251
  },
249
252
  { description: "Table with primitive rows and optional alignment columns" }
250
253
  )
251
254
  );
252
255
  var tableObjectSchema = tableSharedSchema.merge(
253
- z4.object(
256
+ z5.object(
254
257
  {
255
- columns: z4.union([
256
- z4.array(tableAlignmentSchema),
257
- z4.array(tableColumnObjectSchema)
258
+ columns: z5.union([
259
+ z5.array(tableAlignmentSchema),
260
+ z5.array(tableColumnObjectSchema)
258
261
  ]).optional(),
259
- rows: z4.array(tableRowObjectSchema)
262
+ rows: z5.array(tableRowObjectSchema)
260
263
  },
261
264
  {
262
265
  description: "Table with object rows and optional alignment or object columns"
263
266
  }
264
267
  )
265
268
  );
266
- var tableSchema = (description = "Table information") => z4.union([tablePrimitiveSchema, tableObjectSchema], { description });
269
+ var tableSchema = (description = "Table information") => z5.union([tablePrimitiveSchema, tableObjectSchema], { description });
267
270
 
268
271
  // packages/models/src/lib/audit-output.ts
269
272
  var auditValueSchema = nonnegativeNumberSchema.describe("Raw numeric value");
270
- var auditDisplayValueSchema = z5.string({ description: "Formatted value (e.g. '0.9 s', '2.1 MB')" }).optional();
271
- var auditDetailsSchema = z5.object(
273
+ var auditDisplayValueSchema = z6.string({ description: "Formatted value (e.g. '0.9 s', '2.1 MB')" }).optional();
274
+ var auditDetailsSchema = z6.object(
272
275
  {
273
- issues: z5.array(issueSchema, { description: "List of findings" }).optional(),
276
+ issues: z6.array(issueSchema, { description: "List of findings" }).optional(),
274
277
  table: tableSchema("Table of related findings").optional()
275
278
  },
276
279
  { description: "Detailed information" }
277
280
  );
278
- var auditOutputSchema = z5.object(
281
+ var auditOutputSchema = z6.object(
279
282
  {
280
283
  slug: slugSchema.describe("Reference to audit"),
281
284
  displayValue: auditDisplayValueSchema,
@@ -285,7 +288,7 @@ var auditOutputSchema = z5.object(
285
288
  },
286
289
  { description: "Audit information" }
287
290
  );
288
- var auditOutputsSchema = z5.array(auditOutputSchema, {
291
+ var auditOutputsSchema = z6.array(auditOutputSchema, {
289
292
  description: "List of JSON formatted audit output emitted by the runner process of a plugin"
290
293
  }).refine(
291
294
  (audits) => !getDuplicateSlugsInAudits2(audits),
@@ -302,13 +305,13 @@ function getDuplicateSlugsInAudits2(audits) {
302
305
  }
303
306
 
304
307
  // packages/models/src/lib/category-config.ts
305
- import { z as z6 } from "zod";
308
+ import { z as z7 } from "zod";
306
309
  var categoryRefSchema = weightedRefSchema(
307
310
  "Weighted references to audits and/or groups for the category",
308
311
  "Slug of an audit or group (depending on `type`)"
309
312
  ).merge(
310
- z6.object({
311
- type: z6.enum(["audit", "group"], {
313
+ z7.object({
314
+ type: z7.enum(["audit", "group"], {
312
315
  description: "Discriminant for reference kind, affects where `slug` is looked up"
313
316
  }),
314
317
  plugin: slugSchema.describe(
@@ -329,8 +332,8 @@ var categoryConfigSchema = scorableSchema(
329
332
  description: "Meta info for category"
330
333
  })
331
334
  ).merge(
332
- z6.object({
333
- isBinary: z6.boolean({
335
+ z7.object({
336
+ isBinary: z7.boolean({
334
337
  description: 'Is this a binary category (i.e. only a perfect score considered a "pass")?'
335
338
  }).optional()
336
339
  })
@@ -346,7 +349,7 @@ function getDuplicateRefsInCategoryMetrics(metrics) {
346
349
  metrics.map(({ slug, type, plugin }) => `${type} :: ${plugin} / ${slug}`)
347
350
  );
348
351
  }
349
- var categoriesSchema = z6.array(categoryConfigSchema, {
352
+ var categoriesSchema = z7.array(categoryConfigSchema, {
350
353
  description: "Categorization of individual audits"
351
354
  }).refine(
352
355
  (categoryCfg) => !getDuplicateSlugCategories(categoryCfg),
@@ -365,18 +368,18 @@ function getDuplicateSlugCategories(categories) {
365
368
  }
366
369
 
367
370
  // packages/models/src/lib/commit.ts
368
- import { z as z7 } from "zod";
369
- var commitSchema = z7.object(
371
+ import { z as z8 } from "zod";
372
+ var commitSchema = z8.object(
370
373
  {
371
- hash: z7.string({ description: "Commit SHA (full)" }).regex(
374
+ hash: z8.string({ description: "Commit SHA (full)" }).regex(
372
375
  /^[\da-f]{40}$/,
373
376
  "Commit SHA should be a 40-character hexadecimal string"
374
377
  ),
375
- message: z7.string({ description: "Commit message" }),
376
- date: z7.coerce.date({
378
+ message: z8.string({ description: "Commit message" }),
379
+ date: z8.coerce.date({
377
380
  description: "Date and time when commit was authored"
378
381
  }),
379
- author: z7.string({
382
+ author: z8.string({
380
383
  description: "Commit author name"
381
384
  }).trim()
382
385
  },
@@ -384,22 +387,22 @@ var commitSchema = z7.object(
384
387
  );
385
388
 
386
389
  // packages/models/src/lib/core-config.ts
387
- import { z as z13 } from "zod";
390
+ import { z as z14 } from "zod";
388
391
 
389
392
  // packages/models/src/lib/persist-config.ts
390
- import { z as z8 } from "zod";
391
- var formatSchema = z8.enum(["json", "md"]);
392
- var persistConfigSchema = z8.object({
393
+ import { z as z9 } from "zod";
394
+ var formatSchema = z9.enum(["json", "md"]);
395
+ var persistConfigSchema = z9.object({
393
396
  outputDir: filePathSchema.describe("Artifacts folder").optional(),
394
397
  filename: fileNameSchema.describe("Artifacts file name (without extension)").optional(),
395
- format: z8.array(formatSchema).optional()
398
+ format: z9.array(formatSchema).optional()
396
399
  });
397
400
 
398
401
  // packages/models/src/lib/plugin-config.ts
399
- import { z as z11 } from "zod";
402
+ import { z as z12 } from "zod";
400
403
 
401
404
  // packages/models/src/lib/group.ts
402
- import { z as z9 } from "zod";
405
+ import { z as z10 } from "zod";
403
406
  var groupRefSchema = weightedRefSchema(
404
407
  "Weighted reference to a group",
405
408
  "Reference slug to a group within this plugin (e.g. 'max-lines')"
@@ -416,7 +419,7 @@ var groupSchema = scorableSchema(
416
419
  getDuplicateRefsInGroups,
417
420
  duplicateRefsInGroupsErrorMsg
418
421
  ).merge(groupMetaSchema);
419
- var groupsSchema = z9.array(groupSchema, {
422
+ var groupsSchema = z10.array(groupSchema, {
420
423
  description: "List of groups"
421
424
  }).optional().refine(
422
425
  (groups) => !getDuplicateSlugsInGroups(groups),
@@ -444,14 +447,14 @@ function getDuplicateSlugsInGroups(groups) {
444
447
  }
445
448
 
446
449
  // packages/models/src/lib/runner-config.ts
447
- import { z as z10 } from "zod";
448
- var outputTransformSchema = z10.function().args(z10.unknown()).returns(z10.union([auditOutputsSchema, z10.promise(auditOutputsSchema)]));
449
- var runnerConfigSchema = z10.object(
450
+ import { z as z11 } from "zod";
451
+ var outputTransformSchema = z11.function().args(z11.unknown()).returns(z11.union([auditOutputsSchema, z11.promise(auditOutputsSchema)]));
452
+ var runnerConfigSchema = z11.object(
450
453
  {
451
- command: z10.string({
454
+ command: z11.string({
452
455
  description: "Shell command to execute"
453
456
  }),
454
- args: z10.array(z10.string({ description: "Command arguments" })).optional(),
457
+ args: z11.array(z11.string({ description: "Command arguments" })).optional(),
455
458
  outputFile: filePathSchema.describe("Output path"),
456
459
  outputTransform: outputTransformSchema.optional()
457
460
  },
@@ -459,8 +462,8 @@ var runnerConfigSchema = z10.object(
459
462
  description: "How to execute runner"
460
463
  }
461
464
  );
462
- var onProgressSchema = z10.function().args(z10.unknown()).returns(z10.void());
463
- var runnerFunctionSchema = z10.function().args(onProgressSchema.optional()).returns(z10.union([auditOutputsSchema, z10.promise(auditOutputsSchema)]));
465
+ var onProgressSchema = z11.function().args(z11.unknown()).returns(z11.void());
466
+ var runnerFunctionSchema = z11.function().args(onProgressSchema.optional()).returns(z11.union([auditOutputsSchema, z11.promise(auditOutputsSchema)]));
464
467
 
465
468
  // packages/models/src/lib/plugin-config.ts
466
469
  var pluginMetaSchema = packageVersionSchema().merge(
@@ -471,13 +474,13 @@ var pluginMetaSchema = packageVersionSchema().merge(
471
474
  description: "Plugin metadata"
472
475
  })
473
476
  ).merge(
474
- z11.object({
477
+ z12.object({
475
478
  slug: slugSchema.describe("Unique plugin slug within core config"),
476
479
  icon: materialIconSchema
477
480
  })
478
481
  );
479
- var pluginDataSchema = z11.object({
480
- runner: z11.union([runnerConfigSchema, runnerFunctionSchema]),
482
+ var pluginDataSchema = z12.object({
483
+ runner: z12.union([runnerConfigSchema, runnerFunctionSchema]),
481
484
  audits: pluginAuditsSchema,
482
485
  groups: groupsSchema
483
486
  });
@@ -503,22 +506,22 @@ function getMissingRefsFromGroups(pluginCfg) {
503
506
  }
504
507
 
505
508
  // packages/models/src/lib/upload-config.ts
506
- import { z as z12 } from "zod";
507
- var uploadConfigSchema = z12.object({
509
+ import { z as z13 } from "zod";
510
+ var uploadConfigSchema = z13.object({
508
511
  server: urlSchema.describe("URL of deployed portal API"),
509
- apiKey: z12.string({
512
+ apiKey: z13.string({
510
513
  description: "API key with write access to portal (use `process.env` for security)"
511
514
  }),
512
515
  organization: slugSchema.describe(
513
516
  "Organization slug from Code PushUp portal"
514
517
  ),
515
518
  project: slugSchema.describe("Project slug from Code PushUp portal"),
516
- timeout: z12.number({ description: "Request timeout in minutes (default is 5)" }).positive().int().optional()
519
+ timeout: z13.number({ description: "Request timeout in minutes (default is 5)" }).positive().int().optional()
517
520
  });
518
521
 
519
522
  // packages/models/src/lib/core-config.ts
520
- var unrefinedCoreConfigSchema = z13.object({
521
- plugins: z13.array(pluginConfigSchema, {
523
+ var unrefinedCoreConfigSchema = z14.object({
524
+ plugins: z14.array(pluginConfigSchema, {
522
525
  description: "List of plugins to be used (official, community-provided, or custom)"
523
526
  }).min(1),
524
527
  /** portal configuration for persisting results */
@@ -541,7 +544,7 @@ function refineCoreConfig(schema) {
541
544
  }
542
545
 
543
546
  // packages/models/src/lib/report.ts
544
- import { z as z14 } from "zod";
547
+ import { z as z15 } from "zod";
545
548
  var auditReportSchema = auditSchema.merge(auditOutputSchema);
546
549
  var pluginReportSchema = pluginMetaSchema.merge(
547
550
  executionMetaSchema({
@@ -549,9 +552,9 @@ var pluginReportSchema = pluginMetaSchema.merge(
549
552
  descriptionDuration: "Duration of the plugin run in ms"
550
553
  })
551
554
  ).merge(
552
- z14.object({
553
- audits: z14.array(auditReportSchema).min(1),
554
- groups: z14.array(groupSchema).optional()
555
+ z15.object({
556
+ audits: z15.array(auditReportSchema).min(1),
557
+ groups: z15.array(groupSchema).optional()
555
558
  })
556
559
  ).refine(
557
560
  (pluginReport) => !getMissingRefsFromGroups2(pluginReport.audits, pluginReport.groups ?? []),
@@ -585,10 +588,10 @@ var reportSchema = packageVersionSchema({
585
588
  descriptionDuration: "Duration of the collect run in ms"
586
589
  })
587
590
  ).merge(
588
- z14.object(
591
+ z15.object(
589
592
  {
590
- categories: z14.array(categoryConfigSchema),
591
- plugins: z14.array(pluginReportSchema).min(1),
593
+ categories: z15.array(categoryConfigSchema),
594
+ plugins: z15.array(pluginReportSchema).min(1),
592
595
  commit: commitSchema.describe("Git commit for which report was collected").nullable()
593
596
  },
594
597
  { description: "Collect output data" }
@@ -604,40 +607,40 @@ var reportSchema = packageVersionSchema({
604
607
  );
605
608
 
606
609
  // packages/models/src/lib/reports-diff.ts
607
- import { z as z15 } from "zod";
610
+ import { z as z16 } from "zod";
608
611
  function makeComparisonSchema(schema) {
609
612
  const sharedDescription = schema.description || "Result";
610
- return z15.object({
613
+ return z16.object({
611
614
  before: schema.describe(`${sharedDescription} (source commit)`),
612
615
  after: schema.describe(`${sharedDescription} (target commit)`)
613
616
  });
614
617
  }
615
618
  function makeArraysComparisonSchema(diffSchema, resultSchema, description) {
616
- return z15.object(
619
+ return z16.object(
617
620
  {
618
- changed: z15.array(diffSchema),
619
- unchanged: z15.array(resultSchema),
620
- added: z15.array(resultSchema),
621
- removed: z15.array(resultSchema)
621
+ changed: z16.array(diffSchema),
622
+ unchanged: z16.array(resultSchema),
623
+ added: z16.array(resultSchema),
624
+ removed: z16.array(resultSchema)
622
625
  },
623
626
  { description }
624
627
  );
625
628
  }
626
- var scorableMetaSchema = z15.object({
629
+ var scorableMetaSchema = z16.object({
627
630
  slug: slugSchema,
628
631
  title: titleSchema,
629
632
  docsUrl: docsUrlSchema
630
633
  });
631
634
  var scorableWithPluginMetaSchema = scorableMetaSchema.merge(
632
- z15.object({
635
+ z16.object({
633
636
  plugin: pluginMetaSchema.pick({ slug: true, title: true, docsUrl: true }).describe("Plugin which defines it")
634
637
  })
635
638
  );
636
639
  var scorableDiffSchema = scorableMetaSchema.merge(
637
- z15.object({
640
+ z16.object({
638
641
  scores: makeComparisonSchema(scoreSchema).merge(
639
- z15.object({
640
- diff: z15.number().min(-1).max(1).describe("Score change (`scores.after - scores.before`)")
642
+ z16.object({
643
+ diff: z16.number().min(-1).max(1).describe("Score change (`scores.after - scores.before`)")
641
644
  })
642
645
  ).describe("Score comparison")
643
646
  })
@@ -648,10 +651,10 @@ var scorableWithPluginDiffSchema = scorableDiffSchema.merge(
648
651
  var categoryDiffSchema = scorableDiffSchema;
649
652
  var groupDiffSchema = scorableWithPluginDiffSchema;
650
653
  var auditDiffSchema = scorableWithPluginDiffSchema.merge(
651
- z15.object({
654
+ z16.object({
652
655
  values: makeComparisonSchema(auditValueSchema).merge(
653
- z15.object({
654
- diff: z15.number().int().describe("Value change (`values.after - values.before`)")
656
+ z16.object({
657
+ diff: z16.number().int().describe("Value change (`values.after - values.before`)")
655
658
  })
656
659
  ).describe("Audit `value` comparison"),
657
660
  displayValues: makeComparisonSchema(auditDisplayValueSchema).describe(
@@ -660,18 +663,18 @@ var auditDiffSchema = scorableWithPluginDiffSchema.merge(
660
663
  })
661
664
  );
662
665
  var categoryResultSchema = scorableMetaSchema.merge(
663
- z15.object({ score: scoreSchema })
666
+ z16.object({ score: scoreSchema })
664
667
  );
665
668
  var groupResultSchema = scorableWithPluginMetaSchema.merge(
666
- z15.object({ score: scoreSchema })
669
+ z16.object({ score: scoreSchema })
667
670
  );
668
671
  var auditResultSchema = scorableWithPluginMetaSchema.merge(
669
672
  auditOutputSchema.pick({ score: true, value: true, displayValue: true })
670
673
  );
671
- var reportsDiffSchema = z15.object({
674
+ var reportsDiffSchema = z16.object({
672
675
  commits: makeComparisonSchema(commitSchema).nullable().describe("Commits identifying compared reports"),
673
676
  portalUrl: urlSchema.optional().describe("Link to comparison page in Code PushUp portal"),
674
- label: z15.string().optional().describe("Label (e.g. project name)"),
677
+ label: z16.string().optional().describe("Label (e.g. project name)"),
675
678
  categories: makeArraysComparisonSchema(
676
679
  categoryDiffSchema,
677
680
  categoryResultSchema,
package/index.js CHANGED
@@ -4,10 +4,10 @@ import { fileURLToPath } from "node:url";
4
4
 
5
5
  // packages/plugin-eslint/package.json
6
6
  var name = "@code-pushup/eslint-plugin";
7
- var version = "0.50.0";
7
+ var version = "0.52.0";
8
8
 
9
9
  // packages/plugin-eslint/src/lib/config.ts
10
- import { z as z16 } from "zod";
10
+ import { z as z17 } from "zod";
11
11
 
12
12
  // packages/models/src/lib/implementation/schemas.ts
13
13
  import { MATERIAL_ICONS } from "vscode-material-icons";
@@ -166,9 +166,27 @@ function hasNonZeroWeightedRef(refs) {
166
166
  return refs.reduce((acc, { weight }) => weight + acc, 0) !== 0;
167
167
  }
168
168
 
169
- // packages/models/src/lib/audit.ts
169
+ // packages/models/src/lib/source.ts
170
170
  import { z as z2 } from "zod";
171
- var auditSchema = z2.object({
171
+ var sourceFileLocationSchema = z2.object(
172
+ {
173
+ file: filePathSchema.describe("Relative path to source file in Git repo"),
174
+ position: z2.object(
175
+ {
176
+ startLine: positiveIntSchema.describe("Start line"),
177
+ startColumn: positiveIntSchema.describe("Start column").optional(),
178
+ endLine: positiveIntSchema.describe("End line").optional(),
179
+ endColumn: positiveIntSchema.describe("End column").optional()
180
+ },
181
+ { description: "Location in file" }
182
+ ).optional()
183
+ },
184
+ { description: "Source file location" }
185
+ );
186
+
187
+ // packages/models/src/lib/audit.ts
188
+ import { z as z3 } from "zod";
189
+ var auditSchema = z3.object({
172
190
  slug: slugSchema.describe("ID (unique within plugin)")
173
191
  }).merge(
174
192
  metaSchema({
@@ -178,7 +196,7 @@ var auditSchema = z2.object({
178
196
  description: "List of scorable metrics for the given plugin"
179
197
  })
180
198
  );
181
- var pluginAuditsSchema = z2.array(auditSchema, {
199
+ var pluginAuditsSchema = z3.array(auditSchema, {
182
200
  description: "List of audits maintained in a plugin"
183
201
  }).min(1).refine(
184
202
  (auditMetadata) => !getDuplicateSlugsInAudits(auditMetadata),
@@ -197,31 +215,16 @@ function getDuplicateSlugsInAudits(audits) {
197
215
  }
198
216
 
199
217
  // packages/models/src/lib/audit-output.ts
200
- import { z as z5 } from "zod";
218
+ import { z as z6 } from "zod";
201
219
 
202
220
  // packages/models/src/lib/issue.ts
203
- import { z as z3 } from "zod";
204
- var sourceFileLocationSchema = z3.object(
205
- {
206
- file: filePathSchema.describe("Relative path to source file in Git repo"),
207
- position: z3.object(
208
- {
209
- startLine: positiveIntSchema.describe("Start line"),
210
- startColumn: positiveIntSchema.describe("Start column").optional(),
211
- endLine: positiveIntSchema.describe("End line").optional(),
212
- endColumn: positiveIntSchema.describe("End column").optional()
213
- },
214
- { description: "Location in file" }
215
- ).optional()
216
- },
217
- { description: "Source file location" }
218
- );
219
- var issueSeveritySchema = z3.enum(["info", "warning", "error"], {
221
+ import { z as z4 } from "zod";
222
+ var issueSeveritySchema = z4.enum(["info", "warning", "error"], {
220
223
  description: "Severity level"
221
224
  });
222
- var issueSchema = z3.object(
225
+ var issueSchema = z4.object(
223
226
  {
224
- message: z3.string({ description: "Descriptive error message" }).max(MAX_ISSUE_MESSAGE_LENGTH),
227
+ message: z4.string({ description: "Descriptive error message" }).max(MAX_ISSUE_MESSAGE_LENGTH),
225
228
  severity: issueSeveritySchema,
226
229
  source: sourceFileLocationSchema.optional()
227
230
  },
@@ -229,60 +232,60 @@ var issueSchema = z3.object(
229
232
  );
230
233
 
231
234
  // packages/models/src/lib/table.ts
232
- import { z as z4 } from "zod";
233
- var tableAlignmentSchema = z4.enum(["left", "center", "right"], {
235
+ import { z as z5 } from "zod";
236
+ var tableAlignmentSchema = z5.enum(["left", "center", "right"], {
234
237
  description: "Cell alignment"
235
238
  });
236
- var tableColumnObjectSchema = z4.object({
237
- key: z4.string(),
238
- label: z4.string().optional(),
239
+ var tableColumnObjectSchema = z5.object({
240
+ key: z5.string(),
241
+ label: z5.string().optional(),
239
242
  align: tableAlignmentSchema.optional()
240
243
  });
241
- var tableRowObjectSchema = z4.record(tableCellValueSchema, {
244
+ var tableRowObjectSchema = z5.record(tableCellValueSchema, {
242
245
  description: "Object row"
243
246
  });
244
- var tableRowPrimitiveSchema = z4.array(tableCellValueSchema, {
247
+ var tableRowPrimitiveSchema = z5.array(tableCellValueSchema, {
245
248
  description: "Primitive row"
246
249
  });
247
- var tableSharedSchema = z4.object({
248
- title: z4.string().optional().describe("Display title for table")
250
+ var tableSharedSchema = z5.object({
251
+ title: z5.string().optional().describe("Display title for table")
249
252
  });
250
253
  var tablePrimitiveSchema = tableSharedSchema.merge(
251
- z4.object(
254
+ z5.object(
252
255
  {
253
- columns: z4.array(tableAlignmentSchema).optional(),
254
- rows: z4.array(tableRowPrimitiveSchema)
256
+ columns: z5.array(tableAlignmentSchema).optional(),
257
+ rows: z5.array(tableRowPrimitiveSchema)
255
258
  },
256
259
  { description: "Table with primitive rows and optional alignment columns" }
257
260
  )
258
261
  );
259
262
  var tableObjectSchema = tableSharedSchema.merge(
260
- z4.object(
263
+ z5.object(
261
264
  {
262
- columns: z4.union([
263
- z4.array(tableAlignmentSchema),
264
- z4.array(tableColumnObjectSchema)
265
+ columns: z5.union([
266
+ z5.array(tableAlignmentSchema),
267
+ z5.array(tableColumnObjectSchema)
265
268
  ]).optional(),
266
- rows: z4.array(tableRowObjectSchema)
269
+ rows: z5.array(tableRowObjectSchema)
267
270
  },
268
271
  {
269
272
  description: "Table with object rows and optional alignment or object columns"
270
273
  }
271
274
  )
272
275
  );
273
- var tableSchema = (description = "Table information") => z4.union([tablePrimitiveSchema, tableObjectSchema], { description });
276
+ var tableSchema = (description = "Table information") => z5.union([tablePrimitiveSchema, tableObjectSchema], { description });
274
277
 
275
278
  // packages/models/src/lib/audit-output.ts
276
279
  var auditValueSchema = nonnegativeNumberSchema.describe("Raw numeric value");
277
- var auditDisplayValueSchema = z5.string({ description: "Formatted value (e.g. '0.9 s', '2.1 MB')" }).optional();
278
- var auditDetailsSchema = z5.object(
280
+ var auditDisplayValueSchema = z6.string({ description: "Formatted value (e.g. '0.9 s', '2.1 MB')" }).optional();
281
+ var auditDetailsSchema = z6.object(
279
282
  {
280
- issues: z5.array(issueSchema, { description: "List of findings" }).optional(),
283
+ issues: z6.array(issueSchema, { description: "List of findings" }).optional(),
281
284
  table: tableSchema("Table of related findings").optional()
282
285
  },
283
286
  { description: "Detailed information" }
284
287
  );
285
- var auditOutputSchema = z5.object(
288
+ var auditOutputSchema = z6.object(
286
289
  {
287
290
  slug: slugSchema.describe("Reference to audit"),
288
291
  displayValue: auditDisplayValueSchema,
@@ -292,7 +295,7 @@ var auditOutputSchema = z5.object(
292
295
  },
293
296
  { description: "Audit information" }
294
297
  );
295
- var auditOutputsSchema = z5.array(auditOutputSchema, {
298
+ var auditOutputsSchema = z6.array(auditOutputSchema, {
296
299
  description: "List of JSON formatted audit output emitted by the runner process of a plugin"
297
300
  }).refine(
298
301
  (audits) => !getDuplicateSlugsInAudits2(audits),
@@ -309,13 +312,13 @@ function getDuplicateSlugsInAudits2(audits) {
309
312
  }
310
313
 
311
314
  // packages/models/src/lib/category-config.ts
312
- import { z as z6 } from "zod";
315
+ import { z as z7 } from "zod";
313
316
  var categoryRefSchema = weightedRefSchema(
314
317
  "Weighted references to audits and/or groups for the category",
315
318
  "Slug of an audit or group (depending on `type`)"
316
319
  ).merge(
317
- z6.object({
318
- type: z6.enum(["audit", "group"], {
320
+ z7.object({
321
+ type: z7.enum(["audit", "group"], {
319
322
  description: "Discriminant for reference kind, affects where `slug` is looked up"
320
323
  }),
321
324
  plugin: slugSchema.describe(
@@ -336,8 +339,8 @@ var categoryConfigSchema = scorableSchema(
336
339
  description: "Meta info for category"
337
340
  })
338
341
  ).merge(
339
- z6.object({
340
- isBinary: z6.boolean({
342
+ z7.object({
343
+ isBinary: z7.boolean({
341
344
  description: 'Is this a binary category (i.e. only a perfect score considered a "pass")?'
342
345
  }).optional()
343
346
  })
@@ -353,7 +356,7 @@ function getDuplicateRefsInCategoryMetrics(metrics) {
353
356
  metrics.map(({ slug, type, plugin }) => `${type} :: ${plugin} / ${slug}`)
354
357
  );
355
358
  }
356
- var categoriesSchema = z6.array(categoryConfigSchema, {
359
+ var categoriesSchema = z7.array(categoryConfigSchema, {
357
360
  description: "Categorization of individual audits"
358
361
  }).refine(
359
362
  (categoryCfg) => !getDuplicateSlugCategories(categoryCfg),
@@ -372,18 +375,18 @@ function getDuplicateSlugCategories(categories) {
372
375
  }
373
376
 
374
377
  // packages/models/src/lib/commit.ts
375
- import { z as z7 } from "zod";
376
- var commitSchema = z7.object(
378
+ import { z as z8 } from "zod";
379
+ var commitSchema = z8.object(
377
380
  {
378
- hash: z7.string({ description: "Commit SHA (full)" }).regex(
381
+ hash: z8.string({ description: "Commit SHA (full)" }).regex(
379
382
  /^[\da-f]{40}$/,
380
383
  "Commit SHA should be a 40-character hexadecimal string"
381
384
  ),
382
- message: z7.string({ description: "Commit message" }),
383
- date: z7.coerce.date({
385
+ message: z8.string({ description: "Commit message" }),
386
+ date: z8.coerce.date({
384
387
  description: "Date and time when commit was authored"
385
388
  }),
386
- author: z7.string({
389
+ author: z8.string({
387
390
  description: "Commit author name"
388
391
  }).trim()
389
392
  },
@@ -391,22 +394,22 @@ var commitSchema = z7.object(
391
394
  );
392
395
 
393
396
  // packages/models/src/lib/core-config.ts
394
- import { z as z13 } from "zod";
397
+ import { z as z14 } from "zod";
395
398
 
396
399
  // packages/models/src/lib/persist-config.ts
397
- import { z as z8 } from "zod";
398
- var formatSchema = z8.enum(["json", "md"]);
399
- var persistConfigSchema = z8.object({
400
+ import { z as z9 } from "zod";
401
+ var formatSchema = z9.enum(["json", "md"]);
402
+ var persistConfigSchema = z9.object({
400
403
  outputDir: filePathSchema.describe("Artifacts folder").optional(),
401
404
  filename: fileNameSchema.describe("Artifacts file name (without extension)").optional(),
402
- format: z8.array(formatSchema).optional()
405
+ format: z9.array(formatSchema).optional()
403
406
  });
404
407
 
405
408
  // packages/models/src/lib/plugin-config.ts
406
- import { z as z11 } from "zod";
409
+ import { z as z12 } from "zod";
407
410
 
408
411
  // packages/models/src/lib/group.ts
409
- import { z as z9 } from "zod";
412
+ import { z as z10 } from "zod";
410
413
  var groupRefSchema = weightedRefSchema(
411
414
  "Weighted reference to a group",
412
415
  "Reference slug to a group within this plugin (e.g. 'max-lines')"
@@ -423,7 +426,7 @@ var groupSchema = scorableSchema(
423
426
  getDuplicateRefsInGroups,
424
427
  duplicateRefsInGroupsErrorMsg
425
428
  ).merge(groupMetaSchema);
426
- var groupsSchema = z9.array(groupSchema, {
429
+ var groupsSchema = z10.array(groupSchema, {
427
430
  description: "List of groups"
428
431
  }).optional().refine(
429
432
  (groups) => !getDuplicateSlugsInGroups(groups),
@@ -451,14 +454,14 @@ function getDuplicateSlugsInGroups(groups) {
451
454
  }
452
455
 
453
456
  // packages/models/src/lib/runner-config.ts
454
- import { z as z10 } from "zod";
455
- var outputTransformSchema = z10.function().args(z10.unknown()).returns(z10.union([auditOutputsSchema, z10.promise(auditOutputsSchema)]));
456
- var runnerConfigSchema = z10.object(
457
+ import { z as z11 } from "zod";
458
+ var outputTransformSchema = z11.function().args(z11.unknown()).returns(z11.union([auditOutputsSchema, z11.promise(auditOutputsSchema)]));
459
+ var runnerConfigSchema = z11.object(
457
460
  {
458
- command: z10.string({
461
+ command: z11.string({
459
462
  description: "Shell command to execute"
460
463
  }),
461
- args: z10.array(z10.string({ description: "Command arguments" })).optional(),
464
+ args: z11.array(z11.string({ description: "Command arguments" })).optional(),
462
465
  outputFile: filePathSchema.describe("Output path"),
463
466
  outputTransform: outputTransformSchema.optional()
464
467
  },
@@ -466,8 +469,8 @@ var runnerConfigSchema = z10.object(
466
469
  description: "How to execute runner"
467
470
  }
468
471
  );
469
- var onProgressSchema = z10.function().args(z10.unknown()).returns(z10.void());
470
- var runnerFunctionSchema = z10.function().args(onProgressSchema.optional()).returns(z10.union([auditOutputsSchema, z10.promise(auditOutputsSchema)]));
472
+ var onProgressSchema = z11.function().args(z11.unknown()).returns(z11.void());
473
+ var runnerFunctionSchema = z11.function().args(onProgressSchema.optional()).returns(z11.union([auditOutputsSchema, z11.promise(auditOutputsSchema)]));
471
474
 
472
475
  // packages/models/src/lib/plugin-config.ts
473
476
  var pluginMetaSchema = packageVersionSchema().merge(
@@ -478,13 +481,13 @@ var pluginMetaSchema = packageVersionSchema().merge(
478
481
  description: "Plugin metadata"
479
482
  })
480
483
  ).merge(
481
- z11.object({
484
+ z12.object({
482
485
  slug: slugSchema.describe("Unique plugin slug within core config"),
483
486
  icon: materialIconSchema
484
487
  })
485
488
  );
486
- var pluginDataSchema = z11.object({
487
- runner: z11.union([runnerConfigSchema, runnerFunctionSchema]),
489
+ var pluginDataSchema = z12.object({
490
+ runner: z12.union([runnerConfigSchema, runnerFunctionSchema]),
488
491
  audits: pluginAuditsSchema,
489
492
  groups: groupsSchema
490
493
  });
@@ -510,22 +513,22 @@ function getMissingRefsFromGroups(pluginCfg) {
510
513
  }
511
514
 
512
515
  // packages/models/src/lib/upload-config.ts
513
- import { z as z12 } from "zod";
514
- var uploadConfigSchema = z12.object({
516
+ import { z as z13 } from "zod";
517
+ var uploadConfigSchema = z13.object({
515
518
  server: urlSchema.describe("URL of deployed portal API"),
516
- apiKey: z12.string({
519
+ apiKey: z13.string({
517
520
  description: "API key with write access to portal (use `process.env` for security)"
518
521
  }),
519
522
  organization: slugSchema.describe(
520
523
  "Organization slug from Code PushUp portal"
521
524
  ),
522
525
  project: slugSchema.describe("Project slug from Code PushUp portal"),
523
- timeout: z12.number({ description: "Request timeout in minutes (default is 5)" }).positive().int().optional()
526
+ timeout: z13.number({ description: "Request timeout in minutes (default is 5)" }).positive().int().optional()
524
527
  });
525
528
 
526
529
  // packages/models/src/lib/core-config.ts
527
- var unrefinedCoreConfigSchema = z13.object({
528
- plugins: z13.array(pluginConfigSchema, {
530
+ var unrefinedCoreConfigSchema = z14.object({
531
+ plugins: z14.array(pluginConfigSchema, {
529
532
  description: "List of plugins to be used (official, community-provided, or custom)"
530
533
  }).min(1),
531
534
  /** portal configuration for persisting results */
@@ -548,7 +551,7 @@ function refineCoreConfig(schema) {
548
551
  }
549
552
 
550
553
  // packages/models/src/lib/report.ts
551
- import { z as z14 } from "zod";
554
+ import { z as z15 } from "zod";
552
555
  var auditReportSchema = auditSchema.merge(auditOutputSchema);
553
556
  var pluginReportSchema = pluginMetaSchema.merge(
554
557
  executionMetaSchema({
@@ -556,9 +559,9 @@ var pluginReportSchema = pluginMetaSchema.merge(
556
559
  descriptionDuration: "Duration of the plugin run in ms"
557
560
  })
558
561
  ).merge(
559
- z14.object({
560
- audits: z14.array(auditReportSchema).min(1),
561
- groups: z14.array(groupSchema).optional()
562
+ z15.object({
563
+ audits: z15.array(auditReportSchema).min(1),
564
+ groups: z15.array(groupSchema).optional()
562
565
  })
563
566
  ).refine(
564
567
  (pluginReport) => !getMissingRefsFromGroups2(pluginReport.audits, pluginReport.groups ?? []),
@@ -592,10 +595,10 @@ var reportSchema = packageVersionSchema({
592
595
  descriptionDuration: "Duration of the collect run in ms"
593
596
  })
594
597
  ).merge(
595
- z14.object(
598
+ z15.object(
596
599
  {
597
- categories: z14.array(categoryConfigSchema),
598
- plugins: z14.array(pluginReportSchema).min(1),
600
+ categories: z15.array(categoryConfigSchema),
601
+ plugins: z15.array(pluginReportSchema).min(1),
599
602
  commit: commitSchema.describe("Git commit for which report was collected").nullable()
600
603
  },
601
604
  { description: "Collect output data" }
@@ -611,40 +614,40 @@ var reportSchema = packageVersionSchema({
611
614
  );
612
615
 
613
616
  // packages/models/src/lib/reports-diff.ts
614
- import { z as z15 } from "zod";
617
+ import { z as z16 } from "zod";
615
618
  function makeComparisonSchema(schema) {
616
619
  const sharedDescription = schema.description || "Result";
617
- return z15.object({
620
+ return z16.object({
618
621
  before: schema.describe(`${sharedDescription} (source commit)`),
619
622
  after: schema.describe(`${sharedDescription} (target commit)`)
620
623
  });
621
624
  }
622
625
  function makeArraysComparisonSchema(diffSchema, resultSchema, description) {
623
- return z15.object(
626
+ return z16.object(
624
627
  {
625
- changed: z15.array(diffSchema),
626
- unchanged: z15.array(resultSchema),
627
- added: z15.array(resultSchema),
628
- removed: z15.array(resultSchema)
628
+ changed: z16.array(diffSchema),
629
+ unchanged: z16.array(resultSchema),
630
+ added: z16.array(resultSchema),
631
+ removed: z16.array(resultSchema)
629
632
  },
630
633
  { description }
631
634
  );
632
635
  }
633
- var scorableMetaSchema = z15.object({
636
+ var scorableMetaSchema = z16.object({
634
637
  slug: slugSchema,
635
638
  title: titleSchema,
636
639
  docsUrl: docsUrlSchema
637
640
  });
638
641
  var scorableWithPluginMetaSchema = scorableMetaSchema.merge(
639
- z15.object({
642
+ z16.object({
640
643
  plugin: pluginMetaSchema.pick({ slug: true, title: true, docsUrl: true }).describe("Plugin which defines it")
641
644
  })
642
645
  );
643
646
  var scorableDiffSchema = scorableMetaSchema.merge(
644
- z15.object({
647
+ z16.object({
645
648
  scores: makeComparisonSchema(scoreSchema).merge(
646
- z15.object({
647
- diff: z15.number().min(-1).max(1).describe("Score change (`scores.after - scores.before`)")
649
+ z16.object({
650
+ diff: z16.number().min(-1).max(1).describe("Score change (`scores.after - scores.before`)")
648
651
  })
649
652
  ).describe("Score comparison")
650
653
  })
@@ -655,10 +658,10 @@ var scorableWithPluginDiffSchema = scorableDiffSchema.merge(
655
658
  var categoryDiffSchema = scorableDiffSchema;
656
659
  var groupDiffSchema = scorableWithPluginDiffSchema;
657
660
  var auditDiffSchema = scorableWithPluginDiffSchema.merge(
658
- z15.object({
661
+ z16.object({
659
662
  values: makeComparisonSchema(auditValueSchema).merge(
660
- z15.object({
661
- diff: z15.number().int().describe("Value change (`values.after - values.before`)")
663
+ z16.object({
664
+ diff: z16.number().int().describe("Value change (`values.after - values.before`)")
662
665
  })
663
666
  ).describe("Audit `value` comparison"),
664
667
  displayValues: makeComparisonSchema(auditDisplayValueSchema).describe(
@@ -667,18 +670,18 @@ var auditDiffSchema = scorableWithPluginDiffSchema.merge(
667
670
  })
668
671
  );
669
672
  var categoryResultSchema = scorableMetaSchema.merge(
670
- z15.object({ score: scoreSchema })
673
+ z16.object({ score: scoreSchema })
671
674
  );
672
675
  var groupResultSchema = scorableWithPluginMetaSchema.merge(
673
- z15.object({ score: scoreSchema })
676
+ z16.object({ score: scoreSchema })
674
677
  );
675
678
  var auditResultSchema = scorableWithPluginMetaSchema.merge(
676
679
  auditOutputSchema.pick({ score: true, value: true, displayValue: true })
677
680
  );
678
- var reportsDiffSchema = z15.object({
681
+ var reportsDiffSchema = z16.object({
679
682
  commits: makeComparisonSchema(commitSchema).nullable().describe("Commits identifying compared reports"),
680
683
  portalUrl: urlSchema.optional().describe("Link to comparison page in Code PushUp portal"),
681
- label: z15.string().optional().describe("Label (e.g. project name)"),
684
+ label: z16.string().optional().describe("Label (e.g. project name)"),
682
685
  categories: makeArraysComparisonSchema(
683
686
  categoryDiffSchema,
684
687
  categoryResultSchema,
@@ -853,26 +856,26 @@ import { MarkdownDocument as MarkdownDocument4, md as md5 } from "build-md";
853
856
  import { bold as bold4, cyan, cyanBright, green as green2, red } from "ansis";
854
857
 
855
858
  // packages/plugin-eslint/src/lib/config.ts
856
- var patternsSchema = z16.union([z16.string(), z16.array(z16.string()).min(1)], {
859
+ var patternsSchema = z17.union([z17.string(), z17.array(z17.string()).min(1)], {
857
860
  description: "Lint target files. May contain file paths, directory paths or glob patterns"
858
861
  });
859
- var eslintrcSchema = z16.union(
862
+ var eslintrcSchema = z17.union(
860
863
  [
861
- z16.string({ description: "Path to ESLint config file" }),
862
- z16.record(z16.string(), z16.unknown(), {
864
+ z17.string({ description: "Path to ESLint config file" }),
865
+ z17.record(z17.string(), z17.unknown(), {
863
866
  description: "ESLint config object"
864
867
  })
865
868
  ],
866
869
  { description: "ESLint config as file path or inline object" }
867
870
  );
868
- var eslintTargetObjectSchema = z16.object({
871
+ var eslintTargetObjectSchema = z17.object({
869
872
  eslintrc: eslintrcSchema.optional(),
870
873
  patterns: patternsSchema
871
874
  });
872
- var eslintTargetSchema = z16.union([patternsSchema, eslintTargetObjectSchema]).transform(
875
+ var eslintTargetSchema = z17.union([patternsSchema, eslintTargetObjectSchema]).transform(
873
876
  (target) => typeof target === "string" || Array.isArray(target) ? { patterns: target } : target
874
877
  );
875
- var eslintPluginConfigSchema = z16.union([eslintTargetSchema, z16.array(eslintTargetSchema).min(1)]).transform(toArray);
878
+ var eslintPluginConfigSchema = z17.union([eslintTargetSchema, z17.array(eslintTargetSchema).min(1)]).transform(toArray);
876
879
 
877
880
  // packages/plugin-eslint/src/lib/meta/hash.ts
878
881
  import { createHash } from "node:crypto";
package/package.json CHANGED
@@ -1,11 +1,11 @@
1
1
  {
2
2
  "name": "@code-pushup/eslint-plugin",
3
- "version": "0.50.0",
3
+ "version": "0.52.0",
4
4
  "license": "MIT",
5
5
  "description": "Code PushUp plugin for detecting problems in source code using ESLint.📋",
6
6
  "dependencies": {
7
- "@code-pushup/utils": "0.50.0",
8
- "@code-pushup/models": "0.50.0",
7
+ "@code-pushup/utils": "0.52.0",
8
+ "@code-pushup/models": "0.52.0",
9
9
  "eslint": "^8.46.0",
10
10
  "zod": "^3.22.4"
11
11
  },
@@ -26,6 +26,9 @@
26
26
  "url": "git+https://github.com/code-pushup/cli.git",
27
27
  "directory": "packages/plugin-eslint"
28
28
  },
29
+ "publishConfig": {
30
+ "access": "public"
31
+ },
29
32
  "type": "module",
30
33
  "main": "./index.js",
31
34
  "types": "./src/index.d.ts"