javascript icon indicating copy to clipboard operation
javascript copied to clipboard

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

Open dataCenter430 opened this issue 8 months ago • 6 comments

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.

dataCenter430 avatar Mar 05 '26 19:03 dataCenter430

I don't believe there's a released version of the config yet that works with eslint 9. However, unreleased code should, so a PR would be great - although a .catch shouldn't be the handling imo, it should just do the right thing instead.

Please be sure not to use an LLM to generate the code, since LLM-generated code is not copyrightable and thus can't be accepted to any open source project.

ljharb avatar Mar 05 '26 19:03 ljharb

I Would Like To Work On This Issue

maseera169-stack avatar May 22 '26 12:05 maseera169-stack

Hi! I'd like to work on this issue. Could you please assign it to me?

mannugarg30 avatar Jul 23 '26 17:07 mannugarg30

no, nothing in open source is ever assigned ever, and it's super weird to ask

ljharb avatar Jul 24 '26 05:07 ljharb

Thanks for the clarification. I wasn't aware that was the project's convention. I appreciate the explanation.

On Fri, Jul 24, 2026 at 5:42 AM Jordan Harband @.***> wrote:

ljharb left a comment (airbnb/javascript#3237) https://github.com/airbnb/javascript/issues/3237#issuecomment-5066544310

no, nothing in open source is ever assigned ever, and it's super weird to ask

— Reply to this email directly, view it on GitHub https://github.com/airbnb/javascript/issues/3237?email_source=notifications&email_token=CI25HTZ7KXDCHZYDS3FVDMD5GLZNRA5CNFSNUABFM5UWIORPF5TWS5BNNB2WEL2JONZXKZKDN5WW2ZLOOQXTKMBWGY2TINBTGEYKM4TFMFZW63VKON2WE43DOJUWEZLEUVSXMZLOOSWGM33PORSXEX3DNRUWG2Y#issuecomment-5066544310, or unsubscribe https://github.com/notifications/unsubscribe-auth/CI25HTZDUK37JWDBW7R62635GLZNRAVCNFSNUABDKJSXA33TNF2G64TZHM3DIOJYGQ4TEO2JONZXKZJ3GQYDGMBRGA3DIMZTUF3AE . Triage notifications, keep track of coding agent tasks and review pull requests on the go with GitHub Mobile for iOS https://github.com/notifications/mobile/ios/CI25HT6PXHQMZJXUJRMQDST5GLZNRA5CNFSNUABFM5UWIORPF5TWS5BNNB2WEL2JONZXKZKDN5WW2ZLOOQXTKMBWGY2TINBTGEYKM4TFMFZW63VKON2WE43DOJUWEZLEUVSXMZLOOSVGM33PORSXEX3JN5ZQ and Android https://github.com/notifications/mobile/android/CI25HTZOL4PBIPZBCWQHH5L5GLZNRA5CNFSNUABFM5UWIORPF5TWS5BNNB2WEL2JONZXKZKDN5WW2ZLOOQXTKMBWGY2TINBTGEYKM4TFMFZW63VKON2WE43DOJUWEZLEUVSXMZLOOSXGM33PORSXEX3BNZSHE33JMQ. Download it today! You are receiving this because you are subscribed to this thread.Message ID: @.***>

zzhffesgg avatar Jul 29 '26 15:07 zzhffesgg

@zzhffesgg it's not "the project's" convention, it's "the entire internet's" convention.

ljharb avatar Sep 08 '26 06:09 ljharb