@code-pushup/eslint-plugin 0.25.7 → 0.26.1

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 +51 -31
  2. package/index.js +52 -32
  3. package/package.json +1 -1
package/bin.js CHANGED
@@ -316,23 +316,42 @@ function getDuplicateSlugCategories(categories) {
316
316
  return hasDuplicateStrings(categories.map(({ slug }) => slug));
317
317
  }
318
318
 
319
+ // packages/models/src/lib/commit.ts
320
+ import { z as z6 } from "zod";
321
+ var commitSchema = z6.object(
322
+ {
323
+ hash: z6.string({ description: "Commit SHA (full)" }).regex(
324
+ /^[\da-f]{40}$/,
325
+ "Commit SHA should be a 40-character hexadecimal string"
326
+ ),
327
+ message: z6.string({ description: "Commit message" }),
328
+ date: z6.coerce.date({
329
+ description: "Date and time when commit was authored"
330
+ }),
331
+ author: z6.string({
332
+ description: "Commit author name"
333
+ }).trim()
334
+ },
335
+ { description: "Git commit" }
336
+ );
337
+
319
338
  // packages/models/src/lib/core-config.ts
320
- import { z as z11 } from "zod";
339
+ import { z as z12 } from "zod";
321
340
 
322
341
  // packages/models/src/lib/persist-config.ts
323
- import { z as z6 } from "zod";
324
- var formatSchema = z6.enum(["json", "md"]);
325
- var persistConfigSchema = z6.object({
342
+ import { z as z7 } from "zod";
343
+ var formatSchema = z7.enum(["json", "md"]);
344
+ var persistConfigSchema = z7.object({
326
345
  outputDir: filePathSchema.describe("Artifacts folder").optional(),
327
346
  filename: fileNameSchema.describe("Artifacts file name (without extension)").optional(),
328
- format: z6.array(formatSchema).optional()
347
+ format: z7.array(formatSchema).optional()
329
348
  });
330
349
 
331
350
  // packages/models/src/lib/plugin-config.ts
332
- import { z as z9 } from "zod";
351
+ import { z as z10 } from "zod";
333
352
 
334
353
  // packages/models/src/lib/group.ts
335
- import { z as z7 } from "zod";
354
+ import { z as z8 } from "zod";
336
355
  var groupRefSchema = weightedRefSchema(
337
356
  "Weighted reference to a group",
338
357
  "Reference slug to a group within this plugin (e.g. 'max-lines')"
@@ -349,7 +368,7 @@ var groupSchema = scorableSchema(
349
368
  getDuplicateRefsInGroups,
350
369
  duplicateRefsInGroupsErrorMsg
351
370
  ).merge(groupMetaSchema);
352
- var groupsSchema = z7.array(groupSchema, {
371
+ var groupsSchema = z8.array(groupSchema, {
353
372
  description: "List of groups"
354
373
  }).optional().refine(
355
374
  (groups) => !getDuplicateSlugsInGroups(groups),
@@ -377,14 +396,14 @@ function getDuplicateSlugsInGroups(groups) {
377
396
  }
378
397
 
379
398
  // packages/models/src/lib/runner-config.ts
380
- import { z as z8 } from "zod";
381
- var outputTransformSchema = z8.function().args(z8.unknown()).returns(z8.union([auditOutputsSchema, z8.promise(auditOutputsSchema)]));
382
- var runnerConfigSchema = z8.object(
399
+ import { z as z9 } from "zod";
400
+ var outputTransformSchema = z9.function().args(z9.unknown()).returns(z9.union([auditOutputsSchema, z9.promise(auditOutputsSchema)]));
401
+ var runnerConfigSchema = z9.object(
383
402
  {
384
- command: z8.string({
403
+ command: z9.string({
385
404
  description: "Shell command to execute"
386
405
  }),
387
- args: z8.array(z8.string({ description: "Command arguments" })).optional(),
406
+ args: z9.array(z9.string({ description: "Command arguments" })).optional(),
388
407
  outputFile: filePathSchema.describe("Output path"),
389
408
  outputTransform: outputTransformSchema.optional()
390
409
  },
@@ -392,8 +411,8 @@ var runnerConfigSchema = z8.object(
392
411
  description: "How to execute runner"
393
412
  }
394
413
  );
395
- var onProgressSchema = z8.function().args(z8.unknown()).returns(z8.void());
396
- var runnerFunctionSchema = z8.function().args(onProgressSchema.optional()).returns(z8.union([auditOutputsSchema, z8.promise(auditOutputsSchema)]));
414
+ var onProgressSchema = z9.function().args(z9.unknown()).returns(z9.void());
415
+ var runnerFunctionSchema = z9.function().args(onProgressSchema.optional()).returns(z9.union([auditOutputsSchema, z9.promise(auditOutputsSchema)]));
397
416
 
398
417
  // packages/models/src/lib/plugin-config.ts
399
418
  var pluginMetaSchema = packageVersionSchema().merge(
@@ -404,13 +423,13 @@ var pluginMetaSchema = packageVersionSchema().merge(
404
423
  description: "Plugin metadata"
405
424
  })
406
425
  ).merge(
407
- z9.object({
426
+ z10.object({
408
427
  slug: slugSchema.describe("Unique plugin slug within core config"),
409
428
  icon: materialIconSchema
410
429
  })
411
430
  );
412
- var pluginDataSchema = z9.object({
413
- runner: z9.union([runnerConfigSchema, runnerFunctionSchema]),
431
+ var pluginDataSchema = z10.object({
432
+ runner: z10.union([runnerConfigSchema, runnerFunctionSchema]),
414
433
  audits: pluginAuditsSchema,
415
434
  groups: groupsSchema
416
435
  });
@@ -436,22 +455,22 @@ function getMissingRefsFromGroups(pluginCfg) {
436
455
  }
437
456
 
438
457
  // packages/models/src/lib/upload-config.ts
439
- import { z as z10 } from "zod";
440
- var uploadConfigSchema = z10.object({
458
+ import { z as z11 } from "zod";
459
+ var uploadConfigSchema = z11.object({
441
460
  server: urlSchema.describe("URL of deployed portal API"),
442
- apiKey: z10.string({
461
+ apiKey: z11.string({
443
462
  description: "API key with write access to portal (use `process.env` for security)"
444
463
  }),
445
464
  organization: slugSchema.describe(
446
465
  "Organization slug from Code PushUp portal"
447
466
  ),
448
467
  project: slugSchema.describe("Project slug from Code PushUp portal"),
449
- timeout: z10.number({ description: "Request timeout in minutes (default is 5)" }).positive().int().optional()
468
+ timeout: z11.number({ description: "Request timeout in minutes (default is 5)" }).positive().int().optional()
450
469
  });
451
470
 
452
471
  // packages/models/src/lib/core-config.ts
453
- var unrefinedCoreConfigSchema = z11.object({
454
- plugins: z11.array(pluginConfigSchema, {
472
+ var unrefinedCoreConfigSchema = z12.object({
473
+ plugins: z12.array(pluginConfigSchema, {
455
474
  description: "List of plugins to be used (official, community-provided, or custom)"
456
475
  }).min(1),
457
476
  /** portal configuration for persisting results */
@@ -474,7 +493,7 @@ function refineCoreConfig(schema) {
474
493
  }
475
494
 
476
495
  // packages/models/src/lib/report.ts
477
- import { z as z12 } from "zod";
496
+ import { z as z13 } from "zod";
478
497
  var auditReportSchema = auditSchema.merge(auditOutputSchema);
479
498
  var pluginReportSchema = pluginMetaSchema.merge(
480
499
  executionMetaSchema({
@@ -482,9 +501,9 @@ var pluginReportSchema = pluginMetaSchema.merge(
482
501
  descriptionDuration: "Duration of the plugin run in ms"
483
502
  })
484
503
  ).merge(
485
- z12.object({
486
- audits: z12.array(auditReportSchema).min(1),
487
- groups: z12.array(groupSchema).optional()
504
+ z13.object({
505
+ audits: z13.array(auditReportSchema).min(1),
506
+ groups: z13.array(groupSchema).optional()
488
507
  })
489
508
  ).refine(
490
509
  (pluginReport) => !getMissingRefsFromGroups2(pluginReport.audits, pluginReport.groups ?? []),
@@ -518,10 +537,11 @@ var reportSchema = packageVersionSchema({
518
537
  descriptionDuration: "Duration of the collect run in ms"
519
538
  })
520
539
  ).merge(
521
- z12.object(
540
+ z13.object(
522
541
  {
523
- categories: z12.array(categoryConfigSchema),
524
- plugins: z12.array(pluginReportSchema).min(1)
542
+ categories: z13.array(categoryConfigSchema),
543
+ plugins: z13.array(pluginReportSchema).min(1),
544
+ commit: commitSchema.describe("Git commit for which report was collected").nullable()
525
545
  },
526
546
  { description: "Collect output data" }
527
547
  )
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.25.7";
8
+ var version = "0.26.1";
9
9
 
10
10
  // packages/plugin-eslint/src/lib/config.ts
11
11
  import { z } from "zod";
@@ -338,23 +338,42 @@ function getDuplicateSlugCategories(categories) {
338
338
  return hasDuplicateStrings(categories.map(({ slug }) => slug));
339
339
  }
340
340
 
341
+ // packages/models/src/lib/commit.ts
342
+ import { z as z7 } from "zod";
343
+ var commitSchema = z7.object(
344
+ {
345
+ hash: z7.string({ description: "Commit SHA (full)" }).regex(
346
+ /^[\da-f]{40}$/,
347
+ "Commit SHA should be a 40-character hexadecimal string"
348
+ ),
349
+ message: z7.string({ description: "Commit message" }),
350
+ date: z7.coerce.date({
351
+ description: "Date and time when commit was authored"
352
+ }),
353
+ author: z7.string({
354
+ description: "Commit author name"
355
+ }).trim()
356
+ },
357
+ { description: "Git commit" }
358
+ );
359
+
341
360
  // packages/models/src/lib/core-config.ts
342
- import { z as z12 } from "zod";
361
+ import { z as z13 } from "zod";
343
362
 
344
363
  // packages/models/src/lib/persist-config.ts
345
- import { z as z7 } from "zod";
346
- var formatSchema = z7.enum(["json", "md"]);
347
- var persistConfigSchema = z7.object({
364
+ import { z as z8 } from "zod";
365
+ var formatSchema = z8.enum(["json", "md"]);
366
+ var persistConfigSchema = z8.object({
348
367
  outputDir: filePathSchema.describe("Artifacts folder").optional(),
349
368
  filename: fileNameSchema.describe("Artifacts file name (without extension)").optional(),
350
- format: z7.array(formatSchema).optional()
369
+ format: z8.array(formatSchema).optional()
351
370
  });
352
371
 
353
372
  // packages/models/src/lib/plugin-config.ts
354
- import { z as z10 } from "zod";
373
+ import { z as z11 } from "zod";
355
374
 
356
375
  // packages/models/src/lib/group.ts
357
- import { z as z8 } from "zod";
376
+ import { z as z9 } from "zod";
358
377
  var groupRefSchema = weightedRefSchema(
359
378
  "Weighted reference to a group",
360
379
  "Reference slug to a group within this plugin (e.g. 'max-lines')"
@@ -371,7 +390,7 @@ var groupSchema = scorableSchema(
371
390
  getDuplicateRefsInGroups,
372
391
  duplicateRefsInGroupsErrorMsg
373
392
  ).merge(groupMetaSchema);
374
- var groupsSchema = z8.array(groupSchema, {
393
+ var groupsSchema = z9.array(groupSchema, {
375
394
  description: "List of groups"
376
395
  }).optional().refine(
377
396
  (groups) => !getDuplicateSlugsInGroups(groups),
@@ -399,14 +418,14 @@ function getDuplicateSlugsInGroups(groups) {
399
418
  }
400
419
 
401
420
  // packages/models/src/lib/runner-config.ts
402
- import { z as z9 } from "zod";
403
- var outputTransformSchema = z9.function().args(z9.unknown()).returns(z9.union([auditOutputsSchema, z9.promise(auditOutputsSchema)]));
404
- var runnerConfigSchema = z9.object(
421
+ import { z as z10 } from "zod";
422
+ var outputTransformSchema = z10.function().args(z10.unknown()).returns(z10.union([auditOutputsSchema, z10.promise(auditOutputsSchema)]));
423
+ var runnerConfigSchema = z10.object(
405
424
  {
406
- command: z9.string({
425
+ command: z10.string({
407
426
  description: "Shell command to execute"
408
427
  }),
409
- args: z9.array(z9.string({ description: "Command arguments" })).optional(),
428
+ args: z10.array(z10.string({ description: "Command arguments" })).optional(),
410
429
  outputFile: filePathSchema.describe("Output path"),
411
430
  outputTransform: outputTransformSchema.optional()
412
431
  },
@@ -414,8 +433,8 @@ var runnerConfigSchema = z9.object(
414
433
  description: "How to execute runner"
415
434
  }
416
435
  );
417
- var onProgressSchema = z9.function().args(z9.unknown()).returns(z9.void());
418
- var runnerFunctionSchema = z9.function().args(onProgressSchema.optional()).returns(z9.union([auditOutputsSchema, z9.promise(auditOutputsSchema)]));
436
+ var onProgressSchema = z10.function().args(z10.unknown()).returns(z10.void());
437
+ var runnerFunctionSchema = z10.function().args(onProgressSchema.optional()).returns(z10.union([auditOutputsSchema, z10.promise(auditOutputsSchema)]));
419
438
 
420
439
  // packages/models/src/lib/plugin-config.ts
421
440
  var pluginMetaSchema = packageVersionSchema().merge(
@@ -426,13 +445,13 @@ var pluginMetaSchema = packageVersionSchema().merge(
426
445
  description: "Plugin metadata"
427
446
  })
428
447
  ).merge(
429
- z10.object({
448
+ z11.object({
430
449
  slug: slugSchema.describe("Unique plugin slug within core config"),
431
450
  icon: materialIconSchema
432
451
  })
433
452
  );
434
- var pluginDataSchema = z10.object({
435
- runner: z10.union([runnerConfigSchema, runnerFunctionSchema]),
453
+ var pluginDataSchema = z11.object({
454
+ runner: z11.union([runnerConfigSchema, runnerFunctionSchema]),
436
455
  audits: pluginAuditsSchema,
437
456
  groups: groupsSchema
438
457
  });
@@ -458,22 +477,22 @@ function getMissingRefsFromGroups(pluginCfg) {
458
477
  }
459
478
 
460
479
  // packages/models/src/lib/upload-config.ts
461
- import { z as z11 } from "zod";
462
- var uploadConfigSchema = z11.object({
480
+ import { z as z12 } from "zod";
481
+ var uploadConfigSchema = z12.object({
463
482
  server: urlSchema.describe("URL of deployed portal API"),
464
- apiKey: z11.string({
483
+ apiKey: z12.string({
465
484
  description: "API key with write access to portal (use `process.env` for security)"
466
485
  }),
467
486
  organization: slugSchema.describe(
468
487
  "Organization slug from Code PushUp portal"
469
488
  ),
470
489
  project: slugSchema.describe("Project slug from Code PushUp portal"),
471
- timeout: z11.number({ description: "Request timeout in minutes (default is 5)" }).positive().int().optional()
490
+ timeout: z12.number({ description: "Request timeout in minutes (default is 5)" }).positive().int().optional()
472
491
  });
473
492
 
474
493
  // packages/models/src/lib/core-config.ts
475
- var unrefinedCoreConfigSchema = z12.object({
476
- plugins: z12.array(pluginConfigSchema, {
494
+ var unrefinedCoreConfigSchema = z13.object({
495
+ plugins: z13.array(pluginConfigSchema, {
477
496
  description: "List of plugins to be used (official, community-provided, or custom)"
478
497
  }).min(1),
479
498
  /** portal configuration for persisting results */
@@ -496,7 +515,7 @@ function refineCoreConfig(schema) {
496
515
  }
497
516
 
498
517
  // packages/models/src/lib/report.ts
499
- import { z as z13 } from "zod";
518
+ import { z as z14 } from "zod";
500
519
  var auditReportSchema = auditSchema.merge(auditOutputSchema);
501
520
  var pluginReportSchema = pluginMetaSchema.merge(
502
521
  executionMetaSchema({
@@ -504,9 +523,9 @@ var pluginReportSchema = pluginMetaSchema.merge(
504
523
  descriptionDuration: "Duration of the plugin run in ms"
505
524
  })
506
525
  ).merge(
507
- z13.object({
508
- audits: z13.array(auditReportSchema).min(1),
509
- groups: z13.array(groupSchema).optional()
526
+ z14.object({
527
+ audits: z14.array(auditReportSchema).min(1),
528
+ groups: z14.array(groupSchema).optional()
510
529
  })
511
530
  ).refine(
512
531
  (pluginReport) => !getMissingRefsFromGroups2(pluginReport.audits, pluginReport.groups ?? []),
@@ -540,10 +559,11 @@ var reportSchema = packageVersionSchema({
540
559
  descriptionDuration: "Duration of the collect run in ms"
541
560
  })
542
561
  ).merge(
543
- z13.object(
562
+ z14.object(
544
563
  {
545
- categories: z13.array(categoryConfigSchema),
546
- plugins: z13.array(pluginReportSchema).min(1)
564
+ categories: z14.array(categoryConfigSchema),
565
+ plugins: z14.array(pluginReportSchema).min(1),
566
+ commit: commitSchema.describe("Git commit for which report was collected").nullable()
547
567
  },
548
568
  { description: "Collect output data" }
549
569
  )
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@code-pushup/eslint-plugin",
3
- "version": "0.25.7",
3
+ "version": "0.26.1",
4
4
  "license": "MIT",
5
5
  "dependencies": {
6
6
  "@code-pushup/utils": "*",