Skip to content

fix: add no-await-sync-events exception for userEvent.keyboard #283

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

Merged
merged 4 commits into from
Mar 21, 2021

Conversation

ph-fritsche
Copy link
Member

@ph-fritsche ph-fritsche commented Mar 13, 2021

Added exception for the new API proposed in testing-library/user-event#581

Note that with the change userEvent.type (and userEvent.keyboard) will actually return no Promise if the delay is not >0 so that the typing and the actual return value will match.

Further it might be worth discussing if this rule should be disabled for .ts and .tsx files as ts(80007) and @typescript-eslint/await-thenable already warn here and curating a manual list has no benefits when there already are warnings based on the type.

@Belco90
Copy link
Member

Belco90 commented Mar 15, 2021

Hey @ph-fritsche, thanks for your contribution! We need to wait until testing-library/user-event#581 gets merged.

Meanwhile, could you add some additional tests to check userEvent.keyboard is reported or not as intended?

About disabling the rule in TS environments: the plugin won't detect that for now, so it's up to the user to decide if they want to enable or disable the rule.

Copy link
Collaborator

@gndelia gndelia left a comment

Choose a reason for hiding this comment

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

should we update a test to include the keyboard method ? 🤔

@Belco90
Copy link
Member

Belco90 commented Mar 20, 2021

I just realized this rule is still pending to be refactored for v4. @ph-fritsche I can include userEvent.keyboard there when I refactor it. What do you think?

@ph-fritsche
Copy link
Member Author

@Belco90 I've added the changes necessary. Should be ready to be merged now. 😃

@Belco90
Copy link
Member

Belco90 commented Mar 21, 2021

LGTM, thanks for your PR and nice work adding this new feature to userEvent 🚀

@Belco90 Belco90 merged commit 7575464 into testing-library:main Mar 21, 2021
@github-actions
Copy link

🎉 This PR is included in version 3.10.2 🎉

The release is available on:

Your semantic-release bot 📦🚀

@Belco90
Copy link
Member

Belco90 commented Mar 24, 2021

@ph-fritsche sorry mate, I forgot to add you as a contributor!

@all-contributors please add @ph-fritsche for code

@allcontributors
Copy link
Contributor

@Belco90

I could not determine your intention.

Basic usage: @all-contributors please add @Someone for code, doc and infra

For other usages see the documentation

@Belco90
Copy link
Member

Belco90 commented Mar 24, 2021

@all-contributors please add @ph-fritsche for code

@allcontributors
Copy link
Contributor

@Belco90

I've put up a pull request to add @ph-fritsche! 🎉

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.

4 participants