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

New rule to report document.dispatchEvent() #504

Closed
zaicevas opened this issue Nov 11, 2021 · 1 comment
Closed

New rule to report document.dispatchEvent() #504

zaicevas opened this issue Nov 11, 2021 · 1 comment
Labels
new rule New rule to be included in the plugin wontfix This will not be worked on

Comments

@zaicevas
Copy link
Contributor

zaicevas commented Nov 11, 2021

Name for new rule

no-document-event

Description of the new rule

I see document.dispatchEvent(new Event('my-custom-event')) as anti pattern. In some cases it might require a redundant wrapping in act() because fireEvent does it out of the box.

Testing Library feature

fireEvent

Testing Library framework(s)

All

What category of rule is this?

Suggests an alternate way of doing something

Optional: other category of rule

No response

Code examples

// BAD
document.dispatchEvent(new Event('my-custom-event'))

// GOOD
fireEvent(document, new Event('my-custom-event'))

Anything else?

No response

Do you want to submit a pull request to make the new rule?

No

@zaicevas zaicevas added the new rule New rule to be included in the plugin label Nov 11, 2021
@stale
Copy link

stale bot commented Jan 13, 2022

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the wontfix This will not be worked on label Jan 13, 2022
@stale stale bot closed this as completed Jan 20, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
new rule New rule to be included in the plugin wontfix This will not be worked on
Projects
None yet
Development

No branches or pull requests

1 participant