useMemo or useCallback is called without a dependency list, so it recomputes on every render
What it finds
useMemo and useCallback keep their value between renders only as long as the dependencies listed in their second argument stay the same. Without the list, they compute a new value on every render and memoize nothing.
Reported are calls of useMemo and useCallback with a single argument.
From the rule's source, memo_without_dependencies.rs.
Turn it on, off or suppress it
The rule runs in every tier. To turn it off for a project, set its level in tx0.toml:
[rules]
"tx0/ts:memo-without-dependencies" = "off"To keep one finding, suppress it with a reason. tx0 suppress ID --reason "..." writes the comment on the line before the code:
// tx0: ignore[tx0/ts:memo-without-dependencies] reason="..."tx0 explain tx0/ts:memo-without-dependencies shows the same in the terminal. Found a false positive? Report it.