Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

eslint config: "@typescript-eslint/no-floating-promises": 2 #1492

Closed
1 of 2 tasks
naseemkullah opened this issue Sep 3, 2020 · 2 comments
Closed
1 of 2 tasks

eslint config: "@typescript-eslint/no-floating-promises": 2 #1492

naseemkullah opened this issue Sep 3, 2020 · 2 comments

Comments

@naseemkullah
Copy link
Member

Thoughts on adding this rule?

This rule forbids usage of Promise-like values in statements without handling their errors appropriately. Unhandled promises can cause several issues, such as improperly sequenced operations, ignored Promise rejections and more. Valid ways of handling a Promise-valued statement include awaiting, returning, and either calling .then() with two arguments or .catch() with one argument.

  • This only affects the JavaScript OpenTelemetry library
  • This may affect other libraries, but I would like to get opinions here first
@naseemkullah naseemkullah added the Discussion Issue or PR that needs/is extended discussion. label Sep 3, 2020
@dyladan
Copy link
Member

dyladan commented Sep 3, 2020

While you're updating the eslint rules you may want to take a look at the current warns and determine if any of those rules should be disabled or have options configured. For instance, I know the following code will fail:

// unused variable a
function log(a: unknown, b: string) {
  console.log(b);
}

In this case we might want this to fail, but it may also be implementing some interface but just doesn't care about the first argument?

@naseemkullah naseemkullah removed the Discussion Issue or PR that needs/is extended discussion. label Dec 23, 2020
@pichlermarc
Copy link
Member

Done in #1780 🙂

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants