TypeScript analysis fails to complete with compiler option "noImplicitOverride"

Hello,

I got an issue with SonarScanner where adding the compiler option “noImplicitOverride” breaks the analysis partly. SonarQube shows results for the analysis with 0 LOC and duplications although the same project version without this option does show values fitting the history.

Versions used
SonarQube Enterprise 8.9.0.43852
SonarScanner 4.5.0.2216
JavaScript/TypeScript Code Quality and Security 7.4.2.15501
Linux 5.4.0-1054-aws amd64
Java 1.8.0_292 Private Build (64-bit)
Node.js v12.22.2
Typescript 4.3.4

Error observed

10:59:35.114 INFO: Found 17 tsconfig.json file(s): [...censored...]
...
10:59:35.171 ERROR: Unknown compiler option 'noImplicitOverride'.
10:59:35.191 ERROR: Unknown compiler option 'noImplicitOverride'.
10:59:35.200 ERROR: Unknown compiler option 'noImplicitOverride'.
...
10:59:35.301 ERROR: Failed to parse tsconfig: /src (Cannot read file '/src'.)
10:59:35.302 ERROR: Cannot read file '/src'.
10:59:35.304 ERROR: Failed to parse tsconfig: /src (Cannot read file '/src'.)
...
10:59:35.343 INFO: Skipping 98 files with no tsconfig.json
10:59:35.343 DEBUG: Skipped files: 
...

Steps to reproduce
Configure a project with the “noImplicitOverride” option.

{
  "compilerOptions": {
    ...
    "noImplicitOverride": true
  }
}

And analyze with sonar-scanner:

sonar-scanner --debug -Dsonar.login=... -Dsonar.branch.name=master

Potential workaround
For now removing the compiler option fixed the analysis and everything was looking as expected again, including the analysis data in SonarQube.

Hello Damian,

Welcome to the SonarSource community, and thank you for your feedback!

The compiler option noImplicitOverride is available since TypeScript 4.3, and the JavaScript/TypeScript analyzer provided by SonarQube 8.9 does not support that version unfortunately. You will need to upgrade your setup to SonarQube 9.0.

As a side note, although you are using your own version of TypeScript locally, the JavaScript/TypeScript analyzer packages its own dependency and use it. This version may change from one version of SonarQube to another, which happens to be the case here.

Hope this helps,
Yassin

Hello Yassin,

thanks for your quick answer.

Currently we are relying on the LTS releases of SonarQube so without abandoning them completely there is no way to get a newer version in the coming 15 months according to the release schedule.

I would still consider this a bug as the analysis should not break completely with an unsupported version, or is the failure coming directly from the packaged compiler that you mentioned?

Would be great to have a way to get this working with newer versions and still keeping the LTS version.

Best regards,
Damian

1 Like

Hello @Yassin,

can you also tell where to find a bit more information about which SonarQube version supports which exact language versions?
Information is very hard to find and as far as I can see there is nothing official looking anywhere where we can be sure that our current and future planned TS versions will be supported.

Hello Damian,

Would be great to have a way to get this working with newer versions and still keeping the LTS version.

That’s a fair point. We’ll discuss this topic among ourselves and come back to you with an answer as soon as possible.

can you also tell where to find a bit more information about which SonarQube version supports which exact language versions?

The JS/TS analyzer documentation shipped by a particular SonarQube version, e.g. 8.9 LTS, is normally the right place to find such information, but I realize now that it’s not accurate enough. We’ll make sure to be more explicit about supported TypeScript versions with future SonarQube releases.

Hello Yassin,

Great, thanks. I’m looking forward for your answer.

Could you please elaborate the exact supported versions to me here or point to a source that I can use meanwhile?

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.