Ranjeesh
(Ranjeesh)
June 5, 2024, 5:42am
1
Operating system: Windows
SonarLint plugin version: v4.6.0
Programming language you’re coding in: Javascript
Is connected mode used:
Connected to SonarCloud or SonarQube (and which version): No
So I have been using void for promises in the code:
void this.router.navigate
Which the sonnar js supports from Ignore promises in S3735 `void-use` · Issue #2629 · SonarSource/SonarJS · GitHub
But still the vs code is giving warning. Need fix for this.
Colin
(Colin)
June 5, 2024, 6:47am
2
I’ve moved your post to the section on reporting false-positives.
Hey SonarSource Community!
False-positives happen , as do false-negatives, and we’re eager to fix them. We are thrilled when our users report problems, so we can make our products better.
What is a false-positive (FP)?
A false-positive is when an issue is raised unexpectedly on code that should not trigger an issue, or where the suggested action doesn’t make any sense for the code.
What is a false-negative (FN)?
A false-negative is when an issue should be raised on a piece of code, but isn’t…
can you please provide a complete code sample?
Costiss
(Gabriel Costa Martins Ganassin)
October 1, 2025, 2:10pm
3
I’m having the same issue on Community Build v25.7.0.110598
. Sonar is unable to detect explicit void
keyword on functions that return promises.
This sonar rule conflicts with ESLint rule no-floating-promises | TypeScript ESLint
void asyncFunction();
→ This errors as a False-Positive, but is a good practice
This issue is related to this topic Typescript '"void" should not be used' triggers wrongly - #5
The URL for the ticket referenced in this topic is not available
Colin
(Colin)
October 1, 2025, 3:57pm
4
Hey @Costiss
My feedback to you is the exact same as to OP.
I’ve moved your post to the section on reporting false-positives.
can you please provide a complete code sample?
Costiss
(Gabriel Costa Martins Ganassin)
October 2, 2025, 4:53pm
5
Hi Colin, thanks for the reply.
Here is a code example with more details
async function example() {
const response = await fetch("https://api.example.com/data");
const data = await response.json();
return data;
}
async function main() {
void example(); // ESLint no-floating-promises compliant but SonarQube error
example(); // ESLint no-floating-promises error
}
Colin
(Colin)
October 2, 2025, 7:53pm
6
Hey there.
We should have fixed this in a version of our Javascript analyzer that landed in 25.7
master
← js-633
opened 09:19AM - 17 Apr 25 UTC
[JS-633](https://sonarsource.atlassian.net/browse/JS-633)
If we don't have type… script types, lets be permissive and if we have a function call that it can be a promise.
[JS-633]: https://sonarsource.atlassian.net/browse/JS-633?atlOrigin=eyJpIjoiNWRkNTljNzYxNjVmNDY3MDlhMDU5Y2ZhYzA5YTRkZjUiLCJwIjoiZ2l0aHViLWNvbS1KU1cifQ
In any case I’m not seeing the error raise in 25.9
I suggest updating!