Open
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Remove dead code: unused imports (safeFit, CONTROL_MESSAGE_PREFIX, isHijackMetaChunk, colour), unused state (sessionIdInitialized, secondarySocket value, secondaryConnectionStatus value, secondarySpinnerPrefixReference, secondaryReconnectScheduledThisCycleReference), unused locals (colour object, wasReconnecting, wasConnecting, latestStatus, TERMINAL_PROMPT_IDENTIFIER), and unused variables in terminal-shared.ts (bufferLength, baseY, viewportY, cursorX). Also fixes a lonely-if lint error exposed by the cleanup. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Remove the "off" override and replace two substring() calls with slice() in the control message parsing logic. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Replace all charCodeAt() calls with codePointAt() for proper surrogate pair handling. Fixes potential bugs with emoji/wide characters in TerminalOverlay.tsx and AblyCliTerminal.tsx. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Flip negated if/else conditions to positive-first style in AblyCliTerminal.tsx (handlePtyData, handleWebSocketOpen) and use-terminal-visibility.ts (recompute ternaries). Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Add rules-of-hooks (error) to catch hook ordering bugs, and exhaustive-deps (warn) to flag stale closures in the large AblyCliTerminal component. This is the highest-value lint addition for catching React-specific bugs. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Migrate ~25 console.log calls to debugLog() so they only fire when ABLY_CLI_DEBUG is enabled. console.warn and console.error remain allowed. Update two tests that asserted on console.log to enable debug mode and match the "[AblyCLITerminal DEBUG]" prefix. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Create types.ts with ControlMessage union, AblyCliGlobals interface, TerminalWithConnectingState, and WebSocketMessageData type to replace all ~24 explicit 'any' annotations in source files with proper types. Key changes: - Control message handler now uses discriminated union type - globalThis casts use AblyCliGlobals interface instead of 'any' - Terminal extension properties use TerminalWithConnectingState - messageDataToUint8Array uses WebSocketMessageData type - debounce utility uses unknown[] instead of any[] - terminal-box stub uses unknown instead of any Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…e-* as warn Switch from tsPlugin.configs.recommended to recommended-type-checked for full type-aware linting. Fix errors from additional rules (no-unnecessary-type-assertion, no-misused-promises, no-floating-promises) and remove dead code checking for stream/hijack properties on typed ControlMessage. Enable no-unsafe-* family as warnings. Disable require-await and unbound-method in test config. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Add type assertions for JSON.parse calls (signedConfig parsing, control message parsing) and cast MessageEvent.data to WebSocketMessageData. Remove dead code checking for stream/hijack on typed ControlMessage. Source files now have zero no-unsafe-* warnings. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
All no-unsafe-*, no-explicit-any, no-base-to-string, and no-console rules now enforced as errors in source files. Test files disable these rules since tests legitimately use `any` for mocking. Only react-hooks/exhaustive-deps remains as warn (non-trivial to fix without risking behavior changes). Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
049f9d0 to
2c5f818
Compare
…web-cli Cherry-pick no-deprecated (warn), no-useless-constructor, unified-signatures, return-await, and consistent-type-imports (all error) from the main CLI config. Auto-fix converts 5 value imports to type imports across AblyCliTerminal.tsx and use-terminal-visibility.ts. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- handleCloseSplit: suppress — deps are stable but defined later (hoisting) - handleCloseSecondary: suppress — same hoisting constraint - handlePtyData: remove unused deps (clearInstallInstructionsTimer, updateConnectionStatusAndExpose, updateSessionActive) - handleControlMessage: add activateSessionAndSendCommand and clearPromptDetectionTimeout; remove unused clearPtyBuffer, updateSessionActive - activateSecondarySessionAndSendCommand: suppress hoisting constraint - startConnectingAnimation: move spinnerFrames to module scope - handleWebSocketOpen: remove unused deps (clearAnimationMessages, credentialHash, resumeOnReload, updateConnectionStatusAndExpose) - termCleanupReference: capture .current in local var before cleanup - useEffect (initial connection): add resumeOnReload - startInactivityTimer: add clearInactivityTimer, remove module-scope deps Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- handleClosePrimary: suppress — deps defined later in component (hoisting) - connectWebSocket: use credentialsInitializedRef for debug-only state read; remove unnecessary ref dep (term) - handleWebSocketMessage: use handleControlMessageRef to avoid deep dep chain through sessionId state; remove all stale deps from array - connectSecondaryWebSocket: suppress — already accessed via ref; missing deps include hoisted callbacks and state causing cascading recreations Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Two useEffects intentionally use minimal dep arrays to avoid destroying and recreating xterm Terminal instances on state changes: - Primary terminal init (empty []) — 12 missing deps - Secondary terminal init ([isSplit]) — 4 missing deps Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
All 16 warnings have been resolved — either by fixing deps, using ref patterns, or suppressing with documented rationale. Promote to error to prevent regressions. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
WalkthroughThis PR incrementally hardens ESLint and TypeScript rules for the Changes
Review Notes
|
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.
Summary
Incrementally enables strict TypeScript and code quality ESLint rules for
packages/react-web-cli, closing gaps that allowed dead code, type safety holes, and stale closures to slip through undetected.no-unused-vars— removed 30 unused imports, variables, and state declarationsprefer-string-slice,prefer-code-point,no-negated-condition(fixes surrogate pair bugs, improves readability)eslint-plugin-react-hooks— catches stale closures and hook ordering bugs in the 3,600-line main componentno-console— migrated ~25console.logcalls to gateddebugLog()helperno-explicit-any— createdtypes.tswith proper discriminated unions (ControlMessage,AblyCliGlobals,WebSocketMessageData) replacing ~24anyannotationsrecommended-type-checked— full type-aware linting withno-unsafe-*family,no-misused-promises,no-floating-promisesFinal state: 0 errors, 22 warnings (16
exhaustive-deps+ 6no-disabled-tests— both intentionally left as warnings).🤖 Generated with Claude Code