How does SonarQube 9.9LTS use tsconfigPaths

Hi I’m using SonarScanner with SonarQube 9.9LTS.

I’m pretty new to SonarQube and was wondering how SQ uses the tsconfigPaths property? From the DEBUG logs, I see that a Typescript program for each tsconfig.json specifed. Furthermore, it also looks at the config’s references to find other related tsconfig.json. Does the tsconfig.json have any other purpose than defining the directory where the Typescript program will be created for analysis?

The reason why I’m asking is in my project, I have many, many subdirectories with tsconfigs that reference many other tsconfigs that are outside the scope of my directory.

// example folder structure

/
  folder1
  folder2
    subdir1
    subdir2

I want to run analysis within folder2 and tsconfigs within subdir1 reference other tsconfigs in folder1.

Because of this out-of-scope reference, the sonar scan takes a long time. When I removed the references option in subdir1’s tsconfig, I found that the analysis within that directory was extremely fast. If tsconfigs have no other purpose other than specifying the directory to create a typescript program in, I’m thinking of creating a bare-bones tsconfig.sonar.json in the subdirs in tsconfigPaths instead.

Please let me know what you think! Thanks!

1 Like