eslint-plugin-promise
eslint-plugin-promise copied to clipboard
Enforce best practices for JavaScript promises
Putting callback code inside of async functions like this can lead to a lot of trouble: ```js async function bigProbs() { doSomething(function(err) { if (err) throw err; // won't be...
Forgetting to put an await before calling an async function can have very bad outcomes and is quite hard to notice TSLint has a rule named no-floating-promises -https://palantir.github.io/tslint/rules/no-floating-promises/ Can you...
### Description For consistency, I feel that the prefer-await-to-then rule should also flag promise.catch and promise.finally so we can enforce async/await everywhere if desired. ### Steps to Reproduce 1. Run...
### Description The `no-callback-in-promise` rule only checks for [CallExpressions](https://github.com/xjamundx/eslint-plugin-promise/blob/5b935bdd3c3760a2e58eea9b89c86b6d3243e321/rules/lib/is-callback.js#L6). It does not check if a callback is passed to a third-party like `setTimeout(callback)`. I think any time a callback is...
### Description Promisification utilities like `Bluebird.fromCallback` are useful to interface with Node-style APIs. Unfortunately, `no-callback-in-promise` isn't smart enough to realize that these are legitimate uses for calling a callback inside...
Is there a way to enforce that async functions do not return a promise? For example, I'd like to enforce we don't have code like this: ``` async function publishUser(user)...
Hello, It would be great if promises in this form triggered a warning: ```js function foo() { return bar() .then(...) .catch((err) => { console.error(err); }); } ``` Rather than trying...
### Description When using Bluebird, there are cases that deviate from the standard usage of promise functions. One that I found is Bluebird's `.catch` can receive 2 arguments. See http://bluebirdjs.com/docs/api/catch.html#filtered-catch...
### Description https://github.com/xjamundx/eslint-plugin-promise/blob/master/docs/rules/prefer-await-to-callbacks.md
This innocently looking assignment: ``` const FAIL = Promise.reject(); ``` causes UnhandledPromiseRejectionWarning if FAIL is not used...