SebastienGllmt / eslint-plugin-no-floating-promise

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

Option to ignore await if a function call at the end of scope #14

Open zuhairtaha opened 2 years ago

zuhairtaha commented 2 years ago

If I have a function that has at the end of it a promise. Example

document.getElementById('button').addEventListener('click', () => {
   // do stuff
   asynFunc();
});

I want to ignore cases like this. In other words I don't want to add await for asyncFunc() because it is the last thing run in the callback function and no need to await. Is there an option to ignore. Maybe something look like this in eslint rules

"no-floating-promise/no-floating-promise": ["warn", { "ignoreLast": true }],