Skip to content

Fix correctness and suspicious lint debt (issue #65)#67

Merged
paulwellnerbou merged 2 commits into
mainfrom
claude/intelligent-shamir-f100a1
May 8, 2026
Merged

Fix correctness and suspicious lint debt (issue #65)#67
paulwellnerbou merged 2 commits into
mainfrom
claude/intelligent-shamir-f100a1

Conversation

@paulwellnerbou
Copy link
Copy Markdown
Owner

Summary

Tackles the highest-priority warning classes from #65: every remaining lint/correctness/* and lint/suspicious/* violation surfaced by the biome 2.x upgrade, except useExhaustiveDependencies (66 cases — sampled them and the auto-fix wants to remove deps like version that are intentional re-fetch triggers, so they need per-useEffect review and a follow-up PR).

Per-rule notes:

  • noNonNullAssertedOptionalChain — replaced originalIndexPath?.[…]! in scoreCandidate with an explicit guard so a missing originalIndexPath no longer produces NaN scores.
  • noGlobalIsFiniteisFiniteNumber.isFinite (no coercion).
  • noImplicitAnyLet — typed the browser local in mermaid-chromium.ts.
  • noUnusedImports — removed Identity and TocNode.
  • noUnusedFunctionParametersdocSource and docFormat were destructured but unused in both InlineCommentsLayer and InlineCommentsList. Dropped the props from the interfaces, destructures, and call sites in DocumentLayout.tsx.
  • noControlCharactersInRegex — the commit-message sanitizer is doing exactly what the rule warns against, on purpose. Kept the regex with a targeted biome-ignore.
  • noDuplicateProperties — the 100vh100dvh pairs are intentional progressive enhancement for older browsers. Targeted biome-ignore per pair.
  • noVoidTypeReturnwalkInline was using return walkChildren(...) for control flow; split into call + bare return.
  • noAssignInExpressions — rewrote for/while (m = re.exec(x)) loops into let m = re.exec(x); while (m !== null) { …; m = re.exec(x); }, and ??= ensure-and-get patterns into separate statements.

After this PR the only remaining lint classes are style/complexity (noNonNullAssertion, noImportantStyles, useOptionalChain, useTemplate, noDescendingSpecificity, useLiteralKeys) plus the useExhaustiveDependencies follow-up.

Test plan

  • bun run typecheck — clean
  • bun run test:ci — 393 pass, 4 skip, 0 fail
  • bunx biome check . — 0 remaining correctness/* or suspicious/* violations (other than useExhaustiveDependencies)

🤖 Generated with Claude Code

paulwellnerbou and others added 2 commits May 8, 2026 07:52
Address every remaining `lint/correctness/*` and `lint/suspicious/*`
violation surfaced by the biome 2.x upgrade, except
`useExhaustiveDependencies` (66 cases that need per-call review).

- noNonNullAssertedOptionalChain: guard against null `originalIndexPath`
  in `scoreCandidate` instead of trusting `?.[...]!` (anchoring.ts)
- noGlobalIsFinite: switch to `Number.isFinite` (grid-tables.ts)
- noImplicitAnyLet: type `browser: Browser` (mermaid-chromium.ts)
- noUnusedImports: drop `Identity` and `TocNode`
- noUnusedFunctionParameters: drop unused `docSource` and `docFormat`
  props from `InlineCommentsLayer` and `InlineCommentsList`
- noControlCharactersInRegex: keep the control-char strip in the
  commit-message sanitizer with a targeted biome-ignore
- noDuplicateProperties: keep `100vh` → `100dvh` progressive-enhancement
  pairs with targeted biome-ignores (app.css)
- noVoidTypeReturn: split `return walkChildren(...)` calls into a call
  plus a bare `return` in `walkInline` (export-docx.ts)
- noAssignInExpressions: rewrite `regex.exec()` while-loops and `??=`
  ensure-and-get patterns into separate statements

Typecheck and `bun test:ci` (393 pass, 4 skip) green.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Fix the 18 `lint/a11y/*` errors that biome 2.x flagged but issue #65
didn't list:

- `noSvgWithoutTitle` — mark the brand-icon `<svg>` `aria-hidden`
  (parent already had it).
- `useButtonType` — add `type="button"` to the toast close + action
  buttons so they don't submit any enclosing form.
- `noAutofocus` — replace the `autoFocus` attribute in the comment-edit
  textarea with a ref-based focus driven by the `editing` state.
- `useAriaPropsSupportedByRole` — drop unused `aria-label` from
  containers without a role (mention/shortcode menus, diff overview).
- `noStaticElementInteractions` / `useKeyWithClickEvents` —
  - lightbox stage: real toggle, so add `role="button"`, `tabIndex`,
    keyboard handler, descriptive `aria-label`.
  - lightbox controls / caption / drop-zone wrapper: stop-propagation
    or drag-only, no real click interaction; targeted suppressions.
- `useSemanticElements` —
  - `MarkdownToolbar` is genuinely a toolbar: add `role="toolbar"`.
  - `ResizeHandle` (`role="separator"`) and the file-drop button-styled
    div can't be replaced with `<hr>`/`<button>` without losing
    interactivity; targeted suppressions.
  - Reaction groups (`role="group"`) — `<fieldset>` is form-only;
    targeted suppression.

Also drop the dead `noDuplicateProperties` suppression on the lightbox
`max-height` pair (biome doesn't flag it; it was added speculatively).

Reduces biome errors from 85 → 67 (the remaining 67 are all
`useExhaustiveDependencies` and need per-`useEffect` review).

Typecheck clean; `bun run test:ci` 393 pass / 4 skip / 0 fail.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@paulwellnerbou paulwellnerbou deleted the claude/intelligent-shamir-f100a1 branch May 8, 2026 06:12
@paulwellnerbou paulwellnerbou restored the claude/intelligent-shamir-f100a1 branch May 8, 2026 06:12
@paulwellnerbou paulwellnerbou reopened this May 8, 2026
@paulwellnerbou paulwellnerbou merged commit af96e93 into main May 8, 2026
2 checks passed
@paulwellnerbou paulwellnerbou deleted the claude/intelligent-shamir-f100a1 branch May 8, 2026 06:14
paulwellnerbou added a commit that referenced this pull request May 8, 2026
Closes #68. Resolves the 66 useExhaustiveDependencies error-class
cases the issue called out (#67 already cleared the other rule
classes), and adds typecheck + lint as CI gates so they can't pile
up again.

Approach in DocumentLayout (the bulk of the cases):

- `resolveIdentity` is now a `useCallback([displayName,
  effectiveDisplayName])` so downstream callbacks list it as a single
  dep instead of mirroring the two display-name fields.
- `refreshDoc` / `refreshThreads` hoisted above the useEffects /
  useCallbacks that need them as deps (the dep array is evaluated at
  render time — TDZ otherwise).
- 12 callback dep arrays updated to reference `resolveIdentity` and
  `refreshThreads`/`refreshDoc` directly. The corresponding
  eslint-disables are removed.

`biome-ignore` (with reason) is reserved for genuine intentional
re-trigger effects: mount-time deep link, doc-swap resets, layout
remeasure, headings scroll, content-swap re-attach, events
subscription. Each ignore explains *why* the dep is there or omitted.

Other files: same pattern — callback deps updated where straight-
forward, biome-ignore for re-trigger / mount-once / static-fn cases.
`InlineCommentsLayer` hoists `resolveAnchorElement` to module scope
so it's stable as a dep.

CI now runs `bun run typecheck` and `bun run lint` before tests, so
any future PR introducing a biome error fails the build. Lint
warnings stay non-blocking.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant