chore(lint): clear all ESLint warnings across components + TS files#51
Merged
Conversation
Was 19 warnings, now 0. No behaviour change in any file — pure code
restructuring + two well-justified eslint-disable comments for drag/
resize handles.
## no-nested-ternary (12 hits)
Extracted to named helper functions or rewritten as if/else chains:
- `Composer.jsx` — `renderActionButton(isRunning, hasText, handleCancel)`
reads as a state machine instead of a ternary stack inside JSX
- `Messages.jsx` — `BlockChip` label resolution is now linear:
liveName → cachedLabel → "block"
- `ToolCallFallback.jsx` — `DIFF_ROW_CLASS` + `DIFF_ROW_PREFIX` lookup
tables with `diffRowClass()` / `diffRowPrefix()` accessors
- `conversations-dataview.jsx` — sort comparator now uses
if/else returns
- `mcp-servers-dataview.jsx` — three sites:
• `renderListBody(loading, servers, fields, view)` for the
loading/empty/dataview tri-state
• `originLabel(origin)` map for `OriginBadge`
• `saveLabel(saving, isEdit)` for the modal's primary button
## no-unused-vars-before-return (4 hits)
Moved `const` declarations down past their potential early-return:
- `MicButton.jsx` — `ttsAvail` was assigned at the top but the component
returns null when speech recognition is unsupported; moved to where
it's actually used (the popover-visibility computation)
- `SidePanels.jsx` — `diffHr` declared before the `diffMin < 60`
early-return; moved after
- `mcp-servers-dataview.jsx` — `msg` declared before the
`status === "success"` early-return path; moved into the
`status === "error"` branch
- `editor-bridge.ts` — `limit` in `queryDom()` was computed before
the `querySelectorAll` try-catch that may early-return; now computed
lazily on first use inside the loop
## jsx-a11y/no-static-element-interactions (2 hits)
Drag and resize handles on `<div>` elements with `onMouseDown`. Adding
real keyboard equivalents is meaningful UX work (panel positioning
needs arrow-key movement with discrete steps, focus management, etc.)
not a one-line change. Documented as `eslint-disable-next-line` with
the rationale that the panel HAS keyboard-reachable equivalents
elsewhere (size/position controls in the header actions). `.eslintrc.js`
already calls these out as "real concerns, but separate work".
## no-alert (1 hit)
`mcp-servers-dataview.jsx`'s `remove()` confirmation. The original
disable comment was on the wrong line (covered `if (` instead of
`window.confirm`). Extracted the message into a `const`, then placed
the disable comment directly above the line that actually triggers
the rule. The .eslintrc.js still flags `no-alert` as a warning, so
custom-dialog UI for this remains a future pass.
## Verification
- `npm run typecheck` — clean
- `npm run build` — succeeds
- `npm run test:unit` — 17/17 pass
- `npm run lint:js` — 0 warnings, 0 errors
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
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.
Was 19 warnings, now 0. No behaviour change in any file — pure code restructuring + two well-justified
eslint-disablecomments for drag/resize handles.no-nested-ternary (12 hits)
Extracted to named helper functions or rewritten as if/else chains:
Composer.jsxrenderActionButton(isRunning, hasText, handleCancel)reads as a state machine instead of a ternary stackMessages.jsxBlockChiplabel resolution is now linear: liveName → cachedLabel → "block"ToolCallFallback.jsxDIFF_ROW_CLASS+DIFF_ROW_PREFIXlookup tables withdiffRowClass()/diffRowPrefix()accessorsconversations-dataview.jsxmcp-servers-dataview.jsxrenderListBody,originLabel,saveLabelhelperseditor-bridge.ts+use-runtime-adapter.tsno-unused-vars-before-return (4 hits)
Moved
constdeclarations down past their potential early-return:MicButton.jsx—ttsAvailmoved to where it's actually used (the popover-visibility computation)SidePanels.jsx—diffHrmoved after thediffMin < 60early-returnmcp-servers-dataview.jsx—msgmoved into thestatus === "error"branch where it's readeditor-bridge.ts—limitinqueryDom()computed lazily on first iteration instead of before thequerySelectorAlltry-catchjsx-a11y/no-static-element-interactions (2 hits)
Drag (
Thread.jsxpanel header) and resize (assistant-modal.jsxcorner) handles on<div>withonMouseDown. Adding real keyboard equivalents is meaningful UX work — panel positioning needs arrow-key movement with discrete steps, focus management — not a one-line change. Documented aseslint-disable-next-linewith the rationale that the panel HAS keyboard-reachable equivalents elsewhere (size/position controls in the header actions)..eslintrc.jsalready calls these out as "real concerns, but separate work".no-alert (1 hit)
mcp-servers-dataview.jsx'sremove()confirmation. The original disable comment was on the wrong line (coveredif (instead ofwindow.confirm). Extracted the message into aconstand placed the disable comment directly above the line that triggers the rule. Real custom-dialog UI for this remains a future pass.Verification
npm run typecheck— cleannpm run build— succeedsnpm run test:unit— 17/17 passnpm run lint:js— 0 warnings, 0 errors🤖 Generated with Claude Code