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

fix(no-wait-for-side-effects): false positive inside .then() #645

Conversation

sjarva
Copy link
Collaborator

@sjarva sjarva commented Sep 12, 2022

Checks

  • I have read the contributing guidelines.
  • If some rule is added/updated/removed, I've regenerated the rules list (npm run generate:rules-list)
  • If some rule meta info is changed, I've regenerated the plugin shared configs (npm run generate:configs)

Changes

  • when reporting side efdects, check if the node is a .then(), and if it is, not report it
  • added unit tests
  • adds a mention of edge case to rule documentation

Context

Closes: #500

Added tests and a mention of edge case to rule documentation

Refs: testing-library#500
Copy link
Member

@Belco90 Belco90 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for fixing this one too! Just a couple of small changes and should be ready to go.

tests/lib/rules/no-wait-for-side-effects.test.ts Outdated Show resolved Hide resolved
lib/rules/no-wait-for-side-effects.ts Outdated Show resolved Hide resolved
@Belco90 Belco90 changed the title fix(no-wait-for-side-effects) false positive inside .then() fix(no-wait-for-side-effects): false positive inside .then() Sep 12, 2022
Remove awaits as the promise is waited by .then()
Reuse existing helper function to make solution simpler
@sjarva sjarva requested a review from Belco90 September 13, 2022 08:09
Remove await as the promise is waited by .then()
Remove await as the promise is waited by .then()
Copy link
Member

@Belco90 Belco90 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All good!

@Belco90 Belco90 merged commit fc6ccf8 into testing-library:main Sep 13, 2022
@github-actions
Copy link

🎉 This PR is included in version 5.6.4 🎉

The release is available on:

Your semantic-release bot 📦🚀

@sjarva sjarva deleted the pr/no-wait-for-side-effects-false-positive-in-then branch September 13, 2022 08:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

no-wait-for-side-effects erroring in promise
2 participants