(dir)
| 366 | }; |
| 367 | |
| 368 | const lintCheckFiles = async (dir) => { |
| 369 | const {default: prettier} = await import('prettier'); |
| 370 | const prettierConfig = await getPrettierConfig(); |
| 371 | |
| 372 | const filePaths = []; |
| 373 | ['.ts', '.tsx', '.js', '.d.ts', '.svelte'].forEach((extension) => |
| 374 | forEachDeepFile(dir, (filePath) => filePaths.push(filePath), extension), |
| 375 | ); |
| 376 | await allOf(filePaths, async (filePath) => { |
| 377 | const fileConfig = filePath.endsWith('.svelte') |
| 378 | ? {...prettierConfig, filepath: filePath, parser: undefined} |
| 379 | : {...prettierConfig, filepath: filePath}; |
| 380 | const code = await promises.readFile(filePath, UTF8); |
| 381 | if (!(await prettier.check(code, fileConfig))) { |
| 382 | writeFileSync(filePath, await prettier.format(code, fileConfig), UTF8); |
| 383 | } |
| 384 | }); |
| 385 | |
| 386 | const { |
| 387 | default: {ESLint}, |
| 388 | } = await import('eslint'); |
| 389 | const esLint = new ESLint({}); |
| 390 | const results = await esLint.lintFiles([dir]); |
| 391 | if ( |
| 392 | results.filter((result) => result.errorCount > 0 || result.warningCount > 0) |
| 393 | .length > 0 |
| 394 | ) { |
| 395 | const formatter = await esLint.loadFormatter(); |
| 396 | const errors = await formatter.format(results); |
| 397 | throw errors; |
| 398 | } |
| 399 | }; |
| 400 | |
| 401 | const lintCheckDocs = async (dir) => { |
| 402 | const { |
no test coverage detected
searching dependent graphs…