airbnb / airbnb/javascript

No error handling around execSync + JSON.parse in whitespace.js (ESLint 9 path)

Abierto
#3,238 8 comentarios 0 reacciones 0 asignados Ver en GitHub
Lenguaje dominante
JavaScript
Estrellas
148k
Forks
26.6k
Métricas de merge de PR
Sin PR fusionados en 30 d

Descripción

## 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

Image

I'd love to work on this.

Guía de contribución

No hay ninguna guía de contribución indexada para este repositorio

Línea de trabajo

Comienza en la línea 55 de packages/eslint-config-airbnb-base/whitespace.js y packages/eslint-config-airbnb/whitespace.js, siguiendo la ruta que usa execSync y JSON.parse cuando CLIEngine no está disponible. El trabajo estará terminado cuando los fallos de los scripts secundarios y las salidas no válidas produzcan un diagnóstico claro, mientras la carga correcta de la configuración siga funcionando.

Escrito por el modelo de indexación a partir del texto del issue.

Evaluación

Stack tecnológico
eslint, javascript
Área
tooling
Tipo de issue
Error
Dificultad
2/5
Tiempo estimado
1-3 horas
Estado de actividad
Estancado
Claridad
Bien especificado
Aptitud para principiantes
48/100

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.