Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

False positive for testing-library/no-await-sync-events #403

Closed
nickmccurdy opened this issue Jul 5, 2021 · 2 comments · Fixed by #641
Closed

False positive for testing-library/no-await-sync-events #403

nickmccurdy opened this issue Jul 5, 2021 · 2 comments · Fixed by #641
Labels
bug Something isn't working released

Comments

@nickmccurdy
Copy link
Member

Using await with userEvent.type's delay option is correct, but is incorrectly flagged as a lint error.

async () => {
  const delay = 10
  // error  `userEvent.type` is sync and does not need `await` operator  testing-library/no-await-sync-events
  await userEvent.type(element, text, {delay})
}
@MichaelDeBoey MichaelDeBoey added the bug Something isn't working label Jul 5, 2021
@nickmccurdy
Copy link
Member Author

nickmccurdy commented Jul 11, 2021

Crossposting relevant discussion from testing-library/user-event#693:

@ph-fritsche Is the plugin not picking up the overload anymore ? 😞
@ph-fritsche This might be just another reason for us to always return a Promise on userEvent.type in the next major.
@nickmccurdy It seems like it.

sjarva added a commit to sjarva/eslint-plugin-testing-library that referenced this issue Sep 7, 2022
Check if delay is declared or assigned a value elsewhere than in the call expression's arguments.
Add test cases that have declarations and assignments.

Ref: testing-library#403
Belco90 pushed a commit that referenced this issue Sep 7, 2022
fix: no-await-sync-events false positive

Check if delay is declared or assigned a value elsewhere than in the call expression's arguments.
Add test cases that have declarations and assignments.

Closes #403
@github-actions
Copy link

github-actions bot commented Sep 7, 2022

🎉 This issue has been resolved in version 5.6.2 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working released
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants