SebastienGllmt / eslint-plugin-no-floating-promise

Detects missing await on async function calls
17 stars 3 forks source link

Not published to NPM (yet?) #3

Closed ReDrUm closed 4 years ago

ReDrUm commented 4 years ago

The readme suggests eslint-plugin-no-floating-promise is the npm package name, but it doesn't exist yet.

$ npm install eslint-plugin-no-floating-promise --save-dev

Do you have plans to release this soon? Or has it been removed?

stefanpl commented 4 years ago

@ReDrUm have you actually found something similar to this repo? Or are you using it from github? I've been wanting this feature ever since I've been programming async in JS, and am very surprised by the apparent lack of such functionality. Even a dedicated package like eslint-plugin-promise does not seem to provide this …

stefanpl commented 4 years ago

Note to anybody searching for this: I eventually found out about typescript-eslint/no-floating-promises, so adding

'@typescript-eslint/no-floating-promises': 2,

to your eslintrc file should achieve the desired outcome :+1:

SebastienGllmt commented 4 years ago

Sorry I didn't see this until now. The message in the README comes in the template for an eslint plugin. I never uploaded this to NPM because I mostly wrote this to try and convince the Flow team to add this to Flow since vanilla ESLint can not catch that many cases (as mentioned in the "limitations section) As @stefanpl pointed our, there is a Typescript rule for this that does work well.

SebastienGllmt commented 4 years ago

I published it here https://www.npmjs.com/package/eslint-plugin-no-floating-promise