Sonar property used: -Dsonar.typescript.eslint.reportPaths=“ref to my eslint report”
Content of the elint report file:
<jslint>
<file name="C:\Tools\Jenkins\workspace\FunctionalTesting\MyProject\app\src\indexOne.js">
<issue reason="Expected indentation of 4 spaces but found 2. (indent)" evidence=" super(props);" char="1" line="7"/>
<issue reason="Expected indentation of 4 spaces but found 2. (indent)" evidence=" this.state = {};" char="1" line="8"/>
<issue reason="Expected indentation of 4 spaces but found 1 tab. (indent)" evidence=" const {title} = this.props;" char="1" line="12"/>
<issue reason="'title' is assigned a value but never used. (no-unused-vars)" evidence=" const {title} = this.props;" char="9" line="12"/>
<issue reason="img elements must have an alt prop, either with meaningful text, or an empty string for decorative images. (jsx-a11y/alt-text)" evidence=" <img src=""/>" char="7" line="14"/>
<issue reason="Expected indentation of 0 spaces but found 2. (indent)" evidence=" };" char="1" line="27"/>
</file>
</jslint>
But I dont see the report imported into Sonarqube, rather it shows the eslint findings by using SonarTS plugin. But none of the findings from the above file are imported. Is there anything I am missing?
the imported report should be in json format, you can set it using -f json when launching ESLint.
Also from the report it seems that you are linting JS file, SonarTS will only show issues on TypeScript files. We plan to implement import of ESLint issues also for JS files, but this is not done yet (see MMF-1231 )
I have used some external plugins to generate the file in json format and I am going to use SonarQube just to import the file using sonar.typescript.eslint.reportPaths=report.json file. data.txt (3.5 KB)
File is attached with this (changed extension to .txt from .json) . But it is not working.
bat "${sonarScanner} -Dsonar.sources=${sonarSource} -Dsonar.host.url=${sonarQubeURL} -Dsonar.projectKey=${sonarProjectKey} -Dsonar.projectName=${sonarProjectKey} -Dsonar.projectVersion='6' -Dsonar.typescript.eslint.reportPaths=${jsonReport}"
${jsonReport} --> Points to the path of the file data.txt
INFO: Sensor SonarTS [typescript]
ERROR: No tsconfig.json file found for [file:///C:/Tools/Jenkins/workspace/FunctionalTesting/\myproject/App/src/indexOne.ts] (looking up the directories tree until project base directory [C:\Tools\Jenkins\workspace\FunctionalTesting]). This file will not be analyzed.
Actually, I dont have tsconfig.json file. I just wanted to try to import the attached data.txt file.