Skip to content

Commit d6fae1a

Browse files
committed
feat(plugin-typescript): update to zod v4
1 parent fa9c18f commit d6fae1a

3 files changed

Lines changed: 12 additions & 10 deletions

File tree

packages/plugin-typescript/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
"dependencies": {
2626
"@code-pushup/models": "0.69.5",
2727
"@code-pushup/utils": "0.69.5",
28-
"zod": "^3.23.8"
28+
"zod": "^4.0.5"
2929
},
3030
"peerDependencies": {
3131
"typescript": ">=4.0.0"

packages/plugin-typescript/src/lib/schema.ts

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,12 @@ const auditSlugs = AUDITS.map(({ slug }) => slug) as [
88
];
99
export const typescriptPluginConfigSchema = z.object({
1010
tsconfig: z
11-
.string({
12-
description: 'Path to a tsconfig file (default is tsconfig.json)',
13-
})
14-
.default(DEFAULT_TS_CONFIG),
11+
.string()
12+
.default(DEFAULT_TS_CONFIG)
13+
.describe(`Path to a tsconfig file (default is ${DEFAULT_TS_CONFIG})`),
1514
onlyAudits: z
16-
.array(z.enum(auditSlugs), {
17-
description: 'Filters TypeScript compiler errors by diagnostic codes',
18-
})
15+
.array(z.enum(auditSlugs))
16+
.describe('Filters TypeScript compiler errors by diagnostic codes')
1917
.optional(),
2018
});
2119

packages/plugin-typescript/src/lib/schema.unit.test.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,9 @@ describe('typescriptPluginConfigSchema', () => {
5555
tsconfig,
5656
onlyAudits: [123, true],
5757
}),
58-
).toThrow('invalid_type');
58+
).toThrow(
59+
String.raw`Invalid option: expected one of \"syntax-errors\"|\"semantic-errors\"|`,
60+
);
5961
});
6062

6163
it('throws for unknown audit slug', () => {
@@ -64,6 +66,8 @@ describe('typescriptPluginConfigSchema', () => {
6466
tsconfig,
6567
onlyAudits: ['unknown-audit'],
6668
}),
67-
).toThrow(/unknown-audit/);
69+
).toThrow(
70+
String.raw`Invalid option: expected one of \"syntax-errors\"|\"semantic-errors\"|`,
71+
);
6872
});
6973
});

0 commit comments

Comments
 (0)