github / github/eslint-plugin-github

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

未關閉
#599 0 則留言 0 個 reaction 已指派 0 人 在 GitHub 檢視
主要語言
JavaScript
星號
336
分支
67
平均合併
1 天 9 小時
30 天內合併 PR
6

描述

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

貢獻指南

開啟貢獻指南

研究方向

Start by locating the github/async-preventdefault rule and its existing tests. Add coverage for preventDefault() before and after the first await, then verify the rule flags only the latter case.

由索引模型根據 Issue 內容生成。

評估

技術堆疊
eslint, javascript
領域
tooling
Issue 類型
缺陷
難度
3/5
預估耗時
1-2 天
活躍度
停滯
描述清晰度
基本清楚
新手友好度
48/100

把新 issue 寄到你的電子郵件信箱

精選適合新手參與的 GitHub issue 摘要。