@code-pushup/eslint-plugin 0.69.5 → 0.71.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@code-pushup/eslint-plugin",
3
- "version": "0.69.5",
3
+ "version": "0.71.0",
4
4
  "license": "MIT",
5
5
  "description": "Code PushUp plugin for detecting problems in source code using ESLint.📋",
6
6
  "homepage": "https://github.com/code-pushup/cli/tree/main/packages/plugin-eslint#readme",
@@ -38,10 +38,10 @@
38
38
  },
39
39
  "type": "module",
40
40
  "dependencies": {
41
- "@code-pushup/utils": "0.69.5",
42
- "@code-pushup/models": "0.69.5",
41
+ "@code-pushup/utils": "0.71.0",
42
+ "@code-pushup/models": "0.71.0",
43
43
  "yargs": "^17.7.2",
44
- "zod": "^3.22.4"
44
+ "zod": "^4.0.5"
45
45
  },
46
46
  "peerDependencies": {
47
47
  "@nx/devkit": ">=17.0.0",
@@ -1,61 +1,43 @@
1
1
  import { z } from 'zod';
2
- export declare const eslintTargetSchema: z.ZodEffects<z.ZodUnion<[z.ZodUnion<[z.ZodString, z.ZodArray<z.ZodString, "many">]>, z.ZodObject<{
2
+ export declare const eslintTargetSchema: z.ZodPipe<z.ZodUnion<readonly [z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>]>, z.ZodObject<{
3
3
  eslintrc: z.ZodOptional<z.ZodString>;
4
- patterns: z.ZodUnion<[z.ZodString, z.ZodArray<z.ZodString, "many">]>;
5
- }, "strip", z.ZodTypeAny, {
4
+ patterns: z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>]>;
5
+ }, z.core.$strip>]>, z.ZodTransform<{
6
6
  patterns: string | string[];
7
7
  eslintrc?: string | undefined;
8
- }, {
8
+ }, string | {
9
9
  patterns: string | string[];
10
10
  eslintrc?: string | undefined;
11
- }>]>, {
12
- patterns: string | string[];
13
- eslintrc?: string | undefined;
14
- }, string | string[] | {
15
- patterns: string | string[];
16
- eslintrc?: string | undefined;
17
- }>;
11
+ } | string[]>>;
18
12
  export type ESLintTarget = z.infer<typeof eslintTargetSchema>;
19
- export declare const eslintPluginConfigSchema: z.ZodEffects<z.ZodUnion<[z.ZodEffects<z.ZodUnion<[z.ZodUnion<[z.ZodString, z.ZodArray<z.ZodString, "many">]>, z.ZodObject<{
13
+ export declare const eslintPluginConfigSchema: z.ZodPipe<z.ZodUnion<readonly [z.ZodPipe<z.ZodUnion<readonly [z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>]>, z.ZodObject<{
20
14
  eslintrc: z.ZodOptional<z.ZodString>;
21
- patterns: z.ZodUnion<[z.ZodString, z.ZodArray<z.ZodString, "many">]>;
22
- }, "strip", z.ZodTypeAny, {
23
- patterns: string | string[];
24
- eslintrc?: string | undefined;
25
- }, {
15
+ patterns: z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>]>;
16
+ }, z.core.$strip>]>, z.ZodTransform<{
26
17
  patterns: string | string[];
27
18
  eslintrc?: string | undefined;
28
- }>]>, {
19
+ }, string | {
29
20
  patterns: string | string[];
30
21
  eslintrc?: string | undefined;
31
- }, string | string[] | {
32
- patterns: string | string[];
33
- eslintrc?: string | undefined;
34
- }>, z.ZodArray<z.ZodEffects<z.ZodUnion<[z.ZodUnion<[z.ZodString, z.ZodArray<z.ZodString, "many">]>, z.ZodObject<{
22
+ } | string[]>>, z.ZodArray<z.ZodPipe<z.ZodUnion<readonly [z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>]>, z.ZodObject<{
35
23
  eslintrc: z.ZodOptional<z.ZodString>;
36
- patterns: z.ZodUnion<[z.ZodString, z.ZodArray<z.ZodString, "many">]>;
37
- }, "strip", z.ZodTypeAny, {
38
- patterns: string | string[];
39
- eslintrc?: string | undefined;
40
- }, {
41
- patterns: string | string[];
42
- eslintrc?: string | undefined;
43
- }>]>, {
24
+ patterns: z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>]>;
25
+ }, z.core.$strip>]>, z.ZodTransform<{
44
26
  patterns: string | string[];
45
27
  eslintrc?: string | undefined;
46
- }, string | string[] | {
28
+ }, string | {
47
29
  patterns: string | string[];
48
30
  eslintrc?: string | undefined;
49
- }>, "many">]>, {
31
+ } | string[]>>>]>, z.ZodTransform<{
50
32
  patterns: string | string[];
51
33
  eslintrc?: string | undefined;
52
- }[], string | string[] | {
34
+ }[], {
53
35
  patterns: string | string[];
54
36
  eslintrc?: string | undefined;
55
- } | (string | string[] | {
37
+ } | {
56
38
  patterns: string | string[];
57
39
  eslintrc?: string | undefined;
58
- })[]>;
40
+ }[]>>;
59
41
  export type ESLintPluginConfig = z.input<typeof eslintPluginConfigSchema>;
60
42
  export type ESLintPluginRunnerConfig = {
61
43
  targets: ESLintTarget[];
@@ -66,20 +48,8 @@ declare const customGroupSchema: z.ZodObject<{
66
48
  title: z.ZodString;
67
49
  description: z.ZodOptional<z.ZodString>;
68
50
  docsUrl: z.ZodOptional<z.ZodString>;
69
- rules: z.ZodUnion<[z.ZodArray<z.ZodString, "many">, z.ZodEffects<z.ZodRecord<z.ZodString, z.ZodNumber>, Record<string, number>, Record<string, number>>]>;
70
- }, "strip", z.ZodTypeAny, {
71
- slug: string;
72
- title: string;
73
- rules: string[] | Record<string, number>;
74
- description?: string | undefined;
75
- docsUrl?: string | undefined;
76
- }, {
77
- slug: string;
78
- title: string;
79
- rules: string[] | Record<string, number>;
80
- description?: string | undefined;
81
- docsUrl?: string | undefined;
82
- }>;
51
+ rules: z.ZodUnion<readonly [z.ZodArray<z.ZodString>, z.ZodRecord<z.ZodString, z.ZodNumber>]>;
52
+ }, z.core.$strip>;
83
53
  export type CustomGroup = z.infer<typeof customGroupSchema>;
84
54
  export declare const eslintPluginOptionsSchema: z.ZodObject<{
85
55
  groups: z.ZodOptional<z.ZodArray<z.ZodObject<{
@@ -87,36 +57,8 @@ export declare const eslintPluginOptionsSchema: z.ZodObject<{
87
57
  title: z.ZodString;
88
58
  description: z.ZodOptional<z.ZodString>;
89
59
  docsUrl: z.ZodOptional<z.ZodString>;
90
- rules: z.ZodUnion<[z.ZodArray<z.ZodString, "many">, z.ZodEffects<z.ZodRecord<z.ZodString, z.ZodNumber>, Record<string, number>, Record<string, number>>]>;
91
- }, "strip", z.ZodTypeAny, {
92
- slug: string;
93
- title: string;
94
- rules: string[] | Record<string, number>;
95
- description?: string | undefined;
96
- docsUrl?: string | undefined;
97
- }, {
98
- slug: string;
99
- title: string;
100
- rules: string[] | Record<string, number>;
101
- description?: string | undefined;
102
- docsUrl?: string | undefined;
103
- }>, "many">>;
104
- }, "strip", z.ZodTypeAny, {
105
- groups?: {
106
- slug: string;
107
- title: string;
108
- rules: string[] | Record<string, number>;
109
- description?: string | undefined;
110
- docsUrl?: string | undefined;
111
- }[] | undefined;
112
- }, {
113
- groups?: {
114
- slug: string;
115
- title: string;
116
- rules: string[] | Record<string, number>;
117
- description?: string | undefined;
118
- docsUrl?: string | undefined;
119
- }[] | undefined;
120
- }>;
60
+ rules: z.ZodUnion<readonly [z.ZodArray<z.ZodString>, z.ZodRecord<z.ZodString, z.ZodNumber>]>;
61
+ }, z.core.$strip>>>;
62
+ }, z.core.$strip>;
121
63
  export type ESLintPluginOptions = z.infer<typeof eslintPluginOptionsSchema>;
122
64
  export {};
package/src/lib/config.js CHANGED
@@ -1,9 +1,9 @@
1
1
  import { z } from 'zod';
2
2
  import { toArray } from '@code-pushup/utils';
3
- const patternsSchema = z.union([z.string(), z.array(z.string()).min(1)], {
4
- description: 'Lint target files. May contain file paths, directory paths or glob patterns',
5
- });
6
- const eslintrcSchema = z.string({ description: 'Path to ESLint config file' });
3
+ const patternsSchema = z
4
+ .union([z.string(), z.array(z.string()).min(1)])
5
+ .describe('Lint target files. May contain file paths, directory paths or glob patterns');
6
+ const eslintrcSchema = z.string().describe('Path to ESLint config file');
7
7
  const eslintTargetObjectSchema = z.object({
8
8
  eslintrc: eslintrcSchema.optional(),
9
9
  patterns: patternsSchema,
@@ -16,22 +16,23 @@ export const eslintTargetSchema = z
16
16
  export const eslintPluginConfigSchema = z
17
17
  .union([eslintTargetSchema, z.array(eslintTargetSchema).min(1)])
18
18
  .transform(toArray);
19
- const customGroupRulesSchema = z.union([
19
+ const customGroupRulesSchema = z
20
+ .union([
20
21
  z
21
22
  .array(z.string())
22
23
  .min(1, 'Custom group rules must contain at least 1 element'),
23
- z.record(z.string(), z.number()).refine(schema => Object.keys(schema).length > 0, () => ({
24
- code: 'too_small',
25
- message: 'Custom group rules must contain at least 1 element',
26
- })),
27
- ], {
28
- description: 'Array of rule IDs with equal weights or object mapping rule IDs to specific weights',
29
- });
24
+ z
25
+ .record(z.string(), z.number())
26
+ .refine(schema => Object.keys(schema).length > 0, {
27
+ error: 'Custom group rules must contain at least 1 element',
28
+ }),
29
+ ])
30
+ .describe('Array of rule IDs with equal weights or object mapping rule IDs to specific weights');
30
31
  const customGroupSchema = z.object({
31
- slug: z.string({ description: 'Unique group identifier' }),
32
- title: z.string({ description: 'Group display title' }),
33
- description: z.string({ description: 'Group metadata' }).optional(),
34
- docsUrl: z.string({ description: 'Group documentation site' }).optional(),
32
+ slug: z.string().describe('Unique group identifier'),
33
+ title: z.string().describe('Group display title'),
34
+ description: z.string().describe('Group metadata').optional(),
35
+ docsUrl: z.string().describe('Group documentation site').optional(),
35
36
  rules: customGroupRulesSchema,
36
37
  });
37
38
  export const eslintPluginOptionsSchema = z.object({
@@ -1 +1 @@
1
- {"version":3,"file":"config.js","sourceRoot":"","sources":["../../../../../packages/plugin-eslint/src/lib/config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAE7C,MAAM,cAAc,GAAG,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC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