Skip to content
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

Add a rule for validating that actions are awaited #294

Open
Aghassi opened this issue May 23, 2024 · 2 comments
Open

Add a rule for validating that actions are awaited #294

Aghassi opened this issue May 23, 2024 · 2 comments
Labels
enhancement New feature or request

Comments

@Aghassi
Copy link

Aghassi commented May 23, 2024

Right now there are two await related rules

One to make sure that expect awaits if locators are what is being asserted on, and one to make sure there are no useless awaits. That being said you can still do the following

const locator = page.getByRole('button')
locator.click()

When you should have to use an await on locator.click().

It would be nice to have a rule to assert that all action driven functions also need an await call.

Alternatively, I'm open to other eslint rules that may already handle this case. I've tried a few but none of them seem to catch this use case.

@mskelton mskelton added the enhancement New feature or request label Jun 9, 2024
@mskelton mskelton changed the title [FR]: Add a rule for validating that actions are awaited Add a rule for validating that actions are awaited Jun 9, 2024
@manzoorwanijk
Copy link
Contributor

This can be achieved by no-floating-promises rule

@mskelton
Copy link
Member

no-floating-promises requires type information, which I very explicitly try to avoid recommending. Not because those are bad rules, but because I want a great linting experience regardless of if you have rules like no-floating-promises or not.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants