Skip to content

fix(lint): clear ESLint errors blocking CI#6

Merged
khokonm merged 1 commit into
mainfrom
fix/ci-lint-errors
Jun 24, 2026
Merged

fix(lint): clear ESLint errors blocking CI#6
khokonm merged 1 commit into
mainfrom
fix/ci-lint-errors

Conversation

@khokonm

@khokonm khokonm commented Jun 24, 2026

Copy link
Copy Markdown
Contributor

Summary

Fixes the lint failures the new CI surfaced. These were latent issues that nothing checked before CI existed (plus one from the new server-linting scope).

Fixes

  1. jsx-a11y/no-autofocus — "Definition for rule not found" (fatal). SettingsPanel.tsx had an eslint-disable-next-line jsx-a11y/no-autofocus directive, but the jsx-a11y plugin isn't configured, so ESLint errored on the unknown rule. Removed the dead directive — no active rule flags autoFocus.
  2. react-hooks/rules-of-hooks on useGalleryItem (error). It's an action callback, not a hook, but the use prefix made the rule think it was — and it's invoked inside an onUse callback. Renamed to attachGalleryItem (useNotes.ts definition + return, App.tsx destructure + call).
  3. react-refresh/only-export-components on MediaThumb.tsx. The file exported both the useMediaUrl hook and the MediaThumb component. Extracted the hook to src/hooks/useMediaUrl.ts; MediaThumb.tsx now exports only the component. Updated imports in MediaThumb.tsx and App.tsx.
  4. @typescript-eslint/no-unused-vars in server/src/index.ts. Removed the unused getPendingTransfers import (still exported by db.ts as module API).

Verification

  • npm test → 14/14 passing
  • node --check passes on all changed .ts files
  • Repo-wide scan: no other unknown-rule disable directives, no other unused server imports, no other misleading use-prefixed callbacks
  • npm run lint / npm run build (blocked in sandbox — npm registry 403; will be confirmed by CI on this PR)

Note (separate, no code change needed)

The Node-20 deprecation warning is from the action versions. Bump them in .github/workflows/ci.yml (the automation token can't push workflow files): actions/checkout@v4@v5 and actions/setup-node@v4@v5.

The CI lint job (eslint .) surfaced pre-existing issues plus one from the
new server linting scope:

- SettingsPanel.tsx: remove a stale `eslint-disable jsx-a11y/no-autofocus`
  directive — the jsx-a11y plugin isn't configured, so the unknown rule made
  eslint fail with "Definition for rule ... was not found". No active rule
  flags autoFocus, so the directive was dead.
- useNotes.ts / App.tsx: rename `useGalleryItem` -> `attachGalleryItem`. It's
  an action callback, not a hook; the `use` prefix tripped
  react-hooks/rules-of-hooks ("cannot be called inside a callback").
- MediaThumb.tsx: extract `useMediaUrl` into src/hooks/useMediaUrl.ts so the
  component file only exports a component (react-refresh/only-export-components).
  Updated imports in MediaThumb.tsx and App.tsx.
- server/src/index.ts: drop the unused `getPendingTransfers` import
  (@typescript-eslint/no-unused-vars).

Unit tests still pass (14/14).
@khokonm khokonm merged commit 7abb571 into main Jun 24, 2026
2 of 3 checks passed
@khokonm khokonm deleted the fix/ci-lint-errors branch June 24, 2026 18:46
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