airbnb / airbnb/javascript

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

Open Beginner friendly
#3,237 6 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 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.

Contributor guide

No contributing guide indexed for this repository

Research direction

Start at line 49 in packages/eslint-config-airbnb-base/whitespace-async.js and packages/eslint-config-airbnb/whitespace-async.js, then trace how whitespace.js invokes the async script with execSync. Verify the rejection path and child-process output behavior. Done means rejected promises are handled, the error is logged, and process.exitCode is set to 1 so the parent does not receive misleading JSON.

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
Active
Clarity
Clearly specified
Newbie friendliness
78/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.