prefer-module-level-refined-schema
Declare closed Zod scalar, format, and wrapper schemas at module scope.
Why
A closed validation pipeline created inside a function is rebuilt on every invocation and obscures a reusable constraint.
Fix
Move the validation schema to module scope, name it with a PascalCase Schema suffix, and call parse on the shared schema.
Examples
import { z } from "zod";export function parse(value: unknown) { return z.string().trim().min(1).max(128).parse(value);}import { z } from "zod";const BatchSizeSchema = z.number().int().min(1).max(1000);export function parse(value: unknown) { return BatchSizeSchema.parse(value);}