Error when scanning Typescript app in Azure DevOps

When running a create-react-app (React 17) using the Microsoft-hosted agent SonarQubeAnalyze@5, I get the following error:

[ERROR: Argument for ‘–jsx’ option must be: ‘preserve’, ‘react-native’, ‘react’.]

I have seen other topics with the same issue and it’s mentioned that the issue is fixed in the latest release, but I still see the problem.

Hey there.

What version is your SonarQube server?

From CI logs Version 5.1.0:

Starting: SonarQubeAnalyze
==============================================================================
Task         : Run Code Analysis
Description  : Run scanner and upload the results to the SonarQube server.
Version      : 5.1.0
Author       : sonarsource
Help         : Version: 5.1.0. This task is not needed for Maven and Gradle projects since the scanner should be run as part of the build.

[More Information](http://redirect.sonarsource.com/doc/install-configure-scanner-tfs-ts.html)
==============================================================================
/home/vsts/work/_tasks/SonarQubeAnalyze_6d01813a-9589-4b15-8491-8164aeb38055/5.1.0/sonar-scanner/bin/sonar-scanner
INFO: Scanner configuration file: /home/vsts/work/_tasks/SonarQubeAnalyze_6d01813a-9589-4b15-8491-8164aeb38055/5.1.0/sonar-scanner/conf/sonar-scanner.properties
INFO: Project root configuration file: NONE
INFO: SonarScanner 4.6.2.2472
INFO: Java 11.0.13 Eclipse Adoptium (64-bit)
INFO: Linux 5.11.0-1027-azure amd64
INFO: User cache: /home/vsts/.sonar/cache
INFO: Scanner configuration file: /home/vsts/work/_tasks/SonarQubeAnalyze_6d01813a-9589-4b15-8491-8164aeb38055/5.1.0/sonar-scanner/conf/sonar-scanner.properties
INFO: Project root configuration file: NONE
INFO: Analyzing on SonarQube server 8.4.2

Hey there.

This is an EOL version of SonarQube – you should upgrade to (at a minimum) SonarQube v8.9 LTS, where Typescript 4.1 is supported.

I’m sorry I wasn’t being clear. I’m using the SonarQube plugin from the Visual Studio marketplace SonarQube - Visual Studio Marketplace to run the SonarQubePrepare@5, SonarQubeAnalyze@5, and SonarQubePublish@5 tasks in Azure DevOps Pipelines. I think my question should’ve been, does the plugin support the minimum version of SonarQube server that supports Typescript 4.1?

@Colin
Any updates?

Hey @jlin5

As mentioned – you will need to use at least SonarQube v8.9.0 to analyze Typescript 4.1 code. The latest version of the Extension for Azure DevOps supports this version of SonarQube.

I see. I didn’t realize that the SonarQube plugin depended on the version that the SonarQube project was built. The tasks worked once I updated the SonarQube project version.

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.