Skip to content

Migrate web to eslint-plugin-react-hooks 7.1 rules #245

Open

Description

@JonahMMay

eslint-plugin-react-hooks 7.0.1 -> 7.1.1 (Renovate PR #243) makes pnpm lint in web/ fail with 133 new errors across ~50 files, not covered by web/eslint-suppressions.json. #243 now holds the plugin at ~7.0.1 and Renovate is capped at <7.1.0 until this is resolved.

Breakdown

Rule Errors
react-hooks/set-state-in-effect 70
react-hooks/refs 59
react-hooks/preserve-manual-memoization 4

Plus 3 unused eslint-disable warnings (SearchBar.tsx:91, :127, vendor/foliate-js/epub.js:644).

Largest files: player/components/VideoPlayer.tsx (28 refs + 14 set-state-in-effect), pages/audiobooks/player/useAudiobookPlayback.ts (6), hooks/useSettingsForm.ts (6), pages/admin-settings/RequestServers.tsx (6), player/hooks/useASSSubtitles.ts (5), hooks/useCarouselEmbla.ts (4), pages/settings/WebhookSyncSettings.tsx (4), player/hooks/usePlaybackSession.ts (4); the rest are 1-3 each across ~40 files.

Options

  1. Hold the plugin at 7.0.x (current state), migrate later.
  2. Refresh the baseline (eslint . --prune-suppressions / --suppress-all) and bump; fast and precedent exists, but defers the real fixes.
  3. Fix all sites properly (derive state in render, keys, event handlers, useSyncExternalStore, ref writes moved into effects/handlers), split by file group, with manual player QA.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions