@code-pushup/eslint-plugin 0.8.7 → 0.8.9

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 +13 -2
  2. package/index.js +3 -2
  3. package/package.json +1 -1
package/bin.js CHANGED
@@ -13,6 +13,7 @@ import { MATERIAL_ICONS } from "@code-pushup/portal-client";
13
13
  var MAX_SLUG_LENGTH = 128;
14
14
  var MAX_TITLE_LENGTH = 256;
15
15
  var MAX_DESCRIPTION_LENGTH = 65536;
16
+ var MAX_ISSUE_MESSAGE_LENGTH = 1024;
16
17
 
17
18
  // packages/models/src/lib/implementation/utils.ts
18
19
  var slugRegex = /^[a-z0-9]+(?:-[a-z0-9]+)*$/;
@@ -193,7 +194,7 @@ var issueSeveritySchema = z3.enum(["info", "warning", "error"], {
193
194
  });
194
195
  var issueSchema = z3.object(
195
196
  {
196
- message: z3.string({ description: "Descriptive error message" }).max(512),
197
+ message: z3.string({ description: "Descriptive error message" }).max(MAX_ISSUE_MESSAGE_LENGTH),
197
198
  severity: issueSeveritySchema,
198
199
  source: sourceFileLocationSchema.optional()
199
200
  },
@@ -551,6 +552,16 @@ function pluralize(text) {
551
552
  function pluralizeToken(token, times = 0) {
552
553
  return `${times} ${Math.abs(times) === 1 ? token : pluralize(token)}`;
553
554
  }
555
+ function truncateText(text, maxChars) {
556
+ if (text.length <= maxChars) {
557
+ return text;
558
+ }
559
+ const ellipsis = "...";
560
+ return text.slice(0, maxChars - ellipsis.length) + ellipsis;
561
+ }
562
+ function truncateIssueMessage(text) {
563
+ return truncateText(text, MAX_ISSUE_MESSAGE_LENGTH);
564
+ }
554
565
 
555
566
  // packages/utils/src/lib/file-system.ts
556
567
  async function readTextFile(path) {
@@ -714,7 +725,7 @@ function toAudit(slug, issues) {
714
725
  }
715
726
  function convertIssue(issue) {
716
727
  return {
717
- message: issue.message,
728
+ message: truncateIssueMessage(issue.message),
718
729
  severity: convertSeverity(issue.severity),
719
730
  source: {
720
731
  file: issue.relativeFilePath,
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.8.7";
8
+ var version = "0.8.9";
9
9
 
10
10
  // packages/plugin-eslint/src/lib/config.ts
11
11
  import { z } from "zod";
@@ -35,6 +35,7 @@ import { MATERIAL_ICONS } from "@code-pushup/portal-client";
35
35
  var MAX_SLUG_LENGTH = 128;
36
36
  var MAX_TITLE_LENGTH = 256;
37
37
  var MAX_DESCRIPTION_LENGTH = 65536;
38
+ var MAX_ISSUE_MESSAGE_LENGTH = 1024;
38
39
 
39
40
  // packages/models/src/lib/implementation/utils.ts
40
41
  var slugRegex = /^[a-z0-9]+(?:-[a-z0-9]+)*$/;
@@ -215,7 +216,7 @@ var issueSeveritySchema = z4.enum(["info", "warning", "error"], {
215
216
  });
216
217
  var issueSchema = z4.object(
217
218
  {
218
- message: z4.string({ description: "Descriptive error message" }).max(512),
219
+ message: z4.string({ description: "Descriptive error message" }).max(MAX_ISSUE_MESSAGE_LENGTH),
219
220
  severity: issueSeveritySchema,
220
221
  source: sourceFileLocationSchema.optional()
221
222
  },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@code-pushup/eslint-plugin",
3
- "version": "0.8.7",
3
+ "version": "0.8.9",
4
4
  "dependencies": {
5
5
  "@code-pushup/utils": "*",
6
6
  "@code-pushup/models": "*",