(
zodIssues: ReadonlyArray<{ path: PropertyKey[]; message: string; code: string }>,
projectFile: LoadedYamlFile,
)
| 73 | } |
| 74 | |
| 75 | function annotateIssuesWithSource( |
| 76 | zodIssues: ReadonlyArray<{ path: PropertyKey[]; message: string; code: string }>, |
| 77 | projectFile: LoadedYamlFile, |
| 78 | ): ConfigIssue[] { |
| 79 | return zodIssues.map((issue) => { |
| 80 | const path = issue.path.map((seg) => |
| 81 | typeof seg === 'symbol' ? String(seg) : (seg as string | number), |
| 82 | ); |
| 83 | const base: ConfigIssue = { |
| 84 | path, |
| 85 | message: issue.message, |
| 86 | issueCode: issue.code, |
| 87 | }; |
| 88 | if (projectFile.doc !== null && projectFile.source !== null) { |
| 89 | const located = locateIssue({ |
| 90 | file: projectFile.path, |
| 91 | source: projectFile.source, |
| 92 | doc: projectFile.doc, |
| 93 | path, |
| 94 | }); |
| 95 | if (located !== undefined) { |
| 96 | return { ...base, source: located }; |
| 97 | } |
| 98 | } |
| 99 | return base; |
| 100 | }); |
| 101 | } |
| 102 | |
| 103 | export function loadConfig(cwd?: string): LoadConfigResult { |
| 104 | const workingDir = cwd ?? process.cwd(); |
no test coverage detected