Skip to content

Make 'prefer-presence-queries' autofixable #916

Open
@guicamillo

Description

@guicamillo

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

No one assigned

    Labels

    enhancementNew feature or requesttriagePending to be triaged by a maintainer

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions