diff --git a/scripts/verify-dist-no-telemetry.ts b/scripts/verify-dist-no-telemetry.ts index ca7f70ec4..42d40b9c5 100644 --- a/scripts/verify-dist-no-telemetry.ts +++ b/scripts/verify-dist-no-telemetry.ts @@ -32,13 +32,11 @@ for (const file of files) { const extension = extname(file).toLowerCase() if (ignoredExtensions.has(extension)) continue - const content = (await readFile(file)).toString('utf8') - const hits = telemetryPatterns - .map((pattern) => { - const match = content.match(pattern.regex) - return match ? { label: pattern.label, match: match[0] } : null - }) - .filter((hit): hit is { label: string; match: string } => hit !== null) + const content = await readFile(file, 'utf8') + const hits = telemetryPatterns.flatMap((pattern) => { + const match = content.match(pattern.regex) + return match ? [{ label: pattern.label, match: match[0] }] : [] + }) if (hits.length > 0) { violations.push({ file, hits })