Skip to content

no-node-access to report where fireEvent/userEvent could be used #752

Open
@zaicevas

Description

@zaicevas

What rule do you want to change?

no-node-access

Does this change cause the rule to produce more or fewer warnings?

More warnings

How will the change be implemented?

Not sure regarding the versioning (major/breaking change), but the idea behind this is that userEvent or fireEvent usage should be preferred over direct node access to call events, such as .focus(), .click(). We could have a whitelist of methods that would be reported by the rule.

Example code

screen.getByPlaceholderText('Search...').focus()

How does the current rule affect the code?

No error reported

How will the new rule affect the code?

Report an error

Anything else?

No response

Do you want to submit a pull request to change the rule?

No

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions