From ef7502be3409eaa321a4a376cbf3d2f2d8e3aab6 Mon Sep 17 00:00:00 2001 From: Elian Doran Date: Thu, 26 Mar 2026 19:27:25 +0200 Subject: [PATCH] chore(scripts): filter typecheck to avoid cascading errors --- package.json | 2 +- scripts/filter-tsc-output.mts | 24 ++++++++++++++++++++++++ 2 files changed, 25 insertions(+), 1 deletion(-) create mode 100644 scripts/filter-tsc-output.mts diff --git a/package.json b/package.json index c20996da39..ee4cea354b 100644 --- a/package.json +++ b/package.json @@ -37,7 +37,7 @@ "test:all": "pnpm test:parallel && pnpm test:sequential", "test:parallel": "pnpm --filter=!server --filter=!ckeditor5-mermaid --filter=!ckeditor5-math --parallel test", "test:sequential": "pnpm --filter=server --filter=ckeditor5-mermaid --filter=ckeditor5-math --sequential test", - "typecheck": "tsc --build", + "typecheck": "tsc --build | tsx scripts/filter-tsc-output.mts", "dev:format-check": "eslint -c eslint.format.config.mjs .", "dev:format-fix": "eslint -c eslint.format.config.mjs . --fix", "dev:linter-check": "cross-env NODE_OPTIONS=--max_old_space_size=4096 eslint .", diff --git a/scripts/filter-tsc-output.mts b/scripts/filter-tsc-output.mts new file mode 100644 index 0000000000..754be10f66 --- /dev/null +++ b/scripts/filter-tsc-output.mts @@ -0,0 +1,24 @@ +/** + * Filters out TS6305 cascade errors from tsc --build output. + * These "Output file has not been built from source" errors are noise + * caused by upstream build failures and obscure the real errors. + */ + +const SUPPRESSED_CODES = ["TS6305"]; + +let data = ""; +process.stdin.resume(); +process.stdin.setEncoding("utf-8"); +process.stdin.on("data", (chunk) => (data += chunk)); +process.stdin.on("end", () => { + const filtered = data + .split(/\r?\n/) + .filter((line) => !SUPPRESSED_CODES.some((code) => line.includes(code))) + .join("\n") + .trim(); + + if (filtered) { + console.log(filtered); + process.exit(1); + } +});