-
Notifications
You must be signed in to change notification settings - Fork 153
Description
What rule do you want to change?
prefer-screen-queries
Does this change cause the rule to produce more or fewer warnings?
Fewer warnings
How will the change be implemented?
Remove the rule.
Example code
[Delete] + Raise PR.
How does the current rule affect the code?
This rule seems to be based on a kentcdodds post.
The only reason it exists is
From: https://kentcdodds.com/blog/common-mistakes-with-react-testing-library#not-using-screen
The benefit of using screen is you no longer need to keep the render call destructure up-to-date as you add/remove the queries you need. You only need to type screen. and let your editor's magic autocomplete take care of the rest.
Which, in my opinion, is some developer's personal preference in how he works in his workflow, and thus should not be a “rule”
It doesn’t matter.
Tbh – I don’t want to type ",screen" in my import, then “sc + tab +.” 6 times, when I can type “get + tab” then “que + tab” then “qu + tab” twice and “get + tab” 4 times.
IMO, 6 of one, half dozen of another and honestly a very silly rule for react/testing-library to have brought into their core library to begin with.
How will the new rule affect the code?
It will get rid of it, and developers would not have to follow some other developer's personal preference for no apparent reason other than "personal preference"
Anything else?
I just got asked to "fix" my tests in code review because of this rule.
There is absolutely 0 difference in the outcome of the code, and it is arguably more cluttered now because of it.
IMO, this should not be a rule, as it has no actual impact on the code, and it really doesn't make sense to enforce conformity to an expectation that one developer in the community has found to be useful in their own workflow.
We should not be writing ES-LINt rules based on an IDE's ability to autocomplete.
Do you want to submit a pull request to change the rule?
Yes