Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Bug: [no-floating-promises] doesn't detect nested arrays to Promise.all() #11257

Closed as not planned
@libre-man

Description

@libre-man

Before You File a Bug Report Please Confirm You Have Done The Following...

  • I have tried restarting my IDE and the issue persists.
  • I have updated to the latest version of the packages.
  • I have searched for related issues and found none that matched my issue.
  • I have read the FAQ and my problem is not listed.

Playground Link

https://typescript-eslint.io/play/#ts=5.8.2&fileType=.tsx&code=IYZwngdgxgBAZgV2gFwJYHsI2ACgJQwDeAUDNgO7CrIwAKATugLaogCmAdMADbc4DapGPwbNWnemxDpuANzb4AugBohivMQC%2BxIA&eslintrc=N4KABGBEBOCuA2BTAzpAXGUFs%2B5AAgC4CeADigMbQCWphAtCvNQHaED0LA9vQGbxcAhoVYBzeqWhcAttWQp0URNCnRI4MAF8QmoA&tsconfig=N4KABGBEDGD2C2AHAlgGwKYCcDyiAuysAdgM6QBcYoEEkJemy0eAcgK6qoDCAFutAGsylBm3TgwAXxCSgA&tokens=false

Repro Code

async function a() {
  await Promise.all([
    [Promise.resolve()],
  ])
}

ESLint Config

{
  "rules": {
            "@typescript-eslint/no-floating-promises": "error"
  }
}

tsconfig

{
  "compilerOptions": {
    "strictNullChecks": true
  }
}

Expected Result

I would expect this code to be flagged, as Promise.all([[promise]]) doesn't await promise.

Actual Result

There was no issue detected.

Additional Info

This is quite a subtle bug and it would be great if typescript-eslint could catch it.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workinglocked due to agePlease open a new issue if you'd like to say more. See https://typescript-eslint.io/contributing.package: eslint-pluginIssues related to @typescript-eslint/eslint-plugintriageWaiting for team members to take a look

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions