Skip to content
New issue

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

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

Already on GitHub? # to your account

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

Open
neriyarden opened this issue Jul 13, 2024 · 1 comment · May be fixed by #917
Open

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

neriyarden opened this issue Jul 13, 2024 · 1 comment · May be fixed by #917
Labels
enhancement New feature or request

Comments

@neriyarden
Copy link
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

@neriyarden neriyarden added enhancement New feature or request triage Pending to be triaged by a maintainer labels Jul 13, 2024
@neriyarden neriyarden changed the title Make 'await-async-queries' rule fixable Make 'await-async-queries' rule auto-fixable Jul 13, 2024
@Belco90
Copy link
Member

Belco90 commented Jul 16, 2024

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.

@Belco90 Belco90 removed the triage Pending to be triaged by a maintainer label Jul 16, 2024
@neriyarden neriyarden linked a pull request Jul 26, 2024 that will close this issue
1 task
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants