@code-pushup/eslint-plugin 0.18.1 → 0.20.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.
package/bin.js CHANGED
@@ -79,25 +79,15 @@ function executionMetaSchema(options = {
79
79
  duration: z.number({ description: options.descriptionDuration })
80
80
  });
81
81
  }
82
- function slugSchema(description = "Unique ID (human-readable, URL-safe)") {
83
- return z.string({ description }).regex(slugRegex, {
84
- message: "The slug has to follow the pattern [0-9a-z] followed by multiple optional groups of -[0-9a-z]. e.g. my-slug"
85
- }).max(MAX_SLUG_LENGTH, {
86
- message: `slug can be max ${MAX_SLUG_LENGTH} characters long`
87
- });
88
- }
89
- function descriptionSchema(description = "Description (markdown)") {
90
- return z.string({ description }).max(MAX_DESCRIPTION_LENGTH).optional();
91
- }
92
- function docsUrlSchema(description = "Documentation site") {
93
- return urlSchema(description).optional().or(z.string().max(0));
94
- }
95
- function urlSchema(description) {
96
- return z.string({ description }).url();
97
- }
98
- function titleSchema(description = "Descriptive name") {
99
- return z.string({ description }).max(MAX_TITLE_LENGTH);
100
- }
82
+ var slugSchema = z.string({ description: "Unique ID (human-readable, URL-safe)" }).regex(slugRegex, {
83
+ message: "The slug has to follow the pattern [0-9a-z] followed by multiple optional groups of -[0-9a-z]. e.g. my-slug"
84
+ }).max(MAX_SLUG_LENGTH, {
85
+ message: `slug can be max ${MAX_SLUG_LENGTH} characters long`
86
+ });
87
+ var descriptionSchema = z.string({ description: "Description (markdown)" }).max(MAX_DESCRIPTION_LENGTH).optional();
88
+ var urlSchema = z.string().url();
89
+ var docsUrlSchema = urlSchema.optional().or(z.literal("")).describe("Documentation site");
90
+ var titleSchema = z.string({ description: "Descriptive name" }).max(MAX_TITLE_LENGTH);
101
91
  function metaSchema(options) {
102
92
  const {
103
93
  descriptionDescription,
@@ -107,24 +97,19 @@ function metaSchema(options) {
107
97
  } = options ?? {};
108
98
  return z.object(
109
99
  {
110
- title: titleSchema(titleDescription),
111
- description: descriptionSchema(descriptionDescription),
112
- docsUrl: docsUrlSchema(docsUrlDescription)
100
+ title: titleDescription ? titleSchema.describe(titleDescription) : titleSchema,
101
+ description: descriptionDescription ? descriptionSchema.describe(descriptionDescription) : descriptionSchema,
102
+ docsUrl: docsUrlDescription ? docsUrlSchema.describe(docsUrlDescription) : docsUrlSchema
113
103
  },
114
104
  { description }
115
105
  );
116
106
  }
117
- function filePathSchema(description) {
118
- return z.string({ description }).trim().min(1, { message: "path is invalid" });
119
- }
120
- function fileNameSchema(description) {
121
- return z.string({ description }).trim().regex(filenameRegex, {
122
- message: `The filename has to be valid`
123
- }).min(1, { message: "file name is invalid" });
124
- }
125
- function positiveIntSchema(description) {
126
- return z.number({ description }).int().nonnegative();
127
- }
107
+ var filePathSchema = z.string().trim().min(1, { message: "path is invalid" });
108
+ var fileNameSchema = z.string().trim().regex(filenameRegex, {
109
+ message: `The filename has to be valid`
110
+ }).min(1, { message: "file name is invalid" });
111
+ var positiveIntSchema = z.number().int().positive();
112
+ var nonnegativeIntSchema = z.number().int().nonnegative();
128
113
  function packageVersionSchema(options) {
129
114
  const { versionDescription = "NPM version of the package", required } = options ?? {};
130
115
  const packageSchema = z.string({ description: "NPM package name" });
@@ -137,14 +122,14 @@ function packageVersionSchema(options) {
137
122
  { description: "NPM package name and version of a published package" }
138
123
  );
139
124
  }
140
- function weightSchema(description = "Coefficient for the given score (use weight 0 if only for display)") {
141
- return positiveIntSchema(description);
142
- }
125
+ var weightSchema = nonnegativeIntSchema.describe(
126
+ "Coefficient for the given score (use weight 0 if only for display)"
127
+ );
143
128
  function weightedRefSchema(description, slugDescription) {
144
129
  return z.object(
145
130
  {
146
- slug: slugSchema(slugDescription),
147
- weight: weightSchema("Weight used to calculate score")
131
+ slug: slugSchema.describe(slugDescription),
132
+ weight: weightSchema.describe("Weight used to calculate score")
148
133
  },
149
134
  { description }
150
135
  );
@@ -152,14 +137,14 @@ function weightedRefSchema(description, slugDescription) {
152
137
  function scorableSchema(description, refSchema, duplicateCheckFn, duplicateMessageFn) {
153
138
  return z.object(
154
139
  {
155
- slug: slugSchema('Human-readable unique ID, e.g. "performance"'),
140
+ slug: slugSchema.describe('Human-readable unique ID, e.g. "performance"'),
156
141
  refs: z.array(refSchema).min(1).refine(
157
142
  (refs) => !duplicateCheckFn(refs),
158
143
  (refs) => ({
159
144
  message: duplicateMessageFn(refs)
160
145
  })
161
- ).refine(hasWeightedRefsInCategories, () => ({
162
- message: `In a category there has to be at least one ref with weight > 0`
146
+ ).refine(hasNonZeroWeightedRef, () => ({
147
+ message: "In a category there has to be at least one ref with weight > 0"
163
148
  }))
164
149
  },
165
150
  { description }
@@ -168,13 +153,13 @@ function scorableSchema(description, refSchema, duplicateCheckFn, duplicateMessa
168
153
  var materialIconSchema = z.enum(MATERIAL_ICONS, {
169
154
  description: "Icon from VSCode Material Icons extension"
170
155
  });
171
- function hasWeightedRefsInCategories(categoryRefs) {
172
- return categoryRefs.reduce((acc, { weight }) => weight + acc, 0) !== 0;
156
+ function hasNonZeroWeightedRef(refs) {
157
+ return refs.reduce((acc, { weight }) => weight + acc, 0) !== 0;
173
158
  }
174
159
 
175
160
  // packages/models/src/lib/audit.ts
176
161
  var auditSchema = z2.object({
177
- slug: slugSchema("ID (unique within plugin)")
162
+ slug: slugSchema.describe("ID (unique within plugin)")
178
163
  }).merge(
179
164
  metaSchema({
180
165
  titleDescription: "Descriptive name",
@@ -201,17 +186,20 @@ function getDuplicateSlugsInAudits(audits) {
201
186
  return hasDuplicateStrings(audits.map(({ slug }) => slug));
202
187
  }
203
188
 
204
- // packages/models/src/lib/audit-issue.ts
189
+ // packages/models/src/lib/audit-output.ts
190
+ import { z as z4 } from "zod";
191
+
192
+ // packages/models/src/lib/issue.ts
205
193
  import { z as z3 } from "zod";
206
194
  var sourceFileLocationSchema = z3.object(
207
195
  {
208
- file: filePathSchema("Relative path to source file in Git repo"),
196
+ file: filePathSchema.describe("Relative path to source file in Git repo"),
209
197
  position: z3.object(
210
198
  {
211
- startLine: positiveIntSchema("Start line"),
212
- startColumn: positiveIntSchema("Start column").optional(),
213
- endLine: positiveIntSchema("End line").optional(),
214
- endColumn: positiveIntSchema("End column").optional()
199
+ startLine: positiveIntSchema.describe("Start line"),
200
+ startColumn: positiveIntSchema.describe("Start column").optional(),
201
+ endLine: positiveIntSchema.describe("End line").optional(),
202
+ endColumn: positiveIntSchema.describe("End column").optional()
215
203
  },
216
204
  { description: "Location in file" }
217
205
  ).optional()
@@ -231,21 +219,21 @@ var issueSchema = z3.object(
231
219
  );
232
220
 
233
221
  // packages/models/src/lib/audit-output.ts
234
- import { z as z4 } from "zod";
222
+ var auditDetailsSchema = z4.object(
223
+ {
224
+ issues: z4.array(issueSchema, { description: "List of findings" })
225
+ },
226
+ { description: "Detailed information" }
227
+ );
235
228
  var auditOutputSchema = z4.object(
236
229
  {
237
- slug: slugSchema("Reference to audit"),
230
+ slug: slugSchema.describe("Reference to audit"),
238
231
  displayValue: z4.string({ description: "Formatted value (e.g. '0.9 s', '2.1 MB')" }).optional(),
239
- value: positiveIntSchema("Raw numeric value"),
232
+ value: nonnegativeIntSchema.describe("Raw numeric value"),
240
233
  score: z4.number({
241
234
  description: "Value between 0 and 1"
242
235
  }).min(0).max(1),
243
- details: z4.object(
244
- {
245
- issues: z4.array(issueSchema, { description: "List of findings" })
246
- },
247
- { description: "Detailed information" }
248
- ).optional()
236
+ details: auditDetailsSchema.optional()
249
237
  },
250
238
  { description: "Audit information" }
251
239
  );
@@ -275,7 +263,7 @@ var categoryRefSchema = weightedRefSchema(
275
263
  type: z5.enum(["audit", "group"], {
276
264
  description: "Discriminant for reference kind, affects where `slug` is looked up"
277
265
  }),
278
- plugin: slugSchema(
266
+ plugin: slugSchema.describe(
279
267
  "Plugin slug (plugin should contain referenced audit or group)"
280
268
  )
281
269
  })
@@ -335,10 +323,8 @@ import { z as z11 } from "zod";
335
323
  import { z as z6 } from "zod";
336
324
  var formatSchema = z6.enum(["json", "md"]);
337
325
  var persistConfigSchema = z6.object({
338
- outputDir: filePathSchema("Artifacts folder").optional(),
339
- filename: fileNameSchema(
340
- "Artifacts file name (without extension)"
341
- ).optional(),
326
+ outputDir: filePathSchema.describe("Artifacts folder").optional(),
327
+ filename: fileNameSchema.describe("Artifacts file name (without extension)").optional(),
342
328
  format: z6.array(formatSchema).optional()
343
329
  });
344
330
 
@@ -399,7 +385,7 @@ var runnerConfigSchema = z8.object(
399
385
  description: "Shell command to execute"
400
386
  }),
401
387
  args: z8.array(z8.string({ description: "Command arguments" })).optional(),
402
- outputFile: filePathSchema("Output path"),
388
+ outputFile: filePathSchema.describe("Output path"),
403
389
  outputTransform: outputTransformSchema.optional()
404
390
  },
405
391
  {
@@ -419,7 +405,7 @@ var pluginMetaSchema = packageVersionSchema().merge(
419
405
  })
420
406
  ).merge(
421
407
  z9.object({
422
- slug: slugSchema("Unique plugin slug within core config"),
408
+ slug: slugSchema.describe("Unique plugin slug within core config"),
423
409
  icon: materialIconSchema
424
410
  })
425
411
  );
@@ -452,12 +438,14 @@ function getMissingRefsFromGroups(pluginCfg) {
452
438
  // packages/models/src/lib/upload-config.ts
453
439
  import { z as z10 } from "zod";
454
440
  var uploadConfigSchema = z10.object({
455
- server: urlSchema("URL of deployed portal API"),
441
+ server: urlSchema.describe("URL of deployed portal API"),
456
442
  apiKey: z10.string({
457
443
  description: "API key with write access to portal (use `process.env` for security)"
458
444
  }),
459
- organization: slugSchema("Organization slug from Code PushUp portal"),
460
- project: slugSchema("Project slug from Code PushUp portal"),
445
+ organization: slugSchema.describe(
446
+ "Organization slug from Code PushUp portal"
447
+ ),
448
+ project: slugSchema.describe("Project slug from Code PushUp portal"),
461
449
  timeout: z10.number({ description: "Request timeout in minutes (default is 5)" }).positive().int().optional()
462
450
  });
463
451
 
@@ -603,19 +591,6 @@ function compareIssueSeverity(severity1, severity2) {
603
591
  return levels[severity1] - levels[severity2];
604
592
  }
605
593
 
606
- // packages/utils/src/lib/git.ts
607
- import { simpleGit } from "simple-git";
608
- var git = simpleGit();
609
-
610
- // packages/utils/src/lib/progress.ts
611
- import chalk2 from "chalk";
612
- import { MultiProgressBars } from "multi-progress-bars";
613
-
614
- // packages/utils/src/lib/reports/generate-stdout-summary.ts
615
- import cliui from "@isaacs/cliui";
616
- import chalk3 from "chalk";
617
- import CliTable3 from "cli-table3";
618
-
619
594
  // packages/utils/src/lib/transform.ts
620
595
  function toArray(val) {
621
596
  return Array.isArray(val) ? val : [val];
@@ -632,16 +607,21 @@ function countOccurrences(values) {
632
607
  function distinct(array) {
633
608
  return [...new Set(array)];
634
609
  }
635
- function toUnixPath(path, options) {
636
- const unixPath = path.replace(/\\/g, "/");
637
- if (options?.toRelative) {
638
- return unixPath.replace(`${process.cwd().replace(/\\/g, "/")}/`, "");
639
- }
640
- return unixPath;
641
- }
610
+
611
+ // packages/utils/src/lib/git.ts
612
+ import { simpleGit } from "simple-git";
642
613
 
643
614
  // packages/utils/src/lib/logging.ts
615
+ import chalk2 from "chalk";
616
+
617
+ // packages/utils/src/lib/progress.ts
618
+ import chalk3 from "chalk";
619
+ import { MultiProgressBars } from "multi-progress-bars";
620
+
621
+ // packages/utils/src/lib/reports/generate-stdout-summary.ts
622
+ import cliui from "@isaacs/cliui";
644
623
  import chalk4 from "chalk";
624
+ import CliTable3 from "cli-table3";
645
625
 
646
626
  // packages/plugin-eslint/src/lib/setup.ts
647
627
  import { ESLint } from "eslint";
@@ -659,15 +639,9 @@ async function lint({
659
639
  patterns
660
640
  }) {
661
641
  const eslint = setupESLint(eslintrc);
662
- const lintResults = await eslint.lintFiles(patterns);
663
- const results = lintResults.map(
664
- (result) => ({
665
- ...result,
666
- relativeFilePath: toUnixPath(result.filePath, { toRelative: true })
667
- })
668
- );
642
+ const results = await eslint.lintFiles(patterns);
669
643
  const ruleOptionsPerFile = await results.reduce(
670
- async (acc, { filePath, relativeFilePath, messages }) => {
644
+ async (acc, { filePath, messages }) => {
671
645
  const filesMap = await acc;
672
646
  const config = await eslint.calculateConfigForFile(
673
647
  filePath
@@ -683,8 +657,8 @@ async function lint({
683
657
  );
684
658
  return {
685
659
  ...filesMap,
686
- [relativeFilePath]: {
687
- ...filesMap[relativeFilePath],
660
+ [filePath]: {
661
+ ...filesMap[filePath],
688
662
  ...rulesMap
689
663
  }
690
664
  };
@@ -713,14 +687,14 @@ function lintResultsToAudits({
713
687
  ruleOptionsPerFile
714
688
  }) {
715
689
  const issuesPerAudit = results.flatMap(
716
- ({ messages, relativeFilePath }) => messages.map((message) => ({ ...message, relativeFilePath }))
690
+ ({ messages, filePath }) => messages.map((message) => ({ ...message, filePath }))
717
691
  ).reduce((acc, issue) => {
718
- const { ruleId, message, relativeFilePath } = issue;
692
+ const { ruleId, message, filePath } = issue;
719
693
  if (!ruleId) {
720
694
  console.warn(`ESLint core error - ${message}`);
721
695
  return acc;
722
696
  }
723
- const options = ruleOptionsPerFile[relativeFilePath]?.[ruleId] ?? [];
697
+ const options = ruleOptionsPerFile[filePath]?.[ruleId] ?? [];
724
698
  const auditSlug = ruleIdToSlug(ruleId, options);
725
699
  return { ...acc, [auditSlug]: [...acc[auditSlug] ?? [], issue] };
726
700
  }, {});
@@ -748,7 +722,7 @@ function convertIssue(issue) {
748
722
  message: truncateIssueMessage(issue.message),
749
723
  severity: convertSeverity(issue.severity),
750
724
  source: {
751
- file: issue.relativeFilePath,
725
+ file: issue.filePath,
752
726
  position: {
753
727
  startLine: issue.line,
754
728
  startColumn: issue.column,
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.18.1";
8
+ var version = "0.20.0";
9
9
 
10
10
  // packages/plugin-eslint/src/lib/config.ts
11
11
  import { z } from "zod";
@@ -101,25 +101,15 @@ function executionMetaSchema(options = {
101
101
  duration: z2.number({ description: options.descriptionDuration })
102
102
  });
103
103
  }
104
- function slugSchema(description = "Unique ID (human-readable, URL-safe)") {
105
- return z2.string({ description }).regex(slugRegex, {
106
- message: "The slug has to follow the pattern [0-9a-z] followed by multiple optional groups of -[0-9a-z]. e.g. my-slug"
107
- }).max(MAX_SLUG_LENGTH, {
108
- message: `slug can be max ${MAX_SLUG_LENGTH} characters long`
109
- });
110
- }
111
- function descriptionSchema(description = "Description (markdown)") {
112
- return z2.string({ description }).max(MAX_DESCRIPTION_LENGTH).optional();
113
- }
114
- function docsUrlSchema(description = "Documentation site") {
115
- return urlSchema(description).optional().or(z2.string().max(0));
116
- }
117
- function urlSchema(description) {
118
- return z2.string({ description }).url();
119
- }
120
- function titleSchema(description = "Descriptive name") {
121
- return z2.string({ description }).max(MAX_TITLE_LENGTH);
122
- }
104
+ var slugSchema = z2.string({ description: "Unique ID (human-readable, URL-safe)" }).regex(slugRegex, {
105
+ message: "The slug has to follow the pattern [0-9a-z] followed by multiple optional groups of -[0-9a-z]. e.g. my-slug"
106
+ }).max(MAX_SLUG_LENGTH, {
107
+ message: `slug can be max ${MAX_SLUG_LENGTH} characters long`
108
+ });
109
+ var descriptionSchema = z2.string({ description: "Description (markdown)" }).max(MAX_DESCRIPTION_LENGTH).optional();
110
+ var urlSchema = z2.string().url();
111
+ var docsUrlSchema = urlSchema.optional().or(z2.literal("")).describe("Documentation site");
112
+ var titleSchema = z2.string({ description: "Descriptive name" }).max(MAX_TITLE_LENGTH);
123
113
  function metaSchema(options) {
124
114
  const {
125
115
  descriptionDescription,
@@ -129,24 +119,19 @@ function metaSchema(options) {
129
119
  } = options ?? {};
130
120
  return z2.object(
131
121
  {
132
- title: titleSchema(titleDescription),
133
- description: descriptionSchema(descriptionDescription),
134
- docsUrl: docsUrlSchema(docsUrlDescription)
122
+ title: titleDescription ? titleSchema.describe(titleDescription) : titleSchema,
123
+ description: descriptionDescription ? descriptionSchema.describe(descriptionDescription) : descriptionSchema,
124
+ docsUrl: docsUrlDescription ? docsUrlSchema.describe(docsUrlDescription) : docsUrlSchema
135
125
  },
136
126
  { description }
137
127
  );
138
128
  }
139
- function filePathSchema(description) {
140
- return z2.string({ description }).trim().min(1, { message: "path is invalid" });
141
- }
142
- function fileNameSchema(description) {
143
- return z2.string({ description }).trim().regex(filenameRegex, {
144
- message: `The filename has to be valid`
145
- }).min(1, { message: "file name is invalid" });
146
- }
147
- function positiveIntSchema(description) {
148
- return z2.number({ description }).int().nonnegative();
149
- }
129
+ var filePathSchema = z2.string().trim().min(1, { message: "path is invalid" });
130
+ var fileNameSchema = z2.string().trim().regex(filenameRegex, {
131
+ message: `The filename has to be valid`
132
+ }).min(1, { message: "file name is invalid" });
133
+ var positiveIntSchema = z2.number().int().positive();
134
+ var nonnegativeIntSchema = z2.number().int().nonnegative();
150
135
  function packageVersionSchema(options) {
151
136
  const { versionDescription = "NPM version of the package", required } = options ?? {};
152
137
  const packageSchema = z2.string({ description: "NPM package name" });
@@ -159,14 +144,14 @@ function packageVersionSchema(options) {
159
144
  { description: "NPM package name and version of a published package" }
160
145
  );
161
146
  }
162
- function weightSchema(description = "Coefficient for the given score (use weight 0 if only for display)") {
163
- return positiveIntSchema(description);
164
- }
147
+ var weightSchema = nonnegativeIntSchema.describe(
148
+ "Coefficient for the given score (use weight 0 if only for display)"
149
+ );
165
150
  function weightedRefSchema(description, slugDescription) {
166
151
  return z2.object(
167
152
  {
168
- slug: slugSchema(slugDescription),
169
- weight: weightSchema("Weight used to calculate score")
153
+ slug: slugSchema.describe(slugDescription),
154
+ weight: weightSchema.describe("Weight used to calculate score")
170
155
  },
171
156
  { description }
172
157
  );
@@ -174,14 +159,14 @@ function weightedRefSchema(description, slugDescription) {
174
159
  function scorableSchema(description, refSchema, duplicateCheckFn, duplicateMessageFn) {
175
160
  return z2.object(
176
161
  {
177
- slug: slugSchema('Human-readable unique ID, e.g. "performance"'),
162
+ slug: slugSchema.describe('Human-readable unique ID, e.g. "performance"'),
178
163
  refs: z2.array(refSchema).min(1).refine(
179
164
  (refs) => !duplicateCheckFn(refs),
180
165
  (refs) => ({
181
166
  message: duplicateMessageFn(refs)
182
167
  })
183
- ).refine(hasWeightedRefsInCategories, () => ({
184
- message: `In a category there has to be at least one ref with weight > 0`
168
+ ).refine(hasNonZeroWeightedRef, () => ({
169
+ message: "In a category there has to be at least one ref with weight > 0"
185
170
  }))
186
171
  },
187
172
  { description }
@@ -190,13 +175,13 @@ function scorableSchema(description, refSchema, duplicateCheckFn, duplicateMessa
190
175
  var materialIconSchema = z2.enum(MATERIAL_ICONS, {
191
176
  description: "Icon from VSCode Material Icons extension"
192
177
  });
193
- function hasWeightedRefsInCategories(categoryRefs) {
194
- return categoryRefs.reduce((acc, { weight }) => weight + acc, 0) !== 0;
178
+ function hasNonZeroWeightedRef(refs) {
179
+ return refs.reduce((acc, { weight }) => weight + acc, 0) !== 0;
195
180
  }
196
181
 
197
182
  // packages/models/src/lib/audit.ts
198
183
  var auditSchema = z3.object({
199
- slug: slugSchema("ID (unique within plugin)")
184
+ slug: slugSchema.describe("ID (unique within plugin)")
200
185
  }).merge(
201
186
  metaSchema({
202
187
  titleDescription: "Descriptive name",
@@ -223,17 +208,20 @@ function getDuplicateSlugsInAudits(audits) {
223
208
  return hasDuplicateStrings(audits.map(({ slug }) => slug));
224
209
  }
225
210
 
226
- // packages/models/src/lib/audit-issue.ts
211
+ // packages/models/src/lib/audit-output.ts
212
+ import { z as z5 } from "zod";
213
+
214
+ // packages/models/src/lib/issue.ts
227
215
  import { z as z4 } from "zod";
228
216
  var sourceFileLocationSchema = z4.object(
229
217
  {
230
- file: filePathSchema("Relative path to source file in Git repo"),
218
+ file: filePathSchema.describe("Relative path to source file in Git repo"),
231
219
  position: z4.object(
232
220
  {
233
- startLine: positiveIntSchema("Start line"),
234
- startColumn: positiveIntSchema("Start column").optional(),
235
- endLine: positiveIntSchema("End line").optional(),
236
- endColumn: positiveIntSchema("End column").optional()
221
+ startLine: positiveIntSchema.describe("Start line"),
222
+ startColumn: positiveIntSchema.describe("Start column").optional(),
223
+ endLine: positiveIntSchema.describe("End line").optional(),
224
+ endColumn: positiveIntSchema.describe("End column").optional()
237
225
  },
238
226
  { description: "Location in file" }
239
227
  ).optional()
@@ -253,21 +241,21 @@ var issueSchema = z4.object(
253
241
  );
254
242
 
255
243
  // packages/models/src/lib/audit-output.ts
256
- import { z as z5 } from "zod";
244
+ var auditDetailsSchema = z5.object(
245
+ {
246
+ issues: z5.array(issueSchema, { description: "List of findings" })
247
+ },
248
+ { description: "Detailed information" }
249
+ );
257
250
  var auditOutputSchema = z5.object(
258
251
  {
259
- slug: slugSchema("Reference to audit"),
252
+ slug: slugSchema.describe("Reference to audit"),
260
253
  displayValue: z5.string({ description: "Formatted value (e.g. '0.9 s', '2.1 MB')" }).optional(),
261
- value: positiveIntSchema("Raw numeric value"),
254
+ value: nonnegativeIntSchema.describe("Raw numeric value"),
262
255
  score: z5.number({
263
256
  description: "Value between 0 and 1"
264
257
  }).min(0).max(1),
265
- details: z5.object(
266
- {
267
- issues: z5.array(issueSchema, { description: "List of findings" })
268
- },
269
- { description: "Detailed information" }
270
- ).optional()
258
+ details: auditDetailsSchema.optional()
271
259
  },
272
260
  { description: "Audit information" }
273
261
  );
@@ -297,7 +285,7 @@ var categoryRefSchema = weightedRefSchema(
297
285
  type: z6.enum(["audit", "group"], {
298
286
  description: "Discriminant for reference kind, affects where `slug` is looked up"
299
287
  }),
300
- plugin: slugSchema(
288
+ plugin: slugSchema.describe(
301
289
  "Plugin slug (plugin should contain referenced audit or group)"
302
290
  )
303
291
  })
@@ -357,10 +345,8 @@ import { z as z12 } from "zod";
357
345
  import { z as z7 } from "zod";
358
346
  var formatSchema = z7.enum(["json", "md"]);
359
347
  var persistConfigSchema = z7.object({
360
- outputDir: filePathSchema("Artifacts folder").optional(),
361
- filename: fileNameSchema(
362
- "Artifacts file name (without extension)"
363
- ).optional(),
348
+ outputDir: filePathSchema.describe("Artifacts folder").optional(),
349
+ filename: fileNameSchema.describe("Artifacts file name (without extension)").optional(),
364
350
  format: z7.array(formatSchema).optional()
365
351
  });
366
352
 
@@ -421,7 +407,7 @@ var runnerConfigSchema = z9.object(
421
407
  description: "Shell command to execute"
422
408
  }),
423
409
  args: z9.array(z9.string({ description: "Command arguments" })).optional(),
424
- outputFile: filePathSchema("Output path"),
410
+ outputFile: filePathSchema.describe("Output path"),
425
411
  outputTransform: outputTransformSchema.optional()
426
412
  },
427
413
  {
@@ -441,7 +427,7 @@ var pluginMetaSchema = packageVersionSchema().merge(
441
427
  })
442
428
  ).merge(
443
429
  z10.object({
444
- slug: slugSchema("Unique plugin slug within core config"),
430
+ slug: slugSchema.describe("Unique plugin slug within core config"),
445
431
  icon: materialIconSchema
446
432
  })
447
433
  );
@@ -474,12 +460,14 @@ function getMissingRefsFromGroups(pluginCfg) {
474
460
  // packages/models/src/lib/upload-config.ts
475
461
  import { z as z11 } from "zod";
476
462
  var uploadConfigSchema = z11.object({
477
- server: urlSchema("URL of deployed portal API"),
463
+ server: urlSchema.describe("URL of deployed portal API"),
478
464
  apiKey: z11.string({
479
465
  description: "API key with write access to portal (use `process.env` for security)"
480
466
  }),
481
- organization: slugSchema("Organization slug from Code PushUp portal"),
482
- project: slugSchema("Project slug from Code PushUp portal"),
467
+ organization: slugSchema.describe(
468
+ "Organization slug from Code PushUp portal"
469
+ ),
470
+ project: slugSchema.describe("Project slug from Code PushUp portal"),
483
471
  timeout: z11.number({ description: "Request timeout in minutes (default is 5)" }).positive().int().optional()
484
472
  });
485
473
 
@@ -606,19 +594,6 @@ function pluginWorkDir(slug) {
606
594
  return join("node_modules", ".code-pushup", slug);
607
595
  }
608
596
 
609
- // packages/utils/src/lib/git.ts
610
- import { simpleGit } from "simple-git";
611
- var git = simpleGit();
612
-
613
- // packages/utils/src/lib/progress.ts
614
- import chalk2 from "chalk";
615
- import { MultiProgressBars } from "multi-progress-bars";
616
-
617
- // packages/utils/src/lib/reports/generate-stdout-summary.ts
618
- import cliui from "@isaacs/cliui";
619
- import chalk3 from "chalk";
620
- import CliTable3 from "cli-table3";
621
-
622
597
  // packages/utils/src/lib/transform.ts
623
598
  function toArray(val) {
624
599
  return Array.isArray(val) ? val : [val];
@@ -630,8 +605,20 @@ function distinct(array) {
630
605
  return [...new Set(array)];
631
606
  }
632
607
 
608
+ // packages/utils/src/lib/git.ts
609
+ import { simpleGit } from "simple-git";
610
+
633
611
  // packages/utils/src/lib/logging.ts
612
+ import chalk2 from "chalk";
613
+
614
+ // packages/utils/src/lib/progress.ts
615
+ import chalk3 from "chalk";
616
+ import { MultiProgressBars } from "multi-progress-bars";
617
+
618
+ // packages/utils/src/lib/reports/generate-stdout-summary.ts
619
+ import cliui from "@isaacs/cliui";
634
620
  import chalk4 from "chalk";
621
+ import CliTable3 from "cli-table3";
635
622
 
636
623
  // packages/plugin-eslint/src/lib/meta/hash.ts
637
624
  import { createHash } from "node:crypto";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@code-pushup/eslint-plugin",
3
- "version": "0.18.1",
3
+ "version": "0.20.0",
4
4
  "license": "MIT",
5
5
  "dependencies": {
6
6
  "@code-pushup/utils": "*",
@@ -1,11 +1,8 @@
1
1
  import type { ESLint } from 'eslint';
2
2
  export type LinterOutput = {
3
- results: LintResult[];
3
+ results: ESLint.LintResult[];
4
4
  ruleOptionsPerFile: RuleOptionsPerFile;
5
5
  };
6
- export type LintResult = ESLint.LintResult & {
7
- relativeFilePath: string;
8
- };
9
6
  export type RuleOptionsPerFile = {
10
7
  [filePath: string]: {
11
8
  [ruleId: string]: unknown[];