Skip to content

Bug: [no-floating-promises] allowForKnownSafeCalls no longer works for describe function with newer node:test typings #11372

Closed
@kayahr

Description

@kayahr

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=JYWwDg9gTgLgBAbzgEwKYGcDGVgCNUA0cw8AvnAGZQQhwBEAdhGgFwwYx0BQXaWO%2BABR0KECHSKCAlHAC8APkRc4xGMNwBDKBLjS5ihMrikpAbi4nzXIA&eslintrc=N4KABGBEBOCuA2BTAzpAXGUEKQAIBcBPABxQGNoBLY-AWhXkoDt8B6Jge1oDN4OBDfMwDmtYtA4BbSshTowAbXDYcAd37QmkADSZlKnP3h9VAMQ7QA0p1VMAyv26IAwkfioMSgwazeDkbglJeUhifjIAa35hRB19PxwmfklYzyhKfB0oABNyKgAjWN1IfBRM4uRYDNiwAF1teITQ8KiYkM5ctFLkTMaDAF8%2BiFq%2BwZURiEH%2BoA&tsconfig=N4KABGBEDGD2C2AHAlgGwKYCcDyiAuysAdgM6QBcYoEEkJemy0eAcgK6qoDCAFutAGsylBm3TgwAXxCSgA&tokens=false

Repro Code

import { describe, it } from "node:test"

describe("foo", () => {
  it("bar", () => {
  });
});

ESLint Config

{
  "rules": {
    "@typescript-eslint/no-floating-promises": [
      "warn", {
        "allowForKnownSafeCalls": [
          {
            "from": "package",
            "name": [ "it", "describe", "test", "suite" ],
            "package": "node:test"
          }
        ]
      }
    ]
  }
}

tsconfig

{
  "compilerOptions": {
    // ...
  }
}

Expected Result

The floating-promise warning should be ignored for describe and it calls from node:test.

Actual Result

Since @types/node version 24.0.9 it only works for it but no longer for describe. With version 24.0.8 it works for both calls.

Additional Info

In @types/node version 24.0.8 the it and describe functions were exported directly. Since 24.0.9 the functions are exported as an alias:

namespace test {
    export { test };
    export { suite as describe, test as it };
}
// ...
export = test;

The it function only works when I also add the test function in the allowForKnownSafeCalls config. But adding suite doesn't fix the problem with describe.

The export definitions in @types/node are syntactically correct, no compiler and runtime errors. So I guess this is a bug in typescript-eslint that these definitions are not parsed correctly?

Metadata

Metadata

Assignees

No one assigned

    Labels

    accepting prsGo ahead, send a pull request that resolves this issuebugSomething isn't workingpackage: eslint-pluginIssues related to @typescript-eslint/eslint-plugin

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      pFad - Phonifier reborn

      Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

      Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


      Alternative Proxies:

      Alternative Proxy

      pFad Proxy

      pFad v3 Proxy

      pFad v4 Proxy