Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Invalid autofix from prefer-find-by #739

Closed
tylerlaprade opened this issue Mar 13, 2023 · 1 comment
Closed

Invalid autofix from prefer-find-by #739

tylerlaprade opened this issue Mar 13, 2023 · 1 comment
Labels
bug Something isn't working duplicate This issue or pull request already exists

Comments

@tylerlaprade
Copy link

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

  1. await waitFor(() => expect(screen.getByText('foo')).toBeInTheDocument());
  2. ESLint auto-fix
  3. 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

@tylerlaprade tylerlaprade added bug Something isn't working triage Pending to be triaged by a maintainer labels Mar 13, 2023
@Belco90
Copy link
Member

Belco90 commented Mar 13, 2023

Duplicated of #579

@Belco90 Belco90 closed this as not planned Won't fix, can't repro, duplicate, stale Mar 13, 2023
@Belco90 Belco90 added duplicate This issue or pull request already exists and removed triage Pending to be triaged by a maintainer labels Mar 13, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working duplicate This issue or pull request already exists
Projects
None yet
Development

No branches or pull requests

2 participants