I have spent quite some time to figure out why sonarqube is not taking into account my typescripts (ts) files for my angular project. I use Sonarqube enterprise 8.9.6 and my project is based on angular 13 which needs Node 16.
The strange logs I have running sonar-scanner are the following :
15:24:51 INFO: Found 1 tsconfig.json file(s): [/workspace/.../my-project/tsconfig.json]
15:24:51 ERROR: Unknown compiler option 'noImplicitOverride'.
15:24:51 INFO: Skipping 21 files with no tsconfig.json
15:24:51 INFO: 21 source files to be analyzed
15:24:51 INFO: 21/21 source files have been analyzed
And If I active the sonar-scanner debug log level (-X or sonar.log.level=DEBUG), there is a message for each ts file of my sources : /src/app/app.component.ts matched NO_CONFIG
After searching for a few days without success, I finally managed to make it work.
Here are the 2 solutions I found :
1/ Remove the config value “noImplicitOverride”: true from the tsconfig.json
I do not like it too much because it may introduce bad practice in the angular code
2/ Create a specific tsconfig.sonar.json file for sonar analysis :
The tsconfig.sonar.json is very simple and contains only this :
Thanks for bringing this up and sharing your results
We are tracking tsconfig.json issues. As you found out, we added recently the possibility to create wildcards for tsconfig.json. But we are looking to make this work out of the box.
Good news for noImplicitOverride, we already support the latest TypeScript in the latest SQ version which is 9.7.1. Since you are in the SQ LTS stream, you should benefit from this in the upcoming release.
Regarding the NO_CONFIG, could you share a bit of your project structure?
Where are your tsconfig.json files? Could you share their content?
Hi @gabriel.vivas ,
The structure of my project is really basic as an Angular project with the default tsconfig.json and inherited tsconfig.app.json, tsconfig.doc.json at the root of the project, all generated by angular CLI.
The angular components and typescript are then in the src directory.
Here it is :
My point of view is that the NO_CONFIG message is just the consequence of Sonar scanner falling on the error of the noImplicitOverride. Because, I tried to add the “include”: [“src/**/*.ts”] in tsconfig.json or tsconfig.app.json and it did not resolve the problem.
The only solutions I found is to either remove the noImpliciteOverride or add a dedicated tsconfig.sonar.json and I finaly did the 2nd option.