From 566043eb540c58642472dd47a4ab8e1ee52ef67b Mon Sep 17 00:00:00 2001 From: Peter Steinberger Date: Sun, 12 Jul 2026 10:57:26 +0100 Subject: [PATCH] feat(tooling): enforce noUncheckedIndexedAccess from the base tsconfig (NUIA endgame) (#105239) * feat(tooling): enforce noUncheckedIndexedAccess from the base tsconfig Completes #104600: the flag moves to tsconfig.json, the five per-lane copies are removed, and test lanes carry one documented opt-out at their shared parent (the ~4,400 fixture-indexing sites are a tracked lane-by-lane follow-up). Any future lane inherits the flag by default. Synthetic probes verify src rejects unchecked reads while test files compile; all nine lane commands green. * fix(memory-core): give the batch-call sort a defined element type Type-aware lint analyzes test files under the base flag (its tsconfig extends the root, not the test parent), so the widened call[0] made the bare toSorted() fire require-array-sort-compare. --- extensions/memory-core/src/memory/index.test.ts | 2 +- test/tsconfig/tsconfig.test.json | 3 +++ tsconfig.core.json | 1 - tsconfig.extensions.json | 1 - tsconfig.json | 1 + tsconfig.scripts.json | 1 - tsconfig.ui.json | 1 - 7 files changed, 5 insertions(+), 5 deletions(-) diff --git a/extensions/memory-core/src/memory/index.test.ts b/extensions/memory-core/src/memory/index.test.ts index a9c959abf0cb..31ad28e49902 100644 --- a/extensions/memory-core/src/memory/index.test.ts +++ b/extensions/memory-core/src/memory/index.test.ts @@ -880,7 +880,7 @@ describe("memory index", () => { expect(providerRuntimeBatchCalls).toHaveLength(3); expect(providerRuntimeBatchCalls.every((call) => call.length === 1)).toBe(true); - expect(providerRuntimeBatchCalls.map((call) => call[0]).toSorted()).toEqual( + expect(providerRuntimeBatchCalls.map((call) => call[0] ?? "").toSorted()).toEqual( [ "# Log\nAlpha memory line.\nZebra memory line.", "# Log\nBeta memory line.", diff --git a/test/tsconfig/tsconfig.test.json b/test/tsconfig/tsconfig.test.json index 82cbb3af6d7b..344a18aaeb45 100644 --- a/test/tsconfig/tsconfig.test.json +++ b/test/tsconfig/tsconfig.test.json @@ -1,6 +1,9 @@ { "extends": "../../tsconfig.json", "compilerOptions": { + // Test lanes opt out of noUncheckedIndexedAccess for now (~4,400 fixture + // indexing sites); tracked as a lane-by-lane follow-up to #104600. + "noUncheckedIndexedAccess": false, "rootDir": "../.." }, "include": [ diff --git a/tsconfig.core.json b/tsconfig.core.json index 8e6b0b4eaa86..19c5c8b9892d 100644 --- a/tsconfig.core.json +++ b/tsconfig.core.json @@ -4,7 +4,6 @@ // Node-side production code must not see browser globals; ui/ owns DOM via tsconfig.ui.json. "lib": ["ES2023"], // Production indexed reads must account for missing entries. - "noUncheckedIndexedAccess": true, "noUnusedLocals": true, "noUnusedParameters": true, "tsBuildInfoFile": ".artifacts/tsgo-cache/core.tsbuildinfo" diff --git a/tsconfig.extensions.json b/tsconfig.extensions.json index 6b756eaf84bc..c1ee3c571f16 100644 --- a/tsconfig.extensions.json +++ b/tsconfig.extensions.json @@ -2,7 +2,6 @@ "extends": "./tsconfig.json", "compilerOptions": { // Plugin production indexed reads must account for missing entries. - "noUncheckedIndexedAccess": true, "noUnusedLocals": true, "noUnusedParameters": true, "tsBuildInfoFile": ".artifacts/tsgo-cache/extensions.tsbuildinfo" diff --git a/tsconfig.json b/tsconfig.json index ac6429e4a452..9d70f3406a6f 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -12,6 +12,7 @@ "moduleResolution": "NodeNext", "noImplicitOverride": true, "noImplicitReturns": true, + "noUncheckedIndexedAccess": true, "noEmit": true, "noEmitOnError": true, "noUncheckedSideEffectImports": true, diff --git a/tsconfig.scripts.json b/tsconfig.scripts.json index 2639e7947027..c253fa9a762f 100644 --- a/tsconfig.scripts.json +++ b/tsconfig.scripts.json @@ -1,7 +1,6 @@ { "extends": "./tsconfig.json", "compilerOptions": { - "noUncheckedIndexedAccess": true, "noUnusedLocals": true, "noUnusedParameters": true, "tsBuildInfoFile": ".artifacts/tsgo-cache/scripts.tsbuildinfo" diff --git a/tsconfig.ui.json b/tsconfig.ui.json index 02539fb38332..0d9682fa90c0 100644 --- a/tsconfig.ui.json +++ b/tsconfig.ui.json @@ -2,7 +2,6 @@ "extends": "./tsconfig.json", "compilerOptions": { // Control UI indexed reads must account for missing entries. - "noUncheckedIndexedAccess": true, "noUnusedLocals": true, "noUnusedParameters": true, "tsBuildInfoFile": ".artifacts/tsgo-cache/ui.tsbuildinfo"