github / github/eslint-plugin-github
New rule: Ban top-level querying in module.
- Dominant language
- JavaScript
- Stars
- 336
- Forks
- 67
- Avg merge
- 1d 9h
- Merged PRs (30d)
- 6
Description
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')
})
```
Contributor guide
Research direction
The issue names no files, tests, or entry points. Start by locating the repository's existing ESLint rule definitions and their tests, then compare how they detect top-level queries and report violations. Done means the new rule rejects the shown module-level query while allowing querying inside a DOMContentLoaded listener or Web Component.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript
- Domain
- tooling
- Issue type
- Feature
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100