Closed
Description
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
it('should render a basic demo', () => {
const countRegExp = /count/gi
render(<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