eslint-plugin-no-floating-promise icon indicating copy to clipboard operation
eslint-plugin-no-floating-promise copied to clipboard

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

Open zuhairtaha opened this issue 2 years ago • 0 comments

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 }],

zuhairtaha avatar Apr 25 '22 12:04 zuhairtaha