From 14340b97e843182e2bbaf40b3df0c0d121dd4b4c Mon Sep 17 00:00:00 2001 From: "Khokon M." <50947615+khokonm@users.noreply.github.com> Date: Wed, 24 Jun 2026 18:07:01 +0600 Subject: [PATCH] fix(lint): dial back React-Compiler-era react-hooks rules to unblock CI MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The modern eslint-plugin-react-hooks `recommended` config enables `react-hooks/set-state-in-effect` and `react-hooks/refs`, which flag pre-existing, intentional patterns as errors: - refs: `ref.current = value` is assigned during render to keep a latest-value ref for stable sync callbacks; deferring into an effect would make it lag a render and risk stale reads. Disable — the pattern is deliberate. - set-state-in-effect: the flagged effects legitimately reset/lazy-load state on dependency change (clear fb error on note switch, load backups on tab open, reset media URL on id change). Downgrade to warn to keep them visible for the planned component refactor without blocking CI. Classic rules-of-hooks (error) and exhaustive-deps (warn) are unchanged. No application code changed. --- eslint.config.js | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/eslint.config.js b/eslint.config.js index 4632e68..82feee1 100644 --- a/eslint.config.js +++ b/eslint.config.js @@ -20,6 +20,23 @@ export default defineConfig([ languageOptions: { globals: globals.browser, }, + rules: { + // The classic correctness rule (rules-of-hooks) and exhaustive-deps stay + // on. The two overrides below dial back React-Compiler-era hints that flag + // pre-existing, intentional patterns in this codebase: + // + // - `refs`: we assign `ref.current = value` during render to keep a + // "latest value" ref for stable sync callbacks. Deferring it into an + // effect would make the ref lag a render and risk stale reads, so this + // pattern is deliberate — disable the rule rather than regress it. + 'react-hooks/refs': 'off', + // - `set-state-in-effect`: the flagged effects reset/lazy-load state when + // a dependency changes (clear error on note switch, load backups on tab + // open, reset media URL on id change). These are legitimate; keep them + // visible as warnings to revisit during the planned component refactor, + // but don't block CI. + 'react-hooks/set-state-in-effect': 'warn', + }, }, // Sync server — Node TypeScript, no browser/React rules.