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

fix: async-currenttarget/preventdefault doesn’t consider nested scopes #567

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

kurtextrem
Copy link

Hi! Thanks for the eslint rules. Really helpful.

We found the following example is not caught by the rules I've updated:

const myHandler = async (e) => {
  await foo()
  dummy(() => bar(e.currentTarget))
}

The reason is, while await is in the scope of myHandler, currentTarget (or preventDefault()) is not. To fix it, we have to walk up the scopes and figure out if a parent scope matches the scope where await was found.

@kurtextrem kurtextrem requested a review from a team as a code owner October 31, 2024 16:03
@manuelpuyol
Copy link
Contributor

👋 @kurtextrem thanks for the contribution! Would you mind updating the tests with a new example for this case?

@kurtextrem
Copy link
Author

👋 @kurtextrem thanks for the contribution! Would you mind updating the tests with a new example for this case?

Done!

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

Successfully merging this pull request may close these issues.

2 participants