github / github/eslint-plugin-github

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

Aperta
#599 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub
Lingua principale
JavaScript
Stelle
336
Fork
67
Merge medio
1g 9h
PR unite (30g)
6

Descrizione

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

```js
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`.

Guida per i contributori

Apri la guida per i contributori

Valutazione

Questa issue non è ancora stata valutata.

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.