github / github/eslint-plugin-github
`github/async-preventdefault` should not flag calls before the first `await`
- Langage dominant
- JavaScript
- Étoiles
- 336
- Forks
- 67
- Merge moyen
- 1 j 9 h
- PR mergées (30 j)
- 6
Description
`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`.
Guide de contribution
Ouvrir le guide de contribution
Piste de recherche
Commencez par localiser la règle github/async-preventdefault et ses tests existants. Ajoutez une couverture pour preventDefault() avant et après le premier await, puis vérifiez que la règle signale uniquement ce dernier cas.
Rédigé par le modèle d'indexation à partir du texte de l'issue.
Évaluation
- Stack technique
- eslint, javascript
- Domaine
- tooling
- Type d'issue
- Bug
- Difficulté
- 3/5
- Temps estimé
- 1-2 jours
- Activité
- À l'abandon
- Clarté
- Plutôt claire
- Accessibilité débutants
- 48/100