Repository navigation
refactor(ts): modernize TypeScript idioms and lock them in (#56 part B) - #64
Merged
Merged
Conversation
modernization.md §5 row 1, TypeScript part. A new ESLint block over src/**/*.ts makes four idioms that are already absent errors, so they stay absent: - no-var var in src/: 0 -> 0 - prefer-rest-params arguments object: 0 -> 0 - @typescript-eslint/no-namespace namespace: 0 -> 0 - @typescript-eslint/no-unsafe-function-type Function type: 0 -> 0 Counts from the A.1 AST script (docs/cleanup/modernization.md appendix). The block is the home of every later lock-in of this story; exceptions are per-file overrides, never eslint-disable comments (suppressions stay 0). lintContract.test.cjs gains one test asserting the four rules are errors over src/**/*.ts. No source file changes; lint 0 errors, 204 warnings (budget unchanged). Gates: npm run lint, npm test 1054/1054 (1053 + the new contract test). Refs #56 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_014FkKt8WKa6XiX4gKgDL8Hu
modernization.md §5 row 4. Inline require() of Node built-ins becomes a
top-level `import * as … from '…'`:
- code_analysis/commands/directory_analysis/directoryAnalysisLivePanelCommands.ts
4 x require('path').dirname -> path.dirname
- servers/runtime/sse/SSEManager.ts
require('path').join + require('fs') -> path.join, fs.existsSync/statSync
- views/active_servers/items/activeServerItems.ts
require('path').basename -> path.basename
require (package), A.1 script: 7 in 3 files -> 0. executePython.ts has none
left: #35 already removed its 8. The 2 relative lazy requires
(directoryReAnalyzer.ts, getVisualizationConfiguration.ts, cycle breakers)
and the 8 in ModularTreeDataProvider.ts (load-bearing, skill §4) stay.
Lock-in: @typescript-eslint/no-require-imports is an error over src/, with
one per-file override block (rule off) for exactly those three files.
lintContract.test.cjs asserts the rule and pins the exemption list.
Text pins (grep of the basenames in test/ and scripts/):
- activeServerItems.ts: remoteAccessImplementation.test.cjs:123,175 reads it
and matches TreeItemCollapsibleState.Collapsed, "Local network address",
"Connected users", remoteAccess?.status, the participant contextValue
ternary - G (behaviour strings); none on the import block or line 516.
lanUrl.test.cjs loads it from out/ (behavioural).
guardrail-baseline.json lists it in size.filesOver500 (still over 500).
- directoryAnalysisLivePanelCommands.ts: no hits.
- SSEManager.ts: no text pins (only requireOut loads).
Built-ins are already loaded by the host, so hoisting the require changes
no evaluation order. The `fs` local that shadowed nothing is gone; the
calls are now typed (they were `any`).
H2 (CODEXR_NO_SOURCEMAPS=1 npm run package): dist/extension.js
b4c1894828cd (1,194,230 B) -> 5446d88cc487 (1,195,032 B, +802 B). The
diff touches only the three modules: the hoisted requires renamed the
minifier's locals, and SSEManager, which had no namespace import that
survived emit before, now carries TypeScript's __importStar helper. No
other module changed.
Gates: npm run lint (0 errors, 204 warnings, budget unchanged),
npm test 1055/1055.
Refs #56
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_014FkKt8WKa6XiX4gKgDL8Hu
modernization.md §5 row 5.
- servers/runtime/multiServerLauncher.ts generateServerId():
Math.random().toString(36).substr(2, 5) -> .slice(2, 7). Both arguments
are non-negative constants, so slice(start, start + length) returns the
same characters (both clamp at the end of the string).
substr(): 1 -> 0.
indexOf compares: the A.1 script reported 5 in 3 files, but re-reading them
none is a presence test: the 3 in executePython.ts are
`args[args.indexOf('--x') + 1]` (the index is used) and the 2 in
gitExportPythonWorkerPool.ts / gitBatchObjectReader.ts are
`newline = buf.indexOf('\n')` assignments the script counts as binary
expressions. Real `indexOf(...) !== -1` compares: 0 -> 0, so nothing to
convert; the typed rule confirms it reports nothing.
Lock-in (src/**/*.ts): @typescript-eslint/prefer-includes and
no-restricted-properties on `substr`, both errors; lintContract.test.cjs
asserts them.
Text pins: multiServerLauncher.test.cjs reads only its golden transcript
fixture, which normalizes ids with /server_\d+_[a-z0-9]+/ (behavioural, not
a source pin). folderDependencies.json mentions the module in prose only.
H2: dist/extension.js 5446d88cc487 -> f173adebd8e1 (-1 B); the only
changed statement is generateServerId's substr(2,5) -> slice(2,7).
Gates: npm run lint (0 errors, 204 warnings), npm test 1055/1055.
Refs #56
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_014FkKt8WKa6XiX4gKgDL8Hu
modernization.md §5 row 6. Every site the typed @typescript-eslint/prefer-optional-chain reports (10, in 7 files), rewritten by hand and each one reviewed for the one case where `a && a.b` and `a?.b` differ (a falsy, non-nullish `a`): - engine/processors/analysisBootstrap.ts:233 `!content || !content.trim()` -> `!content?.trim()`; content is string | undefined, '' gives true both ways. - services/serverWatcherIntegration.ts:154,158 (in find() predicates) `server.htmlFile && server.htmlFile.includes(x)` -> `server.htmlFile?.includes(x)`, same for customName. Both are `string | undefined` on ActiveServer (activeServerModel.ts:50,53). '' differs only if the needle is '': line 154 runs under `if (... && session.outputPath)`, line 158 searches 'Analysis', so the truthiness is the same. - analysis_settings/dimension_mapping_shared/sharedDimensionMappingSettingCore.ts:76 `!chart || !chart.dimensions` -> `!chart?.dimensions` (object | undefined). - servers/commands/serverCommands.ts:310 and visualize_data/views/interactions/visualizationLauncher.ts:96 `fileUri && fileUri[0]` -> `fileUri?.[0]` (Uri[] | undefined from showOpenDialog). - views/babia_examples/interactions/handleBabiaExampleClicks.ts:83,90,97 `item.babiaExample && item.babiaExample.isValid` -> `item.babiaExample?.isValid`. - visualization_settings/utils/settingsAccessors.ts:82 `legacySettings && legacySettings[field]` -> `legacySettings?.[field]`, in an `if`: for a falsy primitive both are falsy (indexing a primitive does not throw), for null/undefined both short-circuit. All are in boolean contexts. Count: typed rule 10 -> 0 (A.1 script `a && a.b`: 7 -> 1). Left on purpose: - serverWatcherIntegration.ts:151 `server.metadata && server.metadata.sessionId === sessionId`: not equivalent (`undefined === undefined` would match a server without metadata when sessionId is undefined); the rule does not report it either. - sharedChartTypeSettingCore.ts:103 `selectedItem && selectedItem.chart`: not reported by the typed rule; the plan keeps this row rule-driven. Lock-in: @typescript-eslint/prefer-optional-chain is an error over src/; lintContract.test.cjs asserts it. Text pins (basename grep in test/ and scripts/): - analysisBootstrap.ts: reanalysisArchitecture.test.cjs:132/152, directoryAnalysisStartup.test.cjs:29, livePanelDomIntegration.test.cjs:64/78/93/213 match buildTrackedFiles, resolveTrackedSystemPath, executeAnalysis, SHA256Generator, LivePanelParser construction, bootstrapVisualizeDOM - S/G, none on ensureBootstrapFiles' filter. - serverWatcherIntegration.ts: reanalysisArchitecture.test.cjs:16 matches stopWatchingSession - G, untouched. guardrail-baseline.json any.topFiles (count 8, unchanged). - sharedDimensionMappingSettingCore.ts: dimensionMappingShared.test.cjs:20 and xrFieldSchemaIntegration.test.cjs:38 match the class name, getFieldsForDataType, validateMappingsForChart, the mappedValue label, XRFieldSchemaService - G, untouched. - serverCommands.ts: remoteAccessImplementation.test.cjs:239-253 match the stopAll / uninstallManagedBinary ordering - G, untouched; serverCommandsContextGuard.test.cjs mentions it in a comment. - handleBabiaExampleClicks.ts: guardrail-baseline.json any.topFiles only. - settingsAccessors.ts, visualizationLauncher.ts: no text pins. Measurement: complexity.over10 54 -> 53 (fewer `&&`), recorded with guardrails:update. ESLint warnings 204 -> 204. H2: dist/extension.js f173adebd8e1 -> e927daf5a3fd (-78 B); the 9 changed statements are exactly the 10 sites above. Gates: npm run lint, npm test 1055/1055. Refs #56 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_014FkKt8WKa6XiX4gKgDL8Hu
modernization.md §5 row 7. Every concatenation that `prefer-template`
reports in src/ (8 sites, 6 files) becomes a template literal:
- babia_templates/processing/placeholders/createStructure.ts:138
getSSEScriptWithNonce: `scriptContent + '\n' + mainJsScript`
-> `${scriptContent}\n${mainJsScript}` (generated scene HTML, done last)
- babia_templates/processing/templateHTMLProcessor.ts:104,105 (debug log
arguments; `undefined + '...'` and `${undefined}...` are both
'undefined...')
- code_analysis/engine/utils/executePython.ts:78 (debug log)
- python_env/runtime/venvManager.ts:650 (error message; the first literal
line stays a literal, the second absorbs getErrorDetails(error))
- servers/utils/networkUtils.ts:94,95 (debug logs)
- utils/jsonFieldAnalyzer.ts:224 (nested `' • ' + sampleText` in an
existing template)
Every operand is a string (or `string | undefined` in the two log
previews), for which `+` and `${}` produce the same text.
Byte-identity of the generated HTML: getSSEScriptWithNonce was
characterized from out/ (fake vscode, extensionPath = the extension root,
nonce fixed) before and after the change, sha256 of its output:
xr 12,340 chars f351f1d6919da284 -> f351f1d6919da284
dom 3,682 chars 814d8de268a34f4a -> 814d8de268a34f4a
none 0 chars e3b0c44298fc1c14 -> e3b0c44298fc1c14
templateHTMLProcessor.ts changes only log arguments, not the HTML it builds.
Counts: prefer-template 8 -> 0. The A.1 script's "string concatenation"
row goes 23 -> 18: the 18 left are literal + literal line wraps of long
messages (activeAnalysesCommands.ts, remoteAccessManager.ts,
collaborationItems.ts, ...), which prefer-template does not flag and which
are clearer as they are.
Lock-in: prefer-template is an error over src/; lintContract.test.cjs
asserts it.
Text pins (basename grep in test/ and scripts/):
- createStructure.ts: xrDataSource.test.cjs:27 matches the XR_BOATS_TREE_FIELDS
ternary and the babia-treebuilder attribute - G, untouched.
- templateHTMLProcessor.ts: livePanelDomIntegration.test.cjs:118/137 matches
HTML_CONTENT_JSON - G, untouched.
- executePython.ts: reanalysisArchitecture.test.cjs:51-52 (silent option),
analysisPaths.test.cjs:14 (resolveBackendScriptPath),
directoryAnalysisStartup.test.cjs:22 ('--files' absence, coordinator
comment), livePanelDomIntegration.test.cjs:150-151 (parsePythonOutput
signature, JSON.parse) and featureSurface.cjs:151 (Python entry points) -
S/G, none on line 78.
- venvManager.ts, networkUtils.ts: loaded from out/ only; no test matches
the changed messages ("could not upgrade pip", "For VR/Mobile").
- jsonFieldAnalyzer.ts: no hits.
H2: dist/extension.js e927daf5a3fd -> 3838d8e16de4 (+13 B); the changed
statements are exactly the 8 sites.
Gates: npm run lint, npm test 1055/1055.
Refs #56
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_014FkKt8WKa6XiX4gKgDL8Hu
…analyses
modernization.md §5 row 8, first folder (the biggest offender: 18 of 130).
Types only.
activeAnalysesDataService.ts (11 -> 0):
- ActiveAnalysisItem.session: any -> UnifiedAnalysisSession (what
getAllSessions() returns and createAnalysisItem stores).
- createAnalysisItem(session: any, ...) -> UnifiedAnalysisSession.
- getAnalysisById(): any | null -> UnifiedAnalysisSession | undefined | null
(getSession() returns undefined for a miss; the catch returns null).
- getSubsectionItem(): any -> CodeAnalysisTreeItem, the type its only caller
(AnalysisSectionProvider.getChildren) puts it in; the literal is
structurally one (import type, no runtime import).
- 7 x `(item as any).<field> =` -> `(item as ActiveAnalysisTreeItem).<field> =`,
a local type: vscode.TreeItem plus the ActiveAnalysisItem fields copied
onto it for context-menu commands.
activeAnalysesCommands.ts (7 -> 0):
- the six `arg?: ActiveAnalysisItem | string | any` parameters (showActions,
showDetails, closeAnalysis, viewInBrowser, exportFolder, extractSessionId)
and resolveSelectedSession's `arg: unknown` take ActiveAnalysisCommandArg:
a string id, or an object carrying session.id / sessionId / id, directly
or under originalAnalysisItem - exactly the shapes extractSessionId
probes. ActiveAnalysisItem fits it structurally, so its now-unused import
name is dropped from the import line.
- generateDetailsContent(session: any) -> UnifiedAnalysisSession.
Lock-in: a named flat-config block "codexr/any-free-folders" makes
@typescript-eslint/no-explicit-any an error for this folder.
lintContract.test.cjs: the warn-budget check skips that one named block (it
can only tighten the rule), and a new test pins the block to that single
rule at "error" over existing src/ folder globs.
Text pins (basename grep in test/ and scripts/):
- activeAnalysesActions.test.cjs:35-229 reads both files and matches command
ids, "Left-click to show available actions", the export pipeline calls
(beginExportPackageTransaction, pruneExportPackage, ...), user-facing
strings ("Close analysis for", "Serve it with any static HTTP server") -
G, none on a changed line (the `ActiveAnalysisItem` import name is not
matched anywhere in test/).
- reanalysisArchitecture.test.cjs:70-121 checks the file has no legacy
marker (doesNotMatch) - G, untouched.
- activeAnalysesCommands.test.cjs, activeAnalysesPresentation.test.cjs load
out/ (behavioural).
Measurements: any.total 130 -> 112 (code_analysis 53 -> 35); ESLint
warnings 204 -> 186, so the lint budget (--max-warnings,
eslint.maxWarnings) goes 204 -> 186 via guardrails:update.
Characterization: dist-identical 3838d8e16de4
Gates: npm run typecheck, npm run lint, npm test 1056/1056.
Refs #56
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_014FkKt8WKa6XiX4gKgDL8Hu
modernization.md §5 row 8. Types only; the folder's 8 `any`s were all in serverWatcherIntegration.ts: - onRegistryChange((event: any) => ...) -> RegistryEvent (the listener type RegistryChangeEvent already declares). - handleServerRemoved(serverId, server: any) -> ActiveServer (RegistryEvent.server). - getAllSessions().filter((session: any) => ...) -> UnifiedAnalysisSession. - getAllServers().find((server: any) => ...) x3 -> ActiveServer. - findAndStopServerForSession(sessionId, session: any) -> UnifiedAnalysisSession (its caller passes a registry session). - the metadata.sessionId lookup: ActiveServer.metadata does not declare sessionId (the registry stores metadata as given; serverControl.ts reads the same field through `as any`), so a local SessionTaggedServer type adds it as optional for that one predicate instead of widening the model. Both new imports are `import type` (no runtime edge; the active_servers<->code_analysis folder edge already exists). Lock-in: src/code_analysis/services/**/*.ts joins the "codexr/any-free-folders" block (no-explicit-any: error). Text pins: reanalysisArchitecture.test.cjs:16 reads the file and matches stopWatchingSession(sessionId) - G, untouched. guardrail-baseline.json lists it in any.topFiles (removed by guardrails:update). folderDependencies.json mentions the session-closing edge in prose. Measurements: any.total 112 -> 104 (code_analysis 35 -> 27); ESLint warnings and budget 186 -> 178. Characterization: dist-identical 3838d8e16de4 Gates: npm run typecheck, npm run lint, npm test 1056/1056. Refs #56 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_014FkKt8WKa6XiX4gKgDL8Hu
modernization.md §5 row 8. Types only; the folder's 9 `any`s were all in
directoryReAnalyzer.ts, and directoryReanalysisData.ts already declares the
data.json shapes they stood for:
- IncrementalChangeSet.updatedResults, reAnalyzeFiles()'s result, the
reanalysisResults / resultsToUpsert locals and applyUpdatedResults'
parameter: any[] -> AnalysisFileEntry[] (the entries upsertXRFiles and
upsertLivePanelFiles take).
- the three `currentData: any` parameters -> a local
`AnalysisData = XRAnalysisData | LivePanelAnalysisData`. The helper calls
sit in `xrFormat ? xrHelper(...) : livePanelHelper(...)` ternaries that
TypeScript cannot narrow through a boolean, so each argument carries an
`as XRAnalysisData` / `as LivePanelAnalysisData` matching its branch (8
casts, erased at emit; publishChanges already did the same).
- writeJsonAtomically(filePath, data: any) -> data: unknown (it only
JSON.stringify's it).
AnalysisFileEntry joins the existing import from ./directoryReanalysisData.
The lazy require of SSEManager (a cycle breaker, modernization.md §4) stays.
Lock-in: src/code_analysis/engine/watchers/**/*.ts joins the
"codexr/any-free-folders" block.
Text pins: reanalysisArchitecture.test.cjs:31,56-61 reads the file and
matches `options: { notifyClients?: boolean } = {}`,
`if (options.notifyClients !== false) {`,
`fs.promises.readFile(dataJsonPath, 'utf8')`,
`writeJsonAtomically(dataJsonPath, currentData)`,
`executeFileReanalysis(filesToAnalyze)` and the absence of sync fs - S/G,
all still match (none of those lines changed). lintContract.test.cjs pins the
file in the no-require-imports exemption (unchanged).
directoryReAnalyzer.test.cjs loads out/ (behavioural).
Measurements: any.total 104 -> 95 (code_analysis 27 -> 18); ESLint
warnings and budget 178 -> 169.
Characterization: dist-identical 3838d8e16de4
Gates: npm run typecheck, npm run lint, npm test 1056/1056.
Refs #56
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_014FkKt8WKa6XiX4gKgDL8Hu
…rar) modernization.md §5 row 8. Types only; 9 of the folder's 11 `any`s. The model gains two declarations for what was `any`: - ActiveServerRuntime: the server runtime behind a registration, declared structurally with what the extension calls on it (stop, forceStop, createAuthenticatedBrowserUrl). HttpServer and both HTTPS servers match it (the only producer, multiServerLauncher, passes a ServerInstance). It is structural on purpose: importing ServerInstance from servers/runtime made the model, registry and registrar lose their vscode-free status (dependencyDirection.test.cjs floor 109 -> 105, red), so the model keeps no import at all. - ActiveServerMetadata: the fields read (host, staticRoot, description, sessionId) plus an `unknown` index signature for what the launcher records (serverType, originalPort, portChanged, launcherId, ...). ActiveServer.metadata used to declare only the first three while the registry stored anything. Then: - ActiveServer.serverInstance, registerServer()/registerActiveServer() config.serverInstance, ServerRegistrationConfig.serverInstance: any -> ActiveServerRuntime (4). - the same three configs' metadata: any -> ActiveServerMetadata (3). - serverControl.ts stopInstanceOrForce(serverId, instance: any) -> ActiveServerRuntime; allSessions.forEach((session: any, ...)) -> UnifiedAnalysisSession (import type) (2). - code_analysis/services/serverWatcherIntegration.ts: its local SessionTaggedServer type (added two commits ago because the model lacked sessionId) is now redundant and removed; the predicate takes ActiveServer. Left for the next commit: serverControl.ts's two `(server.metadata as any).sessionId` casts. Typed, `server.metadata && server.metadata.sessionId` is reported by prefer-optional-chain, and `?.` changes the bundle, so it cannot ride in a dist-identical commit. Text pins: no test reads these files as text (activeServerRegistry.test.cjs loads out/); folderDependencies.json mentions serverControl.ts in prose. dependencyDirection.test.cjs (vscode-free floor, folder edges) stays green. Measurements: any.total 95 -> 86 (active_servers 11 -> 2); ESLint warnings and budget 169 -> 160. Characterization: dist-identical 3838d8e16de4 Gates: npm run typecheck, npm run lint, npm test 1056/1056. Refs #56 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_014FkKt8WKa6XiX4gKgDL8Hu
…active_servers
modernization.md §5 rows 8 and 6. The last two `any`s of active_servers:
serverControl.ts read the session id through `(server.metadata as any).sessionId`.
ActiveServerMetadata (previous commit) declares sessionId, so:
if (server.metadata && (server.metadata as any).sessionId) {
const sessionId = (server.metadata as any).sessionId;
->
if (server.metadata?.sessionId) {
const sessionId = server.metadata.sessionId;
Once typed, prefer-optional-chain (an error since row 6) reports the
`a && a.b` form, so the guard becomes `?.`. metadata is
ActiveServerMetadata | undefined (an object or nothing), so in this boolean
`if` the two forms take the same branch for every value.
H2: dist/extension.js 3838d8e16de4 -> 8a0d706c9537 (-11 B); the only
changed statement is that guard
(`t.metadata&&t.metadata.sessionId` -> `t.metadata?.sessionId`).
Lock-in: src/active_servers/**/*.ts joins the "codexr/any-free-folders"
block (no-explicit-any: error).
Text pins: none on serverControl.ts (folderDependencies.json prose only).
Measurements: any.total 86 -> 84 (active_servers 2 -> 0); complexity.over15
9 -> 8 (ServerControl's session lookup CCN 16 -> 15); ESLint warnings and
budget 160 -> 158.
Gates: npm run typecheck, npm run lint, npm test 1056/1056.
Refs #56
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_014FkKt8WKa6XiX4gKgDL8Hu
modernization.md §5 row 9.
Report mode first: @typescript-eslint/prefer-nullish-coalescing with
ignorePrimitives { string, number, boolean, bigint: true } reports 76 sites
in src/. 16 of them are `if (!x) { x = ... }` singleton/lazy-init blocks and
one is a `json === undefined ? String(metadata) : json` ternary (whose `??`
form would also swallow null); those shapes stay as they are
(ignoreIfStatements, ignoreTernaryTests). That leaves 60 `a || b` with an
object-typed (object | array | function | Map value) left operand.
Converted: 48 of the 60, in 30 files. The proof per line is the type plus
the producer: for an object/array/function operand, `||` and `??` differ only
when the operand is a falsy non-nullish primitive (0, '', false, NaN), so a
conversion is behaviour-neutral when the value can only come from this code:
- Map.get / Array.find over values the code itself stored (createChart x2,
gitRevisionExportCore x2, gitAnalysisEligibility x2, remoteSessionAuthority x3,
screenBroadcastSignalingServer, roomRegistry, roomSharedState x5,
sseClientRegistry, fileToServerMap, languageMetadata);
- results of the code's own calls typed object | undefined
(fileWatcherOrchestrator getStatus(), analysisFeatureHost getAvailability(),
httpServer getConnectedParticipants() and onDidChange(), httpsServerBase
describeStartError(), ActiveServersSectionProvider, collaborationRoomServer
resolveSession(), collaborationSessionApi getConfiguration(),
collaborationCommands RemoteAccessManager.getInstance(),
projectEvolutionService existingReferences);
- optional parameters and fields set by internal callers (analysisCommands
refreshCallback, dependencyGraphService request, gitRevisionExportCore
options.request, gitAnalysisSessionContext sourceCatalog, autoAnalysisDelay
x2, analysisFeatureHost x2, visualizeDataItems state, launcherLivePanel
session.filesToHash, exportPackageTransaction manifest sources,
remoteAccessManager server.remoteAccess, serverDetailsFormat
server.metadata, collaborationRoomServer existingParticipant and
peer.session.profile, collaborationSessionApi session.profile, and the
three `item.command.arguments || []` in the view click handlers).
Not converted (12), each file exempted by a per-file override (rule off):
- parsed JSON from a WebSocket client or the analysis bridge, where a
malformed 0/''/false must still fall back to `{}`:
dependencyGraphBridge.ts:186, projectEvolutionBridge.ts:99,149,
collaborationRoomServer.ts:228,231,237,240, roomSharedState.ts:84;
- workspace storage / settings updates: visualizeDataState.ts:394,
sharedDimensionMappingSettingCore.ts:182 (adapter.getMappings from
storage), serverSettingsManager.ts:279;
- an S pin: projectEvolutionService.ts:421, where
historicalComparison.test.cjs:467 matches
/source\.kind === 'workingCopy'\) \|\| null/ verbatim. Relaxing it needs
its own characterization commit; left for 1.3.0.
Lock-in: @typescript-eslint/prefer-nullish-coalescing is an error over src/
with ignorePrimitives (all), ignoreTernaryTests and ignoreIfStatements, plus
the 8-file exemption block; lintContract.test.cjs asserts the rule.
Text pins: every converted file was grepped by basename in test/ (16 files
read as text by remoteAccessImplementation, virtualScreenRuntime,
historicalComparison, livePanelHistorical, dependencyGraph,
reanalysisArchitecture, analysisServerCapabilities, xrDataSource, ...); every
`\|\|` / `\?\?` regex in those suites was checked against the changed lines:
only historicalComparison.test.cjs:467 matched (above, kept).
virtualScreenRuntime.test.cjs:414 is an absence check on
`room.entities.get(key) || { entityKind, entityId }` (G, still absent).
H2: dist/extension.js 8a0d706c9537 -> 983cfe36a26d (+22 B); 43 changed
statements carrying the 48 new `??` and nothing else.
Gates: npm run typecheck, npm run lint (158 warnings, budget unchanged),
npm test 1056/1056, npm run test:analysis (export code touched) green.
Refs #56
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_014FkKt8WKa6XiX4gKgDL8Hu
docs/cleanup/modernization.md gains §7 "Progress (TypeScript)": before and after per plan row (1, 4-10), the lock-in rule of each, the ESLint budget (204 -> 158) and any.total (130 -> 84) movement, and the remaining `any` offenders for the next pass. It also records that the "left to #35" notes of §1/§4/§5 no longer apply now that #35 has merged. .claude/docs/v1.2.1/sessions/56b-modernize-ts.md: commits, measurements, proofs (H1/H2, byte-identical SSE script output), gates, what was left and why (row 10: no `.then()` qualifies; one S-pinned `|| null`; 11 `||` on external JSON/storage/settings), design notes, quirks and F5 checks. No CHANGELOG line: nothing user-visible. Gates: npm test 1056/1056. Refs #56 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_014FkKt8WKa6XiX4gKgDL8Hu
4 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Requested by Adrián · project thread
Part B of story #56: the TypeScript rows of
docs/cleanup/modernization.md§5 (1, 4–10), one idiom × one area per commit. Each idiom gets its lint rule as an error in the same commit, with per-file overrides instead ofeslint-disable.no-var,prefer-rest-params,no-namespace,no-unsafe-function-type).no-require-imports, with the tree provider's 8 lazy requires and the 2 cycle breakers exempt.slice()instead ofsubstr();prefer-includesandsubstrlocked.anys in four folders, types only, with an identical production bundle:any.total130 → 84. Those folders now haveno-explicit-anyas an error.??for object-typed defaults produced by our own code (48; the rule ignores every primitive type, so''/0/falsecannot be involved). The||on WebSocket/bridge JSON, storage and settings is kept, and so is one test-pinned line.awaitinstead of.then()): no site qualifies; recorded.ESLint warning budget 204 → 158. No user-visible change, no CHANGELOG line. Measurements, proofs and F5 checks are in
docs/cleanup/modernization.md§7 and.claude/docs/v1.2.1/sessions/56b-modernize-ts.md.Gates: typecheck, lint,
npm test1056/1056 after every commit;test:analysisafter the executePython/export commits.Refs #56
Generated by Claude Code