@code-pushup/eslint-plugin 0.8.6 → 0.8.8

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 +19 -8
  2. package/index.js +12 -11
  3. package/package.json +1 -1
package/bin.js CHANGED
@@ -1,6 +1,6 @@
1
1
  // packages/plugin-eslint/src/lib/runner/index.ts
2
- import { mkdir as mkdir2, writeFile } from "fs/promises";
3
- import { dirname, join as join2 } from "path";
2
+ import { mkdir as mkdir2, writeFile } from "node:fs/promises";
3
+ import { dirname, join as join2 } from "node:path";
4
4
 
5
5
  // packages/models/src/lib/audit.ts
6
6
  import { z as z2 } from "zod";
@@ -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
  },
@@ -532,12 +533,12 @@ var reportSchema = packageVersionSchema({
532
533
  // packages/utils/src/lib/file-system.ts
533
534
  import { bundleRequire } from "bundle-require";
534
535
  import chalk from "chalk";
535
- import { mkdir, readFile, readdir, stat } from "fs/promises";
536
- import { join } from "path";
536
+ import { mkdir, readFile, readdir, stat } from "node:fs/promises";
537
+ import { join } from "node:path";
537
538
 
538
539
  // packages/utils/src/lib/formatting.ts
539
540
  function slugify(text) {
540
- return text.trim().toLowerCase().replace(/\s+|\//g, "-").replace(/[^a-z0-9-]/g, "");
541
+ return text.trim().toLowerCase().replace(/\s+|\//g, "-").replace(/[^a-z\d-]/g, "");
541
542
  }
542
543
  function pluralize(text) {
543
544
  if (text.endsWith("y")) {
@@ -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) {
@@ -664,7 +675,7 @@ async function lint({
664
675
  }
665
676
 
666
677
  // packages/plugin-eslint/src/lib/meta/hash.ts
667
- import { createHash } from "crypto";
678
+ import { createHash } from "node:crypto";
668
679
  function ruleIdToSlug(ruleId, options) {
669
680
  const slug = slugify(ruleId);
670
681
  if (!options?.length) {
@@ -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
@@ -1,11 +1,11 @@
1
1
  // packages/plugin-eslint/src/lib/eslint-plugin.ts
2
- import { mkdir as mkdir2, writeFile } from "fs/promises";
3
- import { dirname as dirname2, join as join3 } from "path";
4
- import { fileURLToPath } from "url";
2
+ import { mkdir as mkdir2, writeFile } from "node:fs/promises";
3
+ import { dirname as dirname2, join as join3 } from "node:path";
4
+ 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.6";
8
+ var version = "0.8.8";
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
  },
@@ -554,12 +555,12 @@ var reportSchema = packageVersionSchema({
554
555
  // packages/utils/src/lib/file-system.ts
555
556
  import { bundleRequire } from "bundle-require";
556
557
  import chalk from "chalk";
557
- import { mkdir, readFile, readdir, stat } from "fs/promises";
558
- import { join } from "path";
558
+ import { mkdir, readFile, readdir, stat } from "node:fs/promises";
559
+ import { join } from "node:path";
559
560
 
560
561
  // packages/utils/src/lib/formatting.ts
561
562
  function slugify(text) {
562
- return text.trim().toLowerCase().replace(/\s+|\//g, "-").replace(/[^a-z0-9-]/g, "");
563
+ return text.trim().toLowerCase().replace(/\s+|\//g, "-").replace(/[^a-z\d-]/g, "");
563
564
  }
564
565
  function truncateText(text, maxChars) {
565
566
  if (text.length <= maxChars) {
@@ -613,7 +614,7 @@ function distinct(array) {
613
614
  }
614
615
 
615
616
  // packages/plugin-eslint/src/lib/meta/hash.ts
616
- import { createHash } from "crypto";
617
+ import { createHash } from "node:crypto";
617
618
  function ruleIdToSlug(ruleId, options) {
618
619
  const slug = slugify(ruleId);
619
620
  if (!options?.length) {
@@ -790,8 +791,8 @@ async function listAuditsAndGroups(eslint, patterns) {
790
791
  }
791
792
 
792
793
  // packages/plugin-eslint/src/lib/runner/index.ts
793
- import { platform } from "os";
794
- import { dirname, join as join2 } from "path";
794
+ import { platform } from "node:os";
795
+ import { dirname, join as join2 } from "node:path";
795
796
 
796
797
  // packages/plugin-eslint/src/lib/setup.ts
797
798
  import { ESLint } from "eslint";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@code-pushup/eslint-plugin",
3
- "version": "0.8.6",
3
+ "version": "0.8.8",
4
4
  "dependencies": {
5
5
  "@code-pushup/utils": "*",
6
6
  "@code-pushup/models": "*",