-
Notifications
You must be signed in to change notification settings - Fork 132
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
no-unnecessary-act
: Doesn't report when the variable has a name other than "userEvent"
#758
Labels
bug
Something isn't working
Comments
ahce
added
bug
Something isn't working
triage
Pending to be triaged by a maintainer
labels
Apr 28, 2023
Thanks for reporting @ahce. This is probably caused by the default import being renamed. That could potentially prevent every rule in the repo to report errors properly, so it's a core change to the plugin. |
@Belco90 I think this still happens even when the default import isn't renamed. For example, the following will not report a lint error. import { act, screen } from "@testing-library/react";
import userEvent from "@testing-library/user-event";
describe("test", () => {
it("this does not cause a lint error", async () => {
const user = userEvent.setup();
await act(() => user.click(screen.getByText("Test")));
});
it("this does cause a lint error", async () => {
await act(() => userEvent.click(screen.getByText("Test")));
});
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Have you read the Troubleshooting section?
Yes
Plugin version
5.10.3
ESLint version
8.39.0
Node.js version
16.20.0
package manager and version
8.19.4
Operating system
macOS Ventura, version 13.2.1
Bug description
In the documentation, the examples named userEvent as "user".
When the variable has been named as "user" the
no-unnecessary-act
doesn't report.Steps to reproduce
Error output/screenshots
ESLint configuration
Rule(s) affected
no-unnecessary-act
Anything else?
No response
Do you want to submit a pull request to fix this bug?
No
The text was updated successfully, but these errors were encountered: