import { readdirSync } from 'node:fs'; import { join } from 'node:path'; import { spawnSync } from 'node:child_process'; let count = 0; for (const folder of ['src', 'public', 'extension', 'tests', 'scripts']) { for (const file of readdirSync(folder)) { if (!file.endsWith('.js')) continue; const path = join(folder, file), result = spawnSync(process.execPath, ['--check', path], { stdio: 'inherit' }); if (result.status !== 0) process.exit(result.status || 1); count++; } } console.log(`Syntax checked ${count} JavaScript files.`);