github / github/eslint-plugin-github
New rule: Ban top-level querying in module.
- Lenguaje dominante
- JavaScript
- Estrellas
- 336
- Forks
- 67
- Merge medio
- 1 d 9 h
- PR fusionados (30 d)
- 6
Descripción
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')
})
```
Guía de contribución
Línea de trabajo
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.
Escrito por el modelo de indexación a partir del texto del issue.
Evaluación
- Stack tecnológico
- javascript
- Área
- tooling
- Tipo de issue
- Nueva funcionalidad
- Dificultad
- 3/5
- Tiempo estimado
- 1-2 días
- Estado de actividad
- Estancado
- Claridad
- Bastante claro
- Aptitud para principiantes
- 45/100