prefer-screen-queries and render-result-naming-convention have contradictory messages
abejfehr opened this issue · 0 comments
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:
const view = render(...);
...
view.getByText(...);
The lint rule that gets triggered is prefer-screen-queries with the message:
Avoid destructuring queries from
renderresult, usescreen.getByTextinstead
So naively, someone might think to rename the result of render from view to screen to satisfy the message.
But instead, you get this new lint warning from render-result-naming-convention:
screenis not a recommended name forrenderreturned value. Instead, you should destructure it, or name it using one of:view, orutils
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 contradictory
Example 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