Severity: Unhandled promise rejection in `whitespace-async.js` when ESLint async path is used
- Lingua principale
- JavaScript
- Stelle
- 148k
- Fork
- 26.6k
- Metriche di merge delle PR
- Nessuna PR unita negli ultimi 30g
Descrizione
## Summary
When the config is loaded on ESLint 9 (or when `CLIEngine` is unavailable), `whitespace.js` runs `whitespace-async.js` via `execSync`. That script calls `onlyErrorOnRules(...).then(...)` with no `.catch()`. If the promise rejects, the rejection is unhandled.
## Impact
- Process can exit with an unhandled rejection.
- Child process may write errors (or non-JSON) to stdout, so the parent’s `JSON.parse(stdout)` can throw and fail config loading with an unclear error.
## Affected files
- `packages/eslint-config-airbnb-base/whitespace-async.js` (line 49)
- `packages/eslint-config-airbnb/whitespace-async.js` (line 49)
## Suggested fix
Add a `.catch()` that logs the error and sets `process.exitCode = 1`, so rejections are handled and the child exits with a non-zero code instead of leaving an unhandled rejection.
## Screenshot
I'd love to have the chance to contribute to this.
Guida per i contributori
Nessuna guida per i contributori indicizzata per questo repository
Direzione di ricerca
Inizia dalla riga 49 di packages/eslint-config-airbnb-base/whitespace-async.js e packages/eslint-config-airbnb/whitespace-async.js, poi segui il modo in cui whitespace.js invoca lo script async con execSync. Verifica il percorso di rifiuto e il comportamento dell'output del processo figlio. Il lavoro è concluso quando le promise rifiutate vengono gestite, l'errore viene registrato e process.exitCode viene impostato su 1, in modo che il processo padre non riceva JSON fuorviante.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Valutazione
- Stack tecnologico
- eslint, javascript
- Ambito
- tooling
- Tipo di issue
- Bug
- Difficoltà
- 2/5
- Tempo stimato
- 1-3 ore
- Stato di attività
- Attiva
- Chiarezza
- Specificata chiaramente
- Idoneità per principianti
- 78/100