No error handling around execSync + JSON.parse in whitespace.js (ESLint 9 path)
- Lingua principale
- JavaScript
- Stelle
- 148k
- Fork
- 26.6k
- Metriche di merge delle PR
- Nessuna PR unita negli ultimi 30g
Descrizione
## Summary
When `CLIEngine` is not available (e.g. ESLint 9), `whitespace.js` loads the config by running `whitespace-async.js` with `execSync` and then doing `JSON.parse(String(...))` on the result. There is no try/catch around this.
## Impact
- If the child script exits non-zero, prints errors, or prints non-JSON (e.g. ESLint timing or debug output), `execSync` may throw or return non-JSON.
- `JSON.parse` will then throw and the config load fails with a generic parsing error, making it hard to see that the real failure was in the child script.
## Affected files
- `packages/eslint-config-airbnb-base/whitespace.js` (line 55)
- `packages/eslint-config-airbnb/whitespace.js` (line 55)
## Suggested fix
Wrap the `execSync` call and `JSON.parse` in try/catch and rethrow with a clear message (and optionally `cause: err`) so failures are easier to diagnose.
## screenshot
I'd love to work on this.
Guida per i contributori
Nessuna guida per i contributori indicizzata per questo repository
Direzione di ricerca
Inizia dalla riga 55 in packages/eslint-config-airbnb-base/whitespace.js e packages/eslint-config-airbnb/whitespace.js, seguendo il percorso che usa execSync e JSON.parse quando CLIEngine non è disponibile. Il lavoro è completato quando gli errori degli script figli e gli output non validi producono una diagnosi chiara, mentre il caricamento corretto della configurazione continua a funzionare.
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à
- Ferma
- Chiarezza
- Specificata chiaramente
- Idoneità per principianti
- 48/100