| 21 | } |
| 22 | |
| 23 | export 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 | |
| 42 | function main(args: Args): void { |
| 43 | const paths: string[] = args._ |