A React hook is called in a function that is neither a component nor a hook
What it finds
Hooks keep their state in the component being rendered, so React only allows calling them from components and from other hooks. Called from a plain function or a class method, they throw or attach state to whichever component happens to call that function.
Reported are calls of the hooks of React, such as useState and useEffect, whose innermost enclosing function is a function declaration with a name that starts with neither a capital letter nor use, or a class method not named like a hook, in files that import React.
From the rule's source, hook_in_plain_function.rs.
Turn it on, off or suppress it
The rule runs from the recommended tier up. To turn it on in a lower tier, give it a level in tx0.toml:
[rules]
"tx0/ts:hook-in-plain-function" = "warning"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:hook-in-plain-function] reason="..."tx0 explain tx0/ts:hook-in-plain-function shows the same in the terminal. Found a false positive? Report it.