Refactor this redundant 'await' on a non-promise.sonarlint(javascript:S4123)

This very often show a false positive warning, using native async await functions

  • versions used (sonarlint vscode v1.22.0)
async function doSomething() {
   return someAsyncFunction();
}

async function main() {
  cont x = await doSomething();
}

You can also clearly see getTime(): Promise<any> just before the warning…

3 Likes

I too see this false positive frequently. Are there any updates form SonarSource?

Hello Araxeus!

Welcome to the community! Thanks for your question and good illustration. We currently investigating it. We will post more detailed answer once we will know more.

1 Like

FWIW, this issue is still present, I’m using sonarsource.sonarlint-vscode v2.0.0

In the mean time, this rule can be disabled using:

    "sonarlint.rules": {
        "javascript:S4123": {
            "level": "off"
        }
    }
1 Like

Hi,

We finally found the root problem, it’s specific to SonarLint, ticket is here → FP no-invalid-await on JS file in SonarLint · Issue #2636 · SonarSource/SonarJS · GitHub