Hi guys,
currently SonarQube Developer Edition 8.5.1 is triggering a warning for the following code:
const exampleFunction = () => { return new Promise(() => {});};
void exampleFunction();
This is not the expected response as exampleFunction is a promise which you normally want to do something with.
But sometimes the promises isn’t interesting. So eslint is expecting a void in front of it to explicitly mark that the promise is not used.
The SonarQube example would like this:
const exampleFunction = () => { return new Promise(() => {});};
exampleFunction();
This code would lead to eslint telling you:
Promises must be handled appropriately or explicitly marked as ignored with the
void
operator. eslint@typescript-eslint/no-floating-promises
In my opinion eslint is right and SonarQube is wrong in this particular case.
Is the a possiblity to tailor the rule to exclude Promises?
Best
Ben