no-unused-use-memo
Reports useMemo calls whose return value is ignored.
Rule details Problem
Section titled “Rule details ”ProblemThis rule reports useMemo(...) when it is used as a standalone statement, including void useMemo(...). If you are
running side effects, use useEffect. If you need memoization, keep and use the returned value.
By default, the rule looks for React imports in the roblox-ts environment. Set environment to "standard" to use
react instead.
Options
Section titled “Options”| Option | Type | Default | What it does |
| ------------- | ------------ | ----------- | ------------- | -------------------------------------------- |
| environment | "roblox-ts" | "standard" | "roblox-ts" | Chooses which React package imports to track |
Examples
Section titled “Examples” Incorrect
import { useMemo } from "react";
useMemo(() => { trackAnalytics();}, [eventName]);
void useMemo(() => buildConfig(eventName), [eventName]); Correct
import { useEffect, useMemo } from "react";
useEffect(() => { trackAnalytics();}, [eventName]);
const config = useMemo(() => buildConfig(eventName), [eventName]);Related rules
Section titled “Related rules” require-named-effect-functions Requires named effect callbacks
no-useless-use-memo Moves static memo values to module scope
use-exhaustive-dependencies Checks hook dependency lists
React Docs: useMemo Official reference for useMemo