Skip to content

Make 'await-async-queries' rule auto-fixable #914

Open
@neriyarden

Description

@neriyarden
Contributor

What rule do you want to change?

await-async-queries

Does this change cause the rule to produce more or fewer warnings?

Fewer warnings

How will the change be implemented?

When the eslint is run with the --fix flag, an await will be inserted before the async query

For example:

findByText('text') 
=> await findByText('text')

Example code

findByText('text') 
after fix => await findByText('text')


const promise = () => findByText('text')
promise()
after fix => await promise()

How does the current rule affect the code?

The error has to be manually fixed

How will the new rule affect the code?

Auto-fix will enhance dev experience and productivity

Anything else?

I would like to develop this myself :)

I will need some help on how to test my fixer. Is there a kind of test that tests the auto-fix of rules? If not, is it possible to install and run the plugin in this repo itself? Any other suggestions?

Do you want to submit a pull request to change the rule?

Yes

Activity

changed the title [-]Make 'await-async-queries' rule fixable[/-] [+]Make 'await-async-queries' rule auto-fixable[/+] on Jul 13, 2024
Belco90

Belco90 commented on Jul 16, 2024

@Belco90
Member

Thanks for reporting. This issue can be considered part of #202.

For testing your fixer, you can use just ESLint tests. For invalid cases, it allows checking what's the expected output after the fixer is executed. Take await-async-events tests as an example: you can see the invalid cases have an output property with the expected code that should generate. I'd start by adding such output to all existing invalid cases from await-async-queries. The implementation of the fixer should be quite similar to the await-async-events` one.

removed
triagePending to be triaged by a maintainer
on Jul 16, 2024
linked a pull request that will close this issue on Jul 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      Participants

      @Belco90@neriyarden

      Issue actions

        Make 'await-async-queries' rule auto-fixable · Issue #914 · testing-library/eslint-plugin-testing-library