An effect is given an async function, so it returns a promise where React expects a cleanup function
What it finds
useEffect calls what its callback returns as the cleanup when the component unmounts or the effect runs again. An async callback returns a promise instead, so cleanup never runs and React warns. An async function defined and called inside the effect does the work.
Reported are async arrow functions and function expressions given as the first argument of useEffect, useLayoutEffect or useInsertionEffect.
From the rule's source, async_effect_callback.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:async-effect-callback" = "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:async-effect-callback] reason="..."tx0 explain tx0/ts:async-effect-callback shows the same in the terminal. Found a false positive? Report it.