Skip to content

Commit ca445a5

Browse files
Code-Hexactions-user
authored andcommitted
Apply auto lint-fix changes
1 parent cd09334 commit ca445a5

File tree

2 files changed

+23
-23
lines changed

2 files changed

+23
-23
lines changed

src/zod/index.ts

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -104,10 +104,10 @@ const generateInputObjectFieldTypeZodSchema = (
104104
parentType?: TypeNode
105105
): string => {
106106
if (isListType(type)) {
107-
const gen = generateInputObjectFieldTypeZodSchema(config, tsVisitor, schema, field, type.type, type)
107+
const gen = generateInputObjectFieldTypeZodSchema(config, tsVisitor, schema, field, type.type, type);
108108
if (!isNonNullType(parentType)) {
109-
const arrayGen = `z.array(${maybeLazy(type.type, gen)})`
110-
const maybeLazyGen = applyDirectives(config,field, arrayGen)
109+
const arrayGen = `z.array(${maybeLazy(type.type, gen)})`;
110+
const maybeLazyGen = applyDirectives(config, field, arrayGen);
111111
return `${maybeLazyGen}.nullish()`;
112112
}
113113
return `z.array(${maybeLazy(type.type, gen)})`;
@@ -117,11 +117,11 @@ const generateInputObjectFieldTypeZodSchema = (
117117
return maybeLazy(type.type, gen);
118118
}
119119
if (isNamedType(type)) {
120-
const gen = generateNameNodeZodSchema(config, tsVisitor, schema, type.name)
120+
const gen = generateNameNodeZodSchema(config, tsVisitor, schema, type.name);
121121
if (isListType(parentType)) {
122122
return `${gen}.nullable()`;
123123
}
124-
const appliedDirectivesGen = applyDirectives(config, field, gen)
124+
const appliedDirectivesGen = applyDirectives(config, field, gen);
125125
if (isNonNullType(parentType)) {
126126
if (config.notAllowEmptyString === true) {
127127
const tsType = tsVisitor.scalars[type.name.value];
@@ -141,14 +141,14 @@ const generateInputObjectFieldTypeZodSchema = (
141141
const applyDirectives = (
142142
config: ValidationSchemaPluginConfig,
143143
field: InputValueDefinitionNode,
144-
gen: string,
144+
gen: string
145145
): string => {
146146
if (config.directives && field.directives) {
147147
const formatted = formatDirectiveConfig(config.directives);
148148
return gen + buildApi(formatted, field.directives);
149149
}
150-
return gen
151-
}
150+
return gen;
151+
};
152152

153153
const generateNameNodeZodSchema = (
154154
config: ValidationSchemaPluginConfig,

tests/zod.spec.ts

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -296,10 +296,10 @@ describe('zod', () => {
296296
schema: 'zod',
297297
directives: {
298298
constraint: {
299-
minLength: ['min', "$1", "Please input more than $1"],
300-
maxLength: ['max', "$1", "Please input less than $1"]
301-
}
302-
}
299+
minLength: ['min', '$1', 'Please input more than $1'],
300+
maxLength: ['max', '$1', 'Please input less than $1'],
301+
},
302+
},
303303
},
304304
{}
305305
);
@@ -310,7 +310,7 @@ describe('zod', () => {
310310
for (const wantContain of wantContains) {
311311
expect(result.content).toContain(wantContain);
312312
}
313-
})
313+
});
314314
it('not null field', async () => {
315315
const schema = buildSchema(/* GraphQL */ `
316316
input UserCreateInput {
@@ -326,10 +326,10 @@ describe('zod', () => {
326326
schema: 'zod',
327327
directives: {
328328
constraint: {
329-
minLength: ['min', "$1", "Please input more than $1"],
330-
maxLength: ['max', "$1", "Please input less than $1"]
331-
}
332-
}
329+
minLength: ['min', '$1', 'Please input more than $1'],
330+
maxLength: ['max', '$1', 'Please input less than $1'],
331+
},
332+
},
333333
},
334334
{}
335335
);
@@ -340,7 +340,7 @@ describe('zod', () => {
340340
for (const wantContain of wantContains) {
341341
expect(result.content).toContain(wantContain);
342342
}
343-
})
343+
});
344344
it('list field', async () => {
345345
const schema = buildSchema(/* GraphQL */ `
346346
input UserCreateInput {
@@ -356,10 +356,10 @@ describe('zod', () => {
356356
schema: 'zod',
357357
directives: {
358358
constraint: {
359-
minLength: ['min', "$1", "Please input more than $1"],
360-
maxLength: ['max', "$1", "Please input less than $1"]
361-
}
362-
}
359+
minLength: ['min', '$1', 'Please input more than $1'],
360+
maxLength: ['max', '$1', 'Please input less than $1'],
361+
},
362+
},
363363
},
364364
{}
365365
);
@@ -370,6 +370,6 @@ describe('zod', () => {
370370
for (const wantContain of wantContains) {
371371
expect(result.content).toContain(wantContain);
372372
}
373-
})
373+
});
374374
});
375375
});

0 commit comments

Comments
 (0)