Ts and tsx files are not getting analysed by Sonarqube via Github actions for master branch analysis

Which versions are you using (SonarQube, Scanner, Plugin, and any relevant extension)

Sonarqube CE 8.9 LTS
Typescript version used in project is 4.8
Sonar scanner run via this Github action: GitHub - SonarSource/sonarqube-scan-action

What are you trying to achieve

I’m trying to run sonarqube scanner on PR and master branch for a web app written in typescript and javascript.

Problem: ts and tsx files are getting analysed for PR (branch) analysis but when the analysis is run on master branch the ts and tsx files are shown as un-analysed.

code from a PR

code from master branch

What have you tried so far to achieve this**

Sample action for master branch analysis:

    runs-on: ubuntu-latest
    needs: [lint, test]
      - uses: actions/checkout@v2
          fetch-depth: 0
      - name: SonarQube Scan
        uses: SonarSource/sonarqube-scan-action@v1.1.0
          SONAR_TOKEN: XX
          SONAR_HOST_URL: XX
          args: >

We have also ensured that tsconfig.json has the necessary includes

 "include": [

Don’t know what’s going wrong.

The issue was related to an option useUnknownInCatchVariables that was being used as compiler option in tsconfig.json.

When the scanner was run in debug mode an error was being thrown due to which tsx files were not getting scanned.

06:09:36.583 INFO: Using /github/workspace/./tsconfig.json from sonar.typescript.tsconfigPath property
06:09:36.744 ERROR: Unknown compiler option 'useUnknownInCatchVariables'.

Based on TypeScript: useUnknownInCatchVariables compiler option causes main branch to show up empty - #4 by saberduck, we have to:

  • Either remove that option from tsconfig.json
  • Create a separate tsconfig.json without that option.
  • Upgrade sonarqube server to the latest version.
1 Like

Tagging @ganncamp because I really want to notify someone about this and take real actions. No where in the official sonarqube documentation it is mentioned that there’s a heavy dependency on tsconfig.json file in order to get typescript and javascript project scanned successfully. There are so many queries on this forum and stackoverflow where users were not able to get typescript and tsx files scanned but the docs remain unchanged. Why? This is not the first time when sonarqube docs failed to help.

Most of the times users have to rely on articles / blogs published on the internet by fellow users on onboarding to Sonarqube for different languages. Why can’t the Sonarqube documentation do that? What stops the documentation owners from doing it?

I think that is still fine but you can at least help by updating the docs to reflect missing information when your users take the time and effort to solve certain problem by hunting on the internet and sharing them in this sonarsource form.

1 Like

Hi @Abhijeet_Vaikar,

Per the FAQ, we ask that you not @ people not already involved in your thread.

Aaand… I’ll be honest & say your thread had been overlooked. So… thanks, sorry, and please don’t do that. :sweat_smile:

Since this has already been fixed, I’m not sure what action you’re expecting. You think the LTS docs should be updated? Are those the docs you were referring to?


Thanks for responding @ganncamp . Sorry for tagging you. I won’t tag anyone henceforth.

Yes, expectation is that the LTS documentation related to javascript or typescript languages should be updated with all the important information required to onboard a TS / JS based project on Sonarqube. Especially the missing info related to tsconfig.json files.

Do you accept community contributions into the documentation? are there any plans to open source these docs so that they get updated frequently by the community?

1 Like


Thanks for the input. I’ll ping the Docs team.

Regarding your question about contributions, thanks for your willingness, but we’re actually in the process of moving the docs out of the source code and into a CMS, so the opposite direction actually.


1 Like

Hi @ganncamp,

Thanks for alerting us to this. We’ve opened a ticket which we’ll process once SonarQube is on the new CMS (very soon).

@Christine_Curry is the DOC project private?