Skip to content
This repository has been archived by the owner on Mar 25, 2021. It is now read-only.

"no-floating-promises" does not report failure with .catch / .then(..., catch) #3936

Closed
oleg-codaio opened this issue Jun 1, 2018 · 3 comments

Comments

@oleg-codaio
Copy link
Contributor

Bug Report

  • TSLint version: 5.9.1
  • TypeScript version: 2.8.3
  • Running TSLint via: (pick one) CLI

TypeScript code being linted

    new Promise(resolve => resolve()).catch(e => {throw e;});

with tslint.json configuration:

{
  // ...
  "rules": {
    // ...
    "no-floating-promises": [true, "Bluebird"],
  }
}

Actual behavior

No error is reported.

Expected behavior

Would expect to be able to catch a floating promise via this rule, even if it requires a specific configuration parameter. This is because it's possible to throw errors in catch blocks, and not returning a floating promise in a chain can result in other bugs.

@oleg-codaio
Copy link
Contributor Author

More context: basically would expect to be able to make the change in #3048 configurable.

@JoshuaKGoldberg
Copy link
Contributor

☠️ TSLint's time has come! ☠️

TSLint is no longer accepting most feature requests per #4534. See typescript-eslint.io for the new, shiny way to lint your TypeScript code with ESLint. ✨

It was a pleasure open sourcing with you all!

@JoshuaKGoldberg
Copy link
Contributor

🤖 Beep boop! 👉 TSLint is deprecated 👈 (#4534) and you should switch to typescript-eslint! 🤖

🔒 This issue is being locked to prevent further unnecessary discussions. Thank you! 👋

@palantir palantir locked and limited conversation to collaborators Mar 20, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants