Skip to content

Commit 6bba703

Browse files
committed
lint: run lint on self
1 parent 637d9fb commit 6bba703

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/presets/standard-schema.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ const standardSchemaV1ContractSrc =
3636

3737
// codegen:start {preset: str, source: ../standard-schema/errors.ts, const: standardSchemaV1ErrorsSrc, excludeLines: ['^import']}
3838
const standardSchemaV1ErrorsSrc =
39-
"\nexport const prettifyStandardSchemaError = (error: unknown): string | null => {\n if (!looksLikeStandardSchemaFailure(error)) return null\n\n const issues = [...error.issues]\n .map(issue => {\n const path = issue.path || []\n const primitivePathSegments = path.map(segment => {\n if (typeof segment === 'string' || typeof segment === 'number' || typeof segment === 'symbol') return segment\n return segment.key\n })\n const dotPath = toDotPath(primitivePathSegments)\n return {\n issue,\n path,\n primitivePathSegments,\n dotPath,\n }\n })\n .sort((a, b) => a.path.length - b.path.length)\n\n const lines: string[] = []\n\n for (const {issue, dotPath} of issues) {\n let message = `✖ ${issue.message}`\n if (dotPath) message += ` → at ${dotPath}`\n lines.push(message)\n }\n\n return lines.join('\\n')\n}\n\nexport function toDotPath(path: (string | number | symbol)[]): string {\n const segs: string[] = []\n for (const seg of path) {\n if (typeof seg === 'number') segs.push(`[${seg}]`)\n else if (typeof seg === 'symbol') segs.push(`[${JSON.stringify(String(seg))}]`)\n else if (/[^\\w$]/.test(seg)) segs.push(`[${JSON.stringify(seg)}]`)\n else {\n if (segs.length) segs.push('.')\n segs.push(seg)\n }\n }\n\n return segs.join('')\n}\n\nexport class StandardSchemaV1Error extends Error implements StandardSchemaV1.FailureResult {\n issues: StandardSchemaV1.FailureResult['issues']\n constructor(failure: StandardSchemaV1.FailureResult, options?: {cause?: Error}) {\n super('Standard Schema error - details in `issues`.', options)\n this.issues = failure.issues\n }\n}\n"
39+
"\nexport const prettifyErrorIfStandardSchemaFailure = (error: unknown): string | null => {\n if (!looksLikeStandardSchemaFailure(error)) return null\n return prettifyStandardSchemaError(error)\n}\n\nexport const prettifyStandardSchemaError = (error: StandardSchemaV1.FailureResult): string => {\n const issues = [...error.issues]\n .map(issue => {\n const path = issue.path || []\n const primitivePathSegments = path.map(segment => {\n if (typeof segment === 'string' || typeof segment === 'number' || typeof segment === 'symbol') return segment\n return segment.key\n })\n const dotPath = toDotPath(primitivePathSegments)\n return {\n issue,\n path,\n primitivePathSegments,\n dotPath,\n }\n })\n .sort((a, b) => a.path.length - b.path.length)\n\n const lines: string[] = []\n\n for (const {issue, dotPath} of issues) {\n let message = `✖ ${issue.message}`\n if (dotPath) message += ` → at ${dotPath}`\n lines.push(message)\n }\n\n return lines.join('\\n')\n}\n\nexport function toDotPath(path: (string | number | symbol)[]): string {\n const segs: string[] = []\n for (const seg of path) {\n if (typeof seg === 'number') segs.push(`[${seg}]`)\n else if (typeof seg === 'symbol') segs.push(`[${JSON.stringify(String(seg))}]`)\n else if (/[^\\w$]/.test(seg)) segs.push(`[${JSON.stringify(seg)}]`)\n else {\n if (segs.length) segs.push('.')\n segs.push(seg)\n }\n }\n\n return segs.join('')\n}\n\nexport class StandardSchemaV1Error extends Error implements StandardSchemaV1.FailureResult {\n issues: StandardSchemaV1.FailureResult['issues']\n constructor(failure: StandardSchemaV1.FailureResult, options?: {cause?: Error}) {\n super('Standard Schema error - details in `issues`.', options)\n this.issues = failure.issues\n }\n}\n"
4040
// codegen:end
4141

4242
// codegen:start {preset: str, source: ../standard-schema/utils.ts, const: standardSchemaV1UtilsSrc, excludeLines: ['^import']}

0 commit comments

Comments
 (0)