harsha509
(Sri Harsha)
June 1, 2023, 8:22am
1
sonar fails on adding allowImportingTsExtensions
in tsconfig.json. it skips all ts file for scanning.
log: (due to project guidelines cannot paste complete log in here) but below is the sample
INFO: Creating TypeScript program
NFO: TypeScript configuration file /builds/automation/tsconfig.json
INFO: 209 source files to be analyzed
ERROR: Error: Unknown compiler option ‘allowImportingTsExtensions’.
and sonar fails to scan all src ts files
ganncamp
(G Ann Campbell)
June 2, 2023, 1:52pm
2
Hi,
Welcome back.
What’s your SonarQube version?
Ann
harsha509
(Sri Harsha)
June 3, 2023, 5:38am
3
HI,
its Developer Edition - Version 10.0 (build 68432)
1 Like
ganncamp
(G Ann Campbell)
June 5, 2023, 1:21pm
5
Hi,
Thanks for the update. I’ve flagged this for the language experts.
Ann
harsha509
(Sri Harsha)
June 9, 2023, 5:33am
6
Thanks Ann,
Do we have any workaround for now ?
saberduck
(Tibor Blenessy)
June 9, 2023, 8:30am
7
Hi,
this happens because we don’t yet support TypeScript 5. We should release it in a couple of days. If you need a workaround urgently, you could create another tsconfig file without this option, which would be used only for analysis.
harsha509
(Sri Harsha)
June 14, 2023, 3:32pm
9
Hi,
Thanks for the inputs. Creating separate tsconfig is for sonar not an option for us currently!
may be I will wait for the Sonar release, Could you please let me know when it will be released?
Thanks,
Sri
ganncamp
(G Ann Campbell)
June 14, 2023, 5:40pm
10
Hi Sri,
At the bottom of this page you can sign up to get notifications of new SQ releases.
HTH,
Ann
1 Like
Hello . Can you please help with this approach ? How should I configure SonarQube to use that second file ?
saberduck
(Tibor Blenessy)
January 24, 2024, 8:54am
14
hi @Davit_Sargsyan ,
use the sonar.typescript.tsconfigPaths
property, either in the config or the UI
2 Likes
@saberduck I’m adding this configuration to my sonar-project.properties . But it doesn’t work anyway
sonar.typescript.tsConfigPath=./tsconfig.sonar.json
sonar.typescript.tsConfigPath=tsconfig.sonar.json
sonar.typescript.tsConfigPaths=tsconfig.sonar.json
sonar.typescript.tsConfigPaths=./tsconfig.sonar.json
saberduck
(Tibor Blenessy)
January 25, 2024, 3:07pm
16
could you please share debug logs?
sure . please see attached . Seems like it still keeps reference to the original tsconfig.json file
INFO: 1167 source files to be analyzed
ERROR: Error: Unknown compiler option ‘allowImportingTsExtensions’.
ERROR: Failed to create program: Unknown compiler option ‘allowImportingTsExtensions’.
INFO: Creating TypeScript program (done) | time=82ms
INFO: Skipped 1167 file(s) because they were not part of any tsconfig (enable debug logs to see the full list)
INFO: 1167/1167 source files have been analyzed
ganncamp
(G Ann Campbell)
January 25, 2024, 6:43pm
18
Hi,
Could you please provide the full, verbose log? This guide will help you find them.
Thx,
Ann
gab
(Gabriel Vivas)
January 26, 2024, 8:41am
19
@Davit_Sargsyan is there a chance you are using an old version of SonarQube?
The compiler option allowImportingTsExtensions
was introduced in TypeScript 5.
TypeScript 5 has been supported since SonarQube 10.1 and SonarCloud at the same time, since June 2023.
You can see the docs for language support.
@ganncamp @gab thanks for your replies . I’ve resolved the problem with creating second tsconfig file . But now I’m facing to another issue . For some reasons SonarQube doesn’t see my coverage/lcov.info file
and here’s my conf file line for path
sonar.javascript.lcov.reportPaths=coverage/lcov.info
ganncamp
(G Ann Campbell)
January 26, 2024, 1:40pm
21
Hi,
I’m glad you worked through your initial problem. LCov is a new question & it deserves its own thread.
Ann