File tree Expand file tree Collapse file tree 7 files changed +14
-11
lines changed
core/src/lib/implementation Expand file tree Collapse file tree 7 files changed +14
-11
lines changed Original file line number Diff line number Diff line change 44 type CoreConfig ,
55 SUPPORTED_CONFIG_FILE_FORMATS ,
66 coreConfigSchema ,
7+ validate ,
78} from '@code-pushup/models' ;
8- import { fileExists , importModule , parseSchema } from '@code-pushup/utils' ;
9+ import { fileExists , importModule } from '@code-pushup/utils' ;
910
1011export class ConfigPathError extends Error {
1112 constructor ( configPath : string ) {
@@ -31,7 +32,7 @@ export async function readRcByPath(
3132 format : 'esm' ,
3233 } ) ;
3334
34- return parseSchema ( coreConfigSchema , cfg , {
35+ return validate ( coreConfigSchema , cfg , {
3536 schemaType : 'core config' ,
3637 sourcePath : filepath ,
3738 } ) ;
Original file line number Diff line number Diff line change 2727 },
2828 "type" : " module" ,
2929 "dependencies" : {
30- "zod" : " ^4.0.5" ,
31- "vscode-material-icons" : " ^0.1.0"
30+ "ansis" : " ^3.3.2" ,
31+ "vscode-material-icons" : " ^0.1.0" ,
32+ "zod" : " ^4.0.5"
3233 },
3334 "files" : [
3435 " src" ,
Original file line number Diff line number Diff line change @@ -71,6 +71,10 @@ export {
7171 type MaterialIcon ,
7272} from './lib/implementation/schemas.js' ;
7373export { exists } from './lib/implementation/utils.js' ;
74+ export {
75+ SchemaValidationError ,
76+ validate ,
77+ } from './lib/implementation/validate.js' ;
7478export {
7579 issueSchema ,
7680 issueSeveritySchema ,
Original file line number Diff line number Diff line change @@ -20,7 +20,7 @@ export class SchemaValidationError extends Error {
2020 }
2121}
2222
23- export function parseSchema < T extends z . ZodTypeAny > (
23+ export function validate < T extends z . ZodTypeAny > (
2424 schema : T ,
2525 data : z . input < T > ,
2626 { schemaType, sourcePath } : SchemaValidationContext ,
Original file line number Diff line number Diff line change 11import { createRequire } from 'node:module' ;
2- import type { PluginConfig } from '@code-pushup/models' ;
3- import { parseSchema } from '@code-pushup/utils' ;
2+ import { type PluginConfig , validate } from '@code-pushup/models' ;
43import {
54 type ESLintPluginConfig ,
65 type ESLintPluginOptions ,
@@ -36,7 +35,7 @@ export async function eslintPlugin(
3635 config : ESLintPluginConfig ,
3736 options ?: ESLintPluginOptions ,
3837) : Promise < PluginConfig > {
39- const targets = parseSchema ( eslintPluginConfigSchema , config , {
38+ const targets = validate ( eslintPluginConfigSchema , config , {
4039 schemaType : 'ESLint plugin config' ,
4140 } ) ;
4241
@@ -45,7 +44,7 @@ export async function eslintPlugin(
4544 artifacts,
4645 scoreTargets,
4746 } = options
48- ? parseSchema ( eslintPluginOptionsSchema , options , {
47+ ? validate ( eslintPluginOptionsSchema , options , {
4948 schemaType : 'ESLint plugin options' ,
5049 } )
5150 : { } ;
Original file line number Diff line number Diff line change 3737 "multi-progress-bars" : " ^5.0.3" ,
3838 "semver" : " ^7.6.0" ,
3939 "simple-git" : " ^3.20.0" ,
40- "zod" : " ^4.0.5" ,
4140 "ora" : " ^9.0.0"
4241 },
4342 "files" : [
Original file line number Diff line number Diff line change @@ -155,4 +155,3 @@ export type {
155155 Prettify ,
156156 WithRequired ,
157157} from './lib/types.js' ;
158- export { parseSchema , SchemaValidationError } from './lib/zod-validation.js' ;
You can’t perform that action at this time.
0 commit comments