github / github/eslint-plugin-github
New rule: Ban top-level querying in module.
- Lingua principale
- JavaScript
- Stelle
- 336
- Fork
- 67
- Merge medio
- 1g 9h
- PR unite (30g)
- 6
Descrizione
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')
})
```
Guida per i contributori
Apri la guida per i contributori
Direzione di ricerca
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.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Valutazione
- Stack tecnologico
- javascript
- Ambito
- tooling
- Tipo di issue
- Funzionalità
- Difficoltà
- 3/5
- Tempo stimato
- 1-2 giorni
- Stato di attività
- Ferma
- Chiarezza
- Abbastanza chiara
- Idoneità per principianti
- 45/100