From a3ccd92366fe1ace551b334f2b0aaa7d7137b577 Mon Sep 17 00:00:00 2001 From: Benjamin Lu Date: Wed, 28 Jan 2026 18:51:51 -0800 Subject: [PATCH] fix: simplify telemetry scan --- scripts/verify-dist-no-telemetry.ts | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) 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 })