Open
Description
Name for new rule
no-sync-act
Description of the new rule
As per https://react.dev/reference/react/act#await-act-async-actfn
sync usage of act
is discouraged:
We recommend using
act
withawait
and anasync
function. Although the sync version works in many cases, it doesn’t work in all cases and due to the way React schedules updates internally, it’s difficult to predict when you can use the sync version.We will deprecate and remove the sync version in the future.
Testing Library feature
act
Testing Library framework(s)
React
What category of rule is this?
Warns about a potential error
Optional: other category of rule
No response
Code examples
The new rule would fail on
act(() => {
await act(() => {
act(async () => {
and pass on
await act(async () => {
Anything else?
No response
Do you want to submit a pull request to make the new rule?
No