await-async-event adds async and await in forEach loop
Have you read the Troubleshooting section?
Yes
Plugin version
v6.1.2
ESLint version
v8.45.0
Node.js version
20.8.1
package manager and version
yarn 1.22.19
Operating system
macos 13.6.1
Bug description
async and await doesn't work for forEach loop. I think we should give up autofixing this issue.
Steps to reproduce
foo.forEach(() => {
userEvent.click();
});
After autofix, it becomes
foo.forEach(async () => {
await userEvent.click();
});
Error output/screenshots
No response
ESLint configuration
{ ... "testing-library/await-async-event": "error", }
Rule(s) affected
await-async-event
Anything else?
No response
Do you want to submit a pull request to fix this bug?
Yes
Hi @fa93hws, thanks for reporting! I believe this is still relevant.
~~I could not reproduce this issue. When I run the following code, the autofix does not add async/await to the forEach callback:~~
const foo = [];
foo.forEach(() => {
userEvent.click();
});
Sorry, my mistake 😂 The error is already being detected as-is.
Plugin version: v7.5.2
I could not reproduce this issue. When I run the following code, the autofix does not add async/await to the forEach callback:
const foo = []; foo.forEach(() => { userEvent.click(); });Plugin version: v7.5.2
Let's add a test for this scenario to verify is not a problem anymore, so we can close this issue.
:tada: This issue has been resolved in version 7.9.2 :tada:
The release is available on:
Your semantic-release bot :package::rocket: