Skip to content

Commit 7de25ca

Browse files
committed
chore: update zod to v4.2.1 across all packages
1 parent f51d768 commit 7de25ca

File tree

15 files changed

+59
-62
lines changed

15 files changed

+59
-62
lines changed

package-lock.json

Lines changed: 4 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@
4545
"wrap-ansi": "^9.0.2",
4646
"yaml": "^2.5.1",
4747
"yargs": "^17.7.2",
48-
"zod": "^4.0.5"
48+
"zod": "^4.2.1"
4949
},
5050
"devDependencies": {
5151
"@actions/core": "^1.11.1",

packages/ci/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333
"glob": "^11.0.1",
3434
"simple-git": "^3.20.0",
3535
"yaml": "^2.5.1",
36-
"zod": "^4.0.5"
36+
"zod": "^4.2.1"
3737
},
3838
"files": [
3939
"src",

packages/models/docs/models-reference.md

Lines changed: 17 additions & 17 deletions
Large diffs are not rendered by default.

packages/models/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
"dependencies": {
3030
"ansis": "^3.3.2",
3131
"vscode-material-icons": "^0.1.0",
32-
"zod": "^4.0.5"
32+
"zod": "^4.2.1"
3333
},
3434
"files": [
3535
"src",

packages/models/src/lib/implementation/schemas.ts

Lines changed: 16 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,5 @@
11
import { MATERIAL_ICONS } from 'vscode-material-icons';
2-
import {
3-
ZodError,
4-
type ZodIssue,
5-
type ZodObject,
6-
type ZodOptional,
7-
type ZodString,
8-
z,
9-
} from 'zod';
2+
import { type ZodObject, type ZodOptional, type ZodString, z } from 'zod';
103
import {
114
MAX_DESCRIPTION_LENGTH,
125
MAX_SLUG_LENGTH,
@@ -65,28 +58,24 @@ export const descriptionSchema = z
6558
.optional();
6659

6760
/* Schema for a URL */
68-
export const urlSchema = z.string().url().meta({ title: 'URL' });
61+
export const urlSchema = z.url().meta({ title: 'URL' });
6962

7063
/** Schema for a docsUrl */
71-
export const docsUrlSchema = urlSchema
64+
export const docsUrlSchema = z
65+
.union([
66+
z.literal(''), // allow empty string (no URL validation)
67+
// eslint-disable-next-line unicorn/prefer-top-level-await, unicorn/catch-error-name
68+
urlSchema.optional().catch(ctx => {
69+
const issue = ctx.issues[0];
70+
if (issue?.code === 'invalid_format' && issue?.format === 'url') {
71+
console.warn(`Ignoring invalid docsUrl: ${ctx.value}`);
72+
return '';
73+
}
74+
// re-parse to throw formatted error for non-URL issues
75+
return urlSchema.parse(ctx.value);
76+
}),
77+
])
7278
.optional()
73-
.or(z.literal('')) // allow empty string (no URL validation)
74-
// eslint-disable-next-line unicorn/prefer-top-level-await, unicorn/catch-error-name
75-
.catch(ctx => {
76-
// if only URL validation fails, supress error since this metadata is optional anyway
77-
if (
78-
ctx.issues.length === 1 &&
79-
(ctx.issues[0]?.errors as ZodIssue[][])
80-
.flat()
81-
.some(
82-
error => error.code === 'invalid_format' && error.format === 'url',
83-
)
84-
) {
85-
console.warn(`Ignoring invalid docsUrl: ${ctx.value}`);
86-
return '';
87-
}
88-
throw new ZodError(ctx.error.issues);
89-
})
9079
.meta({ title: 'DocsUrl', description: 'Documentation site' });
9180

9281
/** Schema for a title of a plugin, category and audit */

packages/models/src/lib/implementation/schemas.unit.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { describe, expect, it } from 'vitest';
1+
import { beforeAll, describe, expect, it, vi } from 'vitest';
22
import {
33
type TableCellValue,
44
docsUrlSchema,

packages/plugin-axe/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@
4646
"@code-pushup/utils": "0.100.1",
4747
"axe-core": "^4.11.0",
4848
"playwright-core": "^1.56.1",
49-
"zod": "^4.1.12"
49+
"zod": "^4.2.1"
5050
},
5151
"files": [
5252
"src",

packages/plugin-coverage/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@
3737
"@code-pushup/models": "0.100.1",
3838
"@code-pushup/utils": "0.100.1",
3939
"parse-lcov": "^1.0.4",
40-
"zod": "^4.0.5"
40+
"zod": "^4.2.1"
4141
},
4242
"peerDependencies": {
4343
"@nx/devkit": ">=17.0.0",

packages/plugin-eslint/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@
4242
"glob": "^11.0.0",
4343
"@code-pushup/utils": "0.100.1",
4444
"@code-pushup/models": "0.100.1",
45-
"zod": "^4.0.5"
45+
"zod": "^4.2.1"
4646
},
4747
"peerDependencies": {
4848
"@nx/devkit": ">=17.0.0",

0 commit comments

Comments
 (0)