airbnb / airbnb/javascript

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

Open
#3,238 8 comments 0 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
148k
Forks
26.6k
PR merge metrics
No merged PRs in 30d

Description

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

Contributor guide

No contributing guide indexed for this repository

Research direction

Start at line 55 in packages/eslint-config-airbnb-base/whitespace.js and packages/eslint-config-airbnb/whitespace.js, tracing the execSync and JSON.parse path used when CLIEngine is unavailable. Done means child-script failures and invalid output produce a clear diagnostic while successful configuration loading continues to work.

Written by the indexing model from the issue text.

Assessment

Tech stack
eslint, javascript
Domain
tooling
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.