#3238·javascript

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

Author: dataCenter430Created Mar 5, 2026Updated Mar 6, 2026

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.