Skip to content

await-async-event adds async and await in forEach loop #843

Open
@fa93hws

Description

@fa93hws

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingtriagePending to be triaged by a maintainer

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions