Invalid autofix from `prefer-find-by`
tylerlaprade opened this issue · 1 comments
tylerlaprade commented
Have you read the Troubleshooting section?
Yes
Plugin version
5.10.2
ESLint version
8.33.0
Node.js version
18.14.0
package manager and version
npm 8.15.0
Operating system
macOS Ventura 13.0.1
Bug description
The rule flagged and "fixed" a line containing both await waitFor and getByText, but there were other functions in between. The autofix removed those other functions, breaking my code.
Steps to reproduce
await waitFor(() => expect(screen.getByText('foo')).toBeInTheDocument());- ESLint auto-fix
await screen.findByText('foo');
Error output/screenshots
No response
ESLint configuration
"extends": ["plugin:testing-library/react"]
Rule(s) affected
prefer-find-by
Anything else?
No response
Do you want to submit a pull request to fix this bug?
No