From 733d763f44d18aaf192b4f9c7ea3c49bf2e95658 Mon Sep 17 00:00:00 2001 From: Laith Al-Saadoon Date: Thu, 9 Jul 2026 03:06:56 +0000 Subject: [PATCH] fix(sarif): guard optional chain in baseline.test.ts for Biome 2.5.3 Biome 2.5.3 tightened lint/correctness/noUnsafeOptionalChaining and now flags two spots in baseline.test.ts where an optional chain (tagged.runs[0]?.results?.[0]) was followed by a non-optional .baselineState member access on the next line. If the chain short-circuits to undefined, the access throws TypeError. Add the optional-chaining operator so the access is guarded. Behavior is unchanged for the passing path (value present); if the chain were ever undefined the assertion now fails on value mismatch instead of a raw TypeError. Unblocks the Biome 2.5.2 -> 2.5.3 bump in the typescript-tooling group (PR #287), whose lint + self-scan jobs fail on this pre-existing code. --- packages/sarif/src/baseline.test.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/sarif/src/baseline.test.ts b/packages/sarif/src/baseline.test.ts index 222d0f49..74a33a41 100644 --- a/packages/sarif/src/baseline.test.ts +++ b/packages/sarif/src/baseline.test.ts @@ -133,7 +133,7 @@ test("diffSarif: same fingerprint, changed message → updated", () => { const tagged = applyBaselineState(current, baseline); const state = (tagged.runs[0]?.results?.[0] as unknown as { baselineState?: string }) - .baselineState; + ?.baselineState; assert.equal(state, "updated"); }); @@ -172,7 +172,7 @@ test("diffSarif: git-mv rename — rename chain resolves URI-only changes to unc const tagged = applyBaselineState(current, baseline, { renameChainFor }); const state = (tagged.runs[0]?.results?.[0] as unknown as { baselineState?: string }) - .baselineState; + ?.baselineState; assert.equal(state, "unchanged"); });