Skip to content

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

@dataCenter430

Description

@dataCenter430

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions