You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Does this change cause the rule to produce more or fewer warnings?
More warnings
How will the change be implemented?
Right now, we are only checking the RegExp passed directly to Testing Library queries. If a variable is found, we should check what's the value held in it to report global flags there also.
Example code
it('should render a basic demo',()=>{constcountRegExp=/count/girender(<App/>)expect(screen.getByText(countRegExp)).toBeInTheDocument()})
How does the current rule affect the code?
screen.getByText(countRegExp) should be reported.
How will the new rule affect the code?
N/A
Anything else?
No response
Do you want to submit a pull request to change the rule?
No
The text was updated successfully, but these errors were encountered:
Belco90
changed the title
[Improvement] Report RegExp with global flag saved in a variable
Improvement: Report RegExp with global flag saved in a variable
May 25, 2022
…e declarations (#678)
Closes#592
* fix: change function name to more informative and add JS Doc comment
* feat(no-global-regexp-flag-in-query): detect global regexp in variable declarations
What rule do you want to change?
no-global-regexp-flag-in-query
Does this change cause the rule to produce more or fewer warnings?
More warnings
How will the change be implemented?
Right now, we are only checking the RegExp passed directly to Testing Library queries. If a variable is found, we should check what's the value held in it to report global flags there also.
Example code
How does the current rule affect the code?
screen.getByText(countRegExp)
should be reported.How will the new rule affect the code?
N/A
Anything else?
No response
Do you want to submit a pull request to change the rule?
No
The text was updated successfully, but these errors were encountered: