MCPcopy
hub / github.com/formatjs/formatjs / checkPath

Function checkPath

tools/check_no_internal_imports.ts:23–40  ·  view source on GitHub ↗
(targetPath: string)

Source from the content-addressed store, hash-verified

21}
22
23export function checkPath(targetPath: string): string[] {
24 const stat = statSync(targetPath, {throwIfNoEntry: false})
25 if (!stat) return []
26
27 if (stat.isFile() && /\.(js|d\.ts)$/.test(targetPath)) {
28 return checkFile(targetPath)
29 }
30
31 if (stat.isDirectory()) {
32 const errors: string[] = []
33 for (const entry of readdirSync(targetPath)) {
34 errors.push(...checkPath(join(targetPath, entry)))
35 }
36 return errors
37 }
38
39 return []
40}
41
42function main(args: Args): void {
43 const paths: string[] = args._

Callers 1

mainFunction · 0.85

Calls 1

checkFileFunction · 0.85

Tested by

no test coverage detected