Skip to content

Severity: Unhandled promise rejection in whitespace-async.js when ESLint async path is used #3237

@dataCenter430

Description

@dataCenter430

Summary

When the config is loaded on ESLint 9 (or when CLIEngine is unavailable), whitespace.js runs whitespace-async.js via execSync. That script calls onlyErrorOnRules(...).then(...) with no .catch(). If the promise rejects, the rejection is unhandled.

Impact

  • Process can exit with an unhandled rejection.
  • Child process may write errors (or non-JSON) to stdout, so the parent’s JSON.parse(stdout) can throw and fail config loading with an unclear error.

Affected files

  • packages/eslint-config-airbnb-base/whitespace-async.js (line 49)
  • packages/eslint-config-airbnb/whitespace-async.js (line 49)

Suggested fix

Add a .catch() that logs the error and sets process.exitCode = 1, so rejections are handled and the child exits with a non-zero code instead of leaving an unhandled rejection.

Screenshot

Image

I'd love to have the chance to contribute to 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