eslint-plugin-github icon indicating copy to clipboard operation
eslint-plugin-github copied to clipboard

`github/async-preventdefault` should not flag calls before the first `await`

Open silverwind opened this issue 1 year ago • 0 comments

preventDefault() works fine before the first await in an async function, so this code works as expected, but if currently flagged:

document.querySelector('a').addEventListener('click', e => {
  e.preventDefault();
  await fetch('/');
});

It's only after the first await, where preventDefault stops working. I suggest the rule to only flag preventDefault() after the first await.

silverwind avatar Jan 13 '25 21:01 silverwind