github / github/eslint-plugin-github
New rule: Ban top-level querying in module.
未关闭
- 主要语言
- JavaScript
- 星标
- 336
- 派生
- 67
- 平均合并
- 1 天 9 小时
- 30 天内合并 PR
- 6
描述
Querying should be wrapped in event listeners such as `document.addEventListener('DOMContentLoaded', ...)` or a Web Component.
## 👎🏻 Examples of bad code.
```js
const el = document.querySelector('.my-element')
```
## 👍🏻 Example of good code.
```js
document.addEventListener('DOMContentLoaded', function() {
const el = document.querySelector('.my-element')
})
```
贡献指南
评估
这个 Issue 还没有评估数据。