From 49413af045f3013396ffd9f6f989e426b82a489c Mon Sep 17 00:00:00 2001 From: donghyeon-ka Date: Sun, 27 Sep 2026 13:32:33 +0900 Subject: [PATCH] fix(types): turn on noUnusedLocals and drop the unused declarations (12-12) VD-01 decision 3 hands unused diagnostics to tsc and turns off ESLint's no-unused-vars for TS files, but tsconfig.base.json never enabled the tsc check (D-19). The flag found 46 unused imports, types and helpers across 22 files; none of them were read, so removing them changes no behaviour. Co-Authored-By: Claude Opus 5.5 --- scripts/check-remediation-ledger.ts | 2 +- scripts/drill-runbook.ts | 1 - scripts/generate-supply-chain.ts | 4 --- scripts/lib/ci-candidate-archive.ts | 1 - scripts/verify-release.ts | 1 - .../image-cdn/image-cdn-runtime.ts | 1 - .../presigned/presigned-transfer-executor.ts | 1 - .../storage/opfs/indexeddb-opfs-journal.ts | 3 --- src/bootstrap/runtime-adapters.ts | 1 - .../feature-http-binding.test.ts | 1 - .../ci-runner/ci-artifact-contract.test.ts | 27 ------------------- .../browser-rpc/browser-rpc-runtime.test.ts | 1 - tests/unit/opfs-byte-store.test.ts | 1 - .../unit/presigned-transfer-delivery.test.ts | 11 -------- .../unit/presigned-transfer-download.test.ts | 2 -- tests/unit/presigned-transfer-upload.test.ts | 4 --- tests/unit/presigned-transfer.test.ts | 2 -- .../realtime-reconnect-coordinator.test.ts | 1 - tests/unit/resumable-upload-runtime.test.ts | 11 -------- tests/unit/security-promotion-staging.test.ts | 1 - ...ervice-worker-web-push-remediation.test.ts | 2 +- tests/unit/tanstack-cache-coordinator.test.ts | 2 +- tsconfig.base.json | 1 + 23 files changed, 4 insertions(+), 78 deletions(-) diff --git a/scripts/check-remediation-ledger.ts b/scripts/check-remediation-ledger.ts index 9f322cce..0fe976fc 100644 --- a/scripts/check-remediation-ledger.ts +++ b/scripts/check-remediation-ledger.ts @@ -1,4 +1,4 @@ -import { access, readFile } from "node:fs/promises"; +import { readFile } from "node:fs/promises"; /** * GOV-03. Joins the machine-readable remediation dispositions against the prose diff --git a/scripts/drill-runbook.ts b/scripts/drill-runbook.ts index fe702bec..020c46fa 100644 --- a/scripts/drill-runbook.ts +++ b/scripts/drill-runbook.ts @@ -12,7 +12,6 @@ import type { InstalledContractPackageIdentity } from "../src/contracts/external import { parseReleaseArtifact, parseRuntimeConfigArtifact, - type ReleaseArtifact, } from "../src/contracts/release-artifacts.ts"; import { projectTelemetryEvent } from "../src/contracts/telemetry.ts"; import { EXPECTED_CONTRACT_SET_PACKAGES } from "../src/features/installed-contract-contributions.ts"; diff --git a/scripts/generate-supply-chain.ts b/scripts/generate-supply-chain.ts index 24682bd9..505f63d7 100644 --- a/scripts/generate-supply-chain.ts +++ b/scripts/generate-supply-chain.ts @@ -66,10 +66,6 @@ async function jsonDocument(file: string): Promise { return documentValue(parsed, file); } -async function sha256File(file: string): Promise { - return createHash("sha256").update(await readFile(file)).digest("hex"); -} - async function optionalJson(file: string): Promise { try { const parsed: unknown = JSON.parse(await readFile(file, "utf8")); diff --git a/scripts/lib/ci-candidate-archive.ts b/scripts/lib/ci-candidate-archive.ts index 741904cd..55cf31fc 100644 --- a/scripts/lib/ci-candidate-archive.ts +++ b/scripts/lib/ci-candidate-archive.ts @@ -4,7 +4,6 @@ import { constants } from "node:fs"; import type { FileHandle } from "node:fs/promises"; import { lstat, - mkdir, open, readFile, readdir, diff --git a/scripts/verify-release.ts b/scripts/verify-release.ts index 54a54cbd..a5a718c7 100644 --- a/scripts/verify-release.ts +++ b/scripts/verify-release.ts @@ -88,7 +88,6 @@ const fixturesDocument = parseFixturesDocument( const verifiedRuntime = await verifyReleaseArtifactsCoherence(); const { release, - runtime: runtimeConfig, coherence: artifactComparison, } = verifiedRuntime; const buildManifestDocument: unknown = JSON.parse( diff --git a/src/adapters/browser-transfer/image-cdn/image-cdn-runtime.ts b/src/adapters/browser-transfer/image-cdn/image-cdn-runtime.ts index d27c41ce..a76f9499 100644 --- a/src/adapters/browser-transfer/image-cdn/image-cdn-runtime.ts +++ b/src/adapters/browser-transfer/image-cdn/image-cdn-runtime.ts @@ -5,7 +5,6 @@ import type { ImageCdnRuntime, ImageOutputFormat, ImagePresentationDescriptor, - ImagePresetReference, ImageProbeReceipt, ImageRasterMediaType, ImageResourceProbePort, diff --git a/src/adapters/browser-transfer/presigned/presigned-transfer-executor.ts b/src/adapters/browser-transfer/presigned/presigned-transfer-executor.ts index e6f8aeee..5f945094 100644 --- a/src/adapters/browser-transfer/presigned/presigned-transfer-executor.ts +++ b/src/adapters/browser-transfer/presigned/presigned-transfer-executor.ts @@ -17,7 +17,6 @@ import { RESUMABLE_UPLOAD_PROTOCOL } from "../../../application/ports/browser-tr import type { BrowserDataFailureCode, BrowserDataObserver, - BrowserDataOperation, BrowserDataRecovery, BrowserDataResult, } from "../../../application/ports/browser-file-storage/shared.ts"; diff --git a/src/adapters/storage/opfs/indexeddb-opfs-journal.ts b/src/adapters/storage/opfs/indexeddb-opfs-journal.ts index 9a7a2358..dd8fb8ce 100644 --- a/src/adapters/storage/opfs/indexeddb-opfs-journal.ts +++ b/src/adapters/storage/opfs/indexeddb-opfs-journal.ts @@ -1,7 +1,5 @@ import type { BeginOpfsJournalTransaction, - OpfsCommittedObjectPage, - OpfsJournalPage, OpfsJournalPort, OpfsJournalTransaction, OpfsPreparedObject, @@ -16,7 +14,6 @@ import { } from "../../../application/ports/browser-file-storage/shared.ts"; import { browserDataFailure, - browserDataSuccess, mapIndexedDbException, } from "../../browser-file-storage/result.ts"; import { snapshotAbortTimers } from "../../platform/abortable-operation.ts"; diff --git a/src/bootstrap/runtime-adapters.ts b/src/bootstrap/runtime-adapters.ts index bee3614a..a7e1f626 100644 --- a/src/bootstrap/runtime-adapters.ts +++ b/src/bootstrap/runtime-adapters.ts @@ -42,7 +42,6 @@ import { INSTALLED_REST_AUTH_PROFILES, } from "../contracts/rest-profiles.ts"; import type { ClockPort } from "../application/ports/clock-port.ts"; -import type { MutationIntent } from "../contracts/mutation-intent.ts"; import { createInstalledFeatureInputs } from "../features/installed-feature-adapters.ts"; import { INVALIDATION_REGISTRY, diff --git a/tests/contract/reusable-capability/feature-http-binding.test.ts b/tests/contract/reusable-capability/feature-http-binding.test.ts index a4960a50..c9ddbe14 100644 --- a/tests/contract/reusable-capability/feature-http-binding.test.ts +++ b/tests/contract/reusable-capability/feature-http-binding.test.ts @@ -18,7 +18,6 @@ import type { type ResourceInput = Readonly<{ resourceId: string }>; type ResourceWire = Readonly<{ id: string; title: string }>; type ResourceProblem = Readonly<{ code?: string }>; -type Resource = Readonly<{ id: string; title: string }>; function validator(schemaId: string): RuntimeValidator { return Object.freeze({ diff --git a/tests/system/ci-runner/ci-artifact-contract.test.ts b/tests/system/ci-runner/ci-artifact-contract.test.ts index bb47cd34..4982fae0 100644 --- a/tests/system/ci-runner/ci-artifact-contract.test.ts +++ b/tests/system/ci-runner/ci-artifact-contract.test.ts @@ -1716,33 +1716,6 @@ async function readCgroupPids(cgroupRoot: string): Promise { .trim().split("\n").filter(Boolean).map(Number); } -async function waitForRecordedProviderTree( - tree: ReturnType, - providerScript: string, -): Promise { - for (let attempt = 0; attempt < 400; attempt += 1) { - const children = tree.directChildArguments(); - const members = tree.cgroupArguments(); - // Every process the assertions below reason about. Returning as soon as - // some of them are present is what left bubblewrap out of the recording: - // it enters the scope a few milliseconds after the wrapper does. - if ( - children.some((value) => value.includes("/usr/bin/systemd-run")) && - children.some((value) => value.includes("provider-raw-guardian.ts")) && - members.some((value) => value.includes("provider-scope-wrapper.ts")) && - members.some((value) => /\/usr\/bin\/(?:bwrap|prlimit)/u.test(value)) && - members.some((value) => value.includes(providerScript)) - ) { - return; - } - await delay(10); - } - throw new Error( - "the provider run never contained a systemd-run child, a guardian child, " + - "a scope wrapper, a sandbox and the provider itself in its cgroup", - ); -} - async function waitForDirectChildMatching(supervisorPid: number, pattern: string): Promise { for (let attempt = 0; attempt < 120; attempt += 1) { const children = (await readFile(`/proc/${supervisorPid}/task/${supervisorPid}/children`, "utf8")) diff --git a/tests/unit/browser-rpc/browser-rpc-runtime.test.ts b/tests/unit/browser-rpc/browser-rpc-runtime.test.ts index 1e68ef5e..629bcb55 100644 --- a/tests/unit/browser-rpc/browser-rpc-runtime.test.ts +++ b/tests/unit/browser-rpc/browser-rpc-runtime.test.ts @@ -21,7 +21,6 @@ import { streamProfile, unaryOperation, unaryProfile, - type ResourceView, } from "./fixture.ts"; describe("Browser RPC provider-neutral runtime", () => { diff --git a/tests/unit/opfs-byte-store.test.ts b/tests/unit/opfs-byte-store.test.ts index a81d5f2e..68653d46 100644 --- a/tests/unit/opfs-byte-store.test.ts +++ b/tests/unit/opfs-byte-store.test.ts @@ -8,7 +8,6 @@ import type { OpfsStorageScope, } from "../../src/application/ports/browser-file-storage/opfs-ports.ts"; import type { - BrowserDataResult, BrowserStoragePolicy, ByteSource, } from "../../src/application/ports/browser-file-storage/shared.ts"; diff --git a/tests/unit/presigned-transfer-delivery.test.ts b/tests/unit/presigned-transfer-delivery.test.ts index 65d7f0dd..0c7537e5 100644 --- a/tests/unit/presigned-transfer-delivery.test.ts +++ b/tests/unit/presigned-transfer-delivery.test.ts @@ -9,23 +9,12 @@ import { type SaveFileHandle, } from "../../src/adapters/browser-files/download-delivery-adapter.ts"; import { - CHECKSUM_HEADER, CONTROL_ENDPOINT, - DATA_ORIGIN, - DIGEST_HEADER, - DOWNLOAD_HREF, - DOWNLOAD_PATH, NOW, - POLICY_HEADER, - REQUEST_BINDING_SHA256, - UPLOAD_SESSION_ID, - collect, createHarness, downloadCapabilityPayload, downloadResponse, jsonResponse, - responseWithUrl, - uploadCapabilityPayload, } from "./presigned-transfer-fixture.ts"; describe("presigned DownloadDelivery integration", () => { diff --git a/tests/unit/presigned-transfer-download.test.ts b/tests/unit/presigned-transfer-download.test.ts index 38f7a331..2cd336f1 100644 --- a/tests/unit/presigned-transfer-download.test.ts +++ b/tests/unit/presigned-transfer-download.test.ts @@ -4,10 +4,8 @@ import { PRESIGNED_TRANSFER_PROTOCOL } from "../../src/application/ports/browser import { createPresignedCapabilityVault } from "../../src/adapters/browser-transfer/presigned/presigned-capability-vault.ts"; import { sha256Hex } from "../../src/adapters/browser-transfer/presigned/incremental-sha256.ts"; import { - CHECKSUM_HEADER, CONTROL_ENDPOINT, DATA_ORIGIN, - DIGEST_HEADER, DOWNLOAD_HREF, DOWNLOAD_PATH, NOW, diff --git a/tests/unit/presigned-transfer-upload.test.ts b/tests/unit/presigned-transfer-upload.test.ts index 8c550e9a..3cc43f07 100644 --- a/tests/unit/presigned-transfer-upload.test.ts +++ b/tests/unit/presigned-transfer-upload.test.ts @@ -5,11 +5,7 @@ import { sha256Hex } from "../../src/adapters/browser-transfer/presigned/increme import { CHECKSUM_HEADER, CONTROL_ENDPOINT, - DATA_ORIGIN, - DIGEST_HEADER, DOWNLOAD_HREF, - DOWNLOAD_PATH, - NOW, POLICY_HEADER, REQUEST_BINDING_SHA256, UPLOAD_SESSION_ID, diff --git a/tests/unit/presigned-transfer.test.ts b/tests/unit/presigned-transfer.test.ts index 3468209e..22f67d79 100644 --- a/tests/unit/presigned-transfer.test.ts +++ b/tests/unit/presigned-transfer.test.ts @@ -12,14 +12,12 @@ import { sha256Hex, } from "../../src/adapters/browser-transfer/presigned/incremental-sha256.ts"; import { - CHECKSUM_HEADER, CONTROL_ENDPOINT, DATA_ORIGIN, DIGEST_HEADER, DOWNLOAD_HREF, DOWNLOAD_PATH, NOW, - POLICY_HEADER, REQUEST_BINDING_SHA256, UPLOAD_SESSION_ID, collect, diff --git a/tests/unit/realtime/realtime-reconnect-coordinator.test.ts b/tests/unit/realtime/realtime-reconnect-coordinator.test.ts index a3003fea..85d11551 100644 --- a/tests/unit/realtime/realtime-reconnect-coordinator.test.ts +++ b/tests/unit/realtime/realtime-reconnect-coordinator.test.ts @@ -2,7 +2,6 @@ import { describe, expect, it, vi } from "vitest"; import type { ClockPort } from "../../../src/application/ports/clock-port.ts"; import type { - RealtimeFailureKind, RealtimeResult, } from "../../../src/application/ports/realtime/shared.ts"; import { diff --git a/tests/unit/resumable-upload-runtime.test.ts b/tests/unit/resumable-upload-runtime.test.ts index 5ff8cbca..e0fcba58 100644 --- a/tests/unit/resumable-upload-runtime.test.ts +++ b/tests/unit/resumable-upload-runtime.test.ts @@ -5,19 +5,13 @@ import type { PresignedUploadPartPort, } from "../../src/application/ports/browser-transfer/presigned-transfer.ts"; import type { - ResumableUploadCheckpoint, - ResumableUploadCheckpointStore, ResumableUploadControlPlane, ResumableUploadSource, UploadPartExecutor, - UploadPartReceipt, - UploadProviderResult, - UploadSession, } from "../../src/application/ports/browser-transfer/resumable-upload.ts"; import { RESUMABLE_UPLOAD_PROTOCOL } from "../../src/application/ports/browser-transfer/resumable-upload.ts"; import type { BrowserDataObservation, - BrowserDataResult, } from "../../src/application/ports/browser-file-storage/shared.ts"; import { browserDataFailure, @@ -27,11 +21,6 @@ import { createIndexedDbResumableUploadCheckpointStore } from "../../src/adapter import { createPresignedUploadPartExecutor } from "../../src/adapters/browser-transfer/resumable-upload/presigned-upload-part-executor.ts"; import { createResumableUploadRuntime } from "../../src/adapters/browser-transfer/resumable-upload/resumable-upload-runtime.ts"; import { resolveResumableUploadRuntimePolicy } from "../../src/adapters/browser-transfer/resumable-upload/runtime-policy.ts"; -import type { - UploadCancellationChannel, - UploadCancellationListener, -} from "../../src/adapters/browser-transfer/resumable-upload/upload-cancellation-channel.ts"; -import type { UploadMutationLock } from "../../src/adapters/browser-transfer/resumable-upload/upload-mutation-lock.ts"; import { MemoryIndexedDbFactory } from "../helpers/memory-indexeddb.ts"; import { diff --git a/tests/unit/security-promotion-staging.test.ts b/tests/unit/security-promotion-staging.test.ts index 69ee88f7..9668adc7 100644 --- a/tests/unit/security-promotion-staging.test.ts +++ b/tests/unit/security-promotion-staging.test.ts @@ -1,4 +1,3 @@ -import { createHash } from "node:crypto"; import { spawnSync } from "node:child_process"; import { chmod, diff --git a/tests/unit/service-worker-web-push-remediation.test.ts b/tests/unit/service-worker-web-push-remediation.test.ts index 68cfa7cc..9a163265 100644 --- a/tests/unit/service-worker-web-push-remediation.test.ts +++ b/tests/unit/service-worker-web-push-remediation.test.ts @@ -1,4 +1,4 @@ -import { afterEach, describe, expect, it, vi } from "vitest"; +import { afterEach, describe, expect, it } from "vitest"; import { mkdir, mkdtemp, rm, writeFile } from "node:fs/promises"; import { tmpdir } from "node:os"; diff --git a/tests/unit/tanstack-cache-coordinator.test.ts b/tests/unit/tanstack-cache-coordinator.test.ts index 07ac65c1..aa8aa888 100644 --- a/tests/unit/tanstack-cache-coordinator.test.ts +++ b/tests/unit/tanstack-cache-coordinator.test.ts @@ -172,7 +172,7 @@ describe("TanStack cross-context cache coordinator", () => { topicVersions: topicVersions(), crossContext: harness.transport, }; - const coordinator = createTanStackCacheCoordinator(dependencies); + createTanStackCacheCoordinator(dependencies); harness.deliver(TOPIC_A); diff --git a/tsconfig.base.json b/tsconfig.base.json index 5a5dcacd..5470dca9 100644 --- a/tsconfig.base.json +++ b/tsconfig.base.json @@ -11,6 +11,7 @@ "allowImportingTsExtensions": true, "jsx": "react-jsx", "strict": true, + "noUnusedLocals": true, "skipLibCheck": true, "forceConsistentCasingInFileNames": true, "isolatedModules": true