fix(lint): clear ESLint errors blocking CI#6
Merged
Merged
Conversation
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).
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
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
jsx-a11y/no-autofocus— "Definition for rule not found" (fatal).SettingsPanel.tsxhad aneslint-disable-next-line jsx-a11y/no-autofocusdirective, but the jsx-a11y plugin isn't configured, so ESLint errored on the unknown rule. Removed the dead directive — no active rule flagsautoFocus.react-hooks/rules-of-hooksonuseGalleryItem(error). It's an action callback, not a hook, but theuseprefix made the rule think it was — and it's invoked inside anonUsecallback. Renamed toattachGalleryItem(useNotes.tsdefinition + return,App.tsxdestructure + call).react-refresh/only-export-componentsonMediaThumb.tsx. The file exported both theuseMediaUrlhook and theMediaThumbcomponent. Extracted the hook tosrc/hooks/useMediaUrl.ts;MediaThumb.tsxnow exports only the component. Updated imports inMediaThumb.tsxandApp.tsx.@typescript-eslint/no-unused-varsinserver/src/index.ts. Removed the unusedgetPendingTransfersimport (still exported bydb.tsas module API).Verification
npm test→ 14/14 passingnode --checkpasses on all changed.tsfilesuse-prefixed callbacksnpm 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→@v5andactions/setup-node@v4→@v5.