We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
prefer-screen-queries or render-result-naming-convention
More warnings
Say that someone has the following code:
const view = render(...); ... view.getByText(...);
The lint rule that gets triggered is prefer-screen-queries with the message:
prefer-screen-queries
Avoid destructuring queries from render result, use screen.getByText instead
render
screen.getByText
So naively, someone might think to rename the result of render from view to screen to satisfy the message.
view
screen
But instead, you get this new lint warning from render-result-naming-convention:
render-result-naming-convention
screen is not a recommended name for render returned value. Instead, you should destructure it, or name it using one of: view, or utils
utils
which might lead one to believe that there's no satisfying both rules.
Obviously the actual solution is to import screen from @testing-library/... but that's never explicitly mentioned anywhere.
@testing-library/...
Additionally, the first rule says not to destructure the result of render, but the second rule advocates for it which is contradictory
N/A
These forms are way too restrictive
No
The text was updated successfully, but these errors were encountered:
No branches or pull requests
What rule do you want to change?
prefer-screen-queries or render-result-naming-convention
Does this change cause the rule to produce more or fewer warnings?
More warnings
How will the change be implemented?
Say that someone has the following code:
The lint rule that gets triggered is
prefer-screen-queries
with the message:So naively, someone might think to rename the result of
render
fromview
toscreen
to satisfy the message.But instead, you get this new lint warning from
render-result-naming-convention
:which might lead one to believe that there's no satisfying both rules.
Obviously the actual solution is to import
screen
from@testing-library/...
but that's never explicitly mentioned anywhere.Additionally, the first rule says not to destructure the result of
render
, but the second rule advocates for it which is contradictoryExample code
N/A
How does the current rule affect the code?
N/A
How will the new rule affect the code?
N/A
Anything else?
These forms are way too restrictive
Do you want to submit a pull request to change the rule?
No
The text was updated successfully, but these errors were encountered: