-
Notifications
You must be signed in to change notification settings - Fork 152
Closed
Labels
enhancementNew feature or requestNew feature or requestreleasedtriagePending to be triaged by a maintainerPending to be triaged by a maintainer
Description
What rule do you want to change?
prefer-presence-queries
Does this change cause the rule to produce more or fewer warnings?
Fewer warnings
How will the change be implemented?
When eslint is run with the --fix flag, the plugin will:
- replace the method in violation
- auto import the expected method, if needed:
Example code
// current code
const {getByTestId} = render(<Thing />);
expect(getByTestId("awesome-test-id")).not.toBeInTheDocument()
// will then get replaced to
const {getByTestId, queryByTestId} = render(<Thing />);
expect(queryByTestId("awesome-test-id")).not.toBeInTheDocument()
How does the current rule affect the code?
Code isn't fixed automatically 🫤
How will the new rule affect the code?
It will be auto-fixed 🎉
Anything else?
No response
Do you want to submit a pull request to change the rule?
Yes
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or requestreleasedtriagePending to be triaged by a maintainerPending to be triaged by a maintainer
Activity
guicamillo commentedon Jul 23, 2024
I've implemented the fixer and got it working as intended (i think)
im having some issues with the current unit tests as
createRuleTester()
seems to be autofixing it, producing a plethora of the following errors:Is it possible to run the unit tests without
--fix
, so i can ensure I haven't changed the current behaviour?github-actions commentedon Jun 5, 2025
🎉 This issue has been resolved in version 7.4.0 🎉
The release is available on:
Your semantic-release bot 📦🚀
feat(prefer-presence-queries): add autofix support (testing-library#1020