Background
Per use-memo.spec.diff.md, React Compiler's ValidateUseMemo.ts provides a validateNoVoidUseMemo toggle that enables Rule 4 (must return a value) and Rule 5 (result must be used) only when turned on.
The current ESLint rule enforces both unconditionally.
Current behavior
// Always reported, even when the developer intentionally doesn't need the return value
useMemo(() => {
doSideEffect();
}, []); // ❌ resultMustBeUsed
Expected behavior
Add a validateNoVoidUseMemo option to the rule schema (default true for backward compatibility, or false to match the SPEC default) so users can opt out of Rule 4 and Rule 5.
References
- Diff report:
plugins/eslint-plugin-react-x/src/rules/use-memo/use-memo.spec.diff.md (§2.4 / §2.5 / §4)
- SPEC:
ValidateUseMemo.ts
Priority
P1 — medium implementation cost, aligns SPEC configurability.
Background
Per
use-memo.spec.diff.md, React Compiler'sValidateUseMemo.tsprovides avalidateNoVoidUseMemotoggle that enables Rule 4 (must return a value) and Rule 5 (result must be used) only when turned on.The current ESLint rule enforces both unconditionally.
Current behavior
Expected behavior
Add a
validateNoVoidUseMemooption to the rule schema (defaulttruefor backward compatibility, orfalseto match the SPEC default) so users can opt out of Rule 4 and Rule 5.References
plugins/eslint-plugin-react-x/src/rules/use-memo/use-memo.spec.diff.md(§2.4 / §2.5 / §4)ValidateUseMemo.tsPriority
P1 — medium implementation cost, aligns SPEC configurability.