When updating bindings, the plugin successfully downloads all dependencies, starts TS Server and starts checking one file that is open. But the check of this file lasts indefinitely, until I kill the NodeJs process.
When checking the .js files everything goes fine, the problem is only with .ts and .tsx files
My colleague checked this on his computer, he has the same problem
In the console I see the following:
In the console I see the following:
SonarTS Server is started
SonarTS Server connected to 52718
Server started on 64120
No analysis configurators found
Using connection âSonarâ for project âreactâ
Analysing âindex.tsxââŚ
This is a private project of my company, unfortunately I can not share the code of this project, but I have created a project for you which reproduces the problem described by me.
I see it now but based on the traces I see in the logs, I suspect your SonarQube does not use the latest version of the JS/TS analyzer:
Starting SonarTS server
SonarTS has been deprecated recently and replaced by the SonarJS plugin. Could you try updating the plugins used by your SQ server ? You can try to install the latest SonarJS (7.1) and remove SonarJS.
This could help fix the problem directly, and if not at least we will try to investigate on an actively maintained plugin.
This may be a problem for me.
I work for a large company and it is unlikely that they will be able to quickly change the plugin versions, as this may affect other projects.
What do you mean ? ( You can try to install the latest SonarJS (7.1) and remove SonarJS. )
Sorry, it was a typo. I meant that you can try to install latest SonarJS (that replaces SonarTS) and uninstall SonarTS.
I didnât reproduce using your test project.
Out of curiosity, could you try to analyze your test project without connecting it to SonarQube ? And with the latest version of SonarLint (4.13, that you may already have). It should normally use the latest SonarJS version embedded in the plugin, and I would like to see if a similar problem occurs.
Ok so in this case the analysis finished, itâs a different behavior than the original error you reported, when you were connected to the server.
I managed to get issues though. One useful thing you can do when the plugin does not behave correctly is to activate more logs. See here for an explanation.
In this case there were several problems with your tsconfig.json file:
the âjsxâ option was not permitted (âreact-jsxâ). You have to use âreactâ. This trace appears in the extended logs.
the files at the root level were not detected for analysis because they were not declared. You have to add
âfilesâ: [
âbug.tsâ,
âindex.tsxâ
],
I guess this second point only applies for your reproducer project though.
Could you try to activate verbose logs, change this âjsxâ setting in the tsconfig.json file, and retry on your project, with or without connecting it to your SonarQube ?
Thank you so much, Damien Urruty
Changing the tsconfig.json file helped me
I reconnected to my SonarQube server, but thanks to Verbose output and Analysis logs, I saw that the error was in
âjsxâ: âreact-jsxâ
the default value react puts, I changed it to
âjsxâ: âreactâ
and everything worked.
Happy new year and all the best to you
Now everything works fine, but I noticed that SonarLint write Found 0 issues for all tests files in the src/tests folder
There are files with the extension: *.test.ts, *.test.tsx
I tried adding a âincludeâ rule to tsconfig for these files, but it didnât help
React 17 requires âjsxâ: âreact-jsxâ, without this rule it will not run, you need to fix this problem in your plugin, otherwise users will constantly have to manually change this rule to check Sonar
Trigger: ACTION
[Action] 1 file(s) submitted
No analysis configurators found
Using connection â[HIDED]â for project â[HIDED]â
Analysing â[HIDED].test.tsxââŚ
Starting analysis with configuration:
[
projectKey: [HIDED]
baseDir: [HIDED]
extraProperties: {}
inputFiles: [
file:///[HIDED].test.tsx (UTF-8) [test]
]
]
Start analysis
Index files
Language of file âfile:///[HIDED].test.tsxâ is detected to be âTypeScriptâ
1 file indexed
Available languages:
Scala => âscalaâ
Python => âpyâ
Java => âjavaâ
HTML => âwebâ
JSP => âjspâ
XML => âxmlâ
Kotlin => âkotlinâ
PHP => âphpâ
TypeScript => âtsâ
JavaScript => âjsâ
Ruby => ârubyâ
Quality profiles:
java: âSonar way extendedâ (492 rules)
js: âSonar way Recommendedâ (128 rules)
jsp: âSonar wayâ (0 rules)
kotlin: âSonar wayâ (30 rules)
php: âSonar wayâ (87 rules)
py: âSonar wayâ (31 rules)
ruby: âSonar wayâ (29 rules)
scala: âSonar wayâ (28 rules)
ts: âSonar way recommendedâ (112 rules)
web: âSonar wayâ (18 rules)
xml: âSonar wayâ (4 rules)
âJavaSquidSensorâ skipped because there is no related file in current project
âScala Sensorâ skipped because there is no related file in current project
âPython Squid Sensorâ skipped because there is no related file in current project
Execute Sensor: JavaXmlSensor
âHTMLâ skipped because there is no related file in current project
âXML Sensorâ skipped because there is no related file in current project
âKotlin Sensorâ skipped because there is no related file in current project
âPHP sensorâ skipped because there is no related file in current project
âAnalyzer for âphp.iniâ filesâ skipped because there is no related file in current project
âContextual SonarTSâ skipped because there is no related file in current project
âSonarJSâ skipped because there is no related file in current project
âESLint-based SonarJSâ skipped because there is no related file in current project
âRuby Sensorâ skipped because there is no related file in current project
Done in 24ms
The âreact-jsxâ option has been introduced in the Typescript 4.1 version, which I assume you are using. The JS analyzer embeds Typescript 3.8.3, thatâs why it doesnât understand the option and can not run the analysis. We plan to update Typescript to the latest version, but we donât have an ETA.
One possible temporary workaround would be to duplicate your existing tsconfig.json file. You could then change the âjsxâ property to use âreactâ, and tell the analyzer to use this new tsconfig.json, by using the sonar.typescript.tsconfigPath property. You can configure this value with the scanner as any other property or through SonarLint in Settings > Tools > SonarLint > Project Settings > Analysis properties.
Iâm afraid we canât provide a better alternative for the moment.
About your test files that are not analyzed, using the include should be sufficient (it works for me). It might be related to use of SonarTS, do you observe the same problem when not connected to SonarQube ? Was your company able to update the plugins on SonarQube side ?