Ignore void-use for promises in sonarlint

  • 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.

I’ve moved your post to the section on reporting false-positives.

can you please provide a complete code sample?

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

Hey @Costiss

My feedback to you is the exact same as to OP. :slight_smile:

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
}

Hey there.

We should have fixed this in a version of our Javascript analyzer that landed in 25.7 :thinking:

In any case I’m not seeing the error raise in 25.9

I suggest updating!

Hi, I have this error reproducing with classes.

class Example {
  public exampleFn: () => Promise<boolean> = () => Promise.resolve(true);

  public exampleMethod(): Promise<boolean> {
    return Promise.resolve(true);
  }
}

class Test {
  public testMethod(): Promise<boolean> {
    return Promise.resolve(true);
  }

  public method2(): void {
    void this.testMethod(); // SonarQube error typescript:S3735

    void new Example().exampleMethod(); // SonarQube error typescript:S3735

    void new Example().exampleFn(); // SonarQube error typescript:S3735
  }
}

SonarQube for IDE 11.3.1.82568 in WebStorm

Hello @stepanov.daniil,

I’m not able to reproduce. Can you please share the analysis debug logs from SonarQube IDE?

If you have a non-default tsconfig.json filename (tsconfig.app.json for example), please use the sonar property sonar.typescript.tsconfigPath to point to the correct tsconfig file.

Cheers

Yes, of course, here is the log and the tsconfig (has default filename)

[2025-10-23T14:41:13.839] [sonarlint-analysis-scheduler] INFO org.sonar.iac.kubernetes.plugin.SonarLintFileListener - Module file event for MODIFIED for file [uri=file:///C:/DEV/MIS/validation-ui/src/test.ts] has been ignored because it’s not a Kubernetes file.
[2025-10-23T14:41:13.843] [sonarlint-analysis-scheduler] INFO sonarlint - Starting analysis with configuration: [
baseDir: C:\DEV\MIS\validation-ui
extraProperties: {sonar.js.internal.bundlePath=C:\Users\stepa\AppData\Roaming\JetBrains\WebStorm2025.2\plugins\sonarlint-intellij\plugins\eslint-bridge, sonar.typescript.tsconfigPath=src/tsconfig.json}
activeRules: [13 kubernetes, 264 python, 24 css, 113 kotlin, 30 secrets, 329 javascript, 26 docker, 28 ruby, 46 Web, 14 xml, 155 php, 7 terraform, 342 typescript, 7 cloudformation]
inputFiles: [
file:///C:/DEV/MIS/validation-ui/src/test.ts (UTF-8)
]
]

[2025-10-23T14:41:13.902] [sonarlint-analysis-scheduler] INFO sonarlint - Index files
[2025-10-23T14:41:13.902] [Report about progress of file indexation] INFO sonarlint - 1 file indexed
[2025-10-23T14:41:13.914] [sonarlint-analysis-scheduler] INFO org.sonar.iac.common.extension.IacSensor - There are no files to be analyzed for the Docker language
[2025-10-23T14:41:13.914] [sonarlint-analysis-scheduler] WARN sonarlint - No workDir in SonarLint
[2025-10-23T14:41:13.919] [nodejs-stream-consumer] INFO org.sonar.plugins.javascript.bridge.BridgeServerImpl - Resolving provided TSConfig files using ‘C:/DEV/MIS/validation-ui/src/tsconfig.json’
[2025-10-23T14:41:14.017] [nodejs-stream-consumer] INFO org.sonar.plugins.javascript.bridge.BridgeServerImpl - Found 1 tsconfig.json file(s): [C:/DEV/MIS/validation-ui/src/tsconfig.json]
[2025-10-23T14:41:14.018] [nodejs-stream-consumer] INFO org.sonar.plugins.javascript.bridge.BridgeServerImpl - 1 source file to be analyzed
[2025-10-23T14:41:14.018] [nodejs-stream-consumer] INFO org.sonar.plugins.javascript.bridge.BridgeServerImpl - 1/1 source file has been analyzed
[2025-10-23T14:41:14.018] [sonarlint-analysis-scheduler] INFO org.sonar.plugins.javascript.analysis.cache.CacheReporter - Hit the cache for 0 out of 1
[2025-10-23T14:41:14.018] [sonarlint-analysis-scheduler] INFO org.sonar.plugins.javascript.analysis.cache.CacheReporter - Miss the cache for 1 out of 1: RUNTIME_API_INCOMPATIBLE [1/1]
[2025-10-23T14:41:14.018] [sonarlint-analysis-scheduler] INFO org.sonar.plugins.javascript.analysis.CssRuleSensor - No CSS, PHP, HTML or VueJS files are found in the project. CSS analysis is skipped.
[2025-10-23T14:41:14.018] [sonarlint-analysis-scheduler] INFO org.sonar.plugins.common.TextAndSecretsSensor - Available processors: 12
[2025-10-23T14:41:14.018] [sonarlint-analysis-scheduler] INFO org.sonar.plugins.common.TextAndSecretsSensor - Using 12 threads for analysis.
[2025-10-23T14:41:14.019] [sonarlint-analysis-scheduler] INFO org.sonar.plugins.common.TextAndSecretsSensor - Start fetching files for the text and secrets analysis
[2025-10-23T14:41:14.019] [sonarlint-analysis-scheduler] INFO org.sonar.plugins.common.TextAndSecretsSensor - Retrieving all except binary files
[2025-10-23T14:41:14.019] [sonarlint-analysis-scheduler] INFO org.sonar.plugins.common.analyzer.Analyzer - Starting the text and secrets analysis
[2025-10-23T14:41:14.019] [Progress of the text and secrets analysis] INFO org.sonar.plugins.common.MultiFileProgressReport - 1 source file to be analyzed for the text and secrets analysis
[2025-10-23T14:41:14.019] [Progress of the text and secrets analysis] INFO org.sonar.plugins.common.MultiFileProgressReport - 1/1 source file has been analyzed for the text and secrets analysis
[2025-10-23T14:41:14.019] [sonarlint-analysis-scheduler] INFO sonarlint - Analysis detected 3 issues and 0 Security Hotspots in 176ms

tsconfig.json (915 Bytes)

Oh, I think you need the full log from the moment SonarQube starts. Here it is

sonarqube-log.txt (13.6 KB)

Hi @stepanov.daniil,

is the file containing the class included or reachable in that tsconfig.json file? I see you only have the entry point in the files property. Looks like the file is being analyzed without type-checking.

Yes, that was indeed the problem. Thanks a lot! I split the config, a main tsconfig.json for all files to check types, and an inherited tsconfig.app.json for builds.

2 Likes

Any update?