I am trying to migrate from SonarQube 6.7.7 to SonarQube 7.9.1
Sorry, could you please provide me the details about how to create this esLint report?
Thank you so much @saberduck
I wil try it out
I have tried this command, but it failed to create report.json. So I try to find other command which is “npm i eslint -f json > test.json” and it has successfully created the report but I can’t import it to SonarQube.
Do you know why? Thank you
Please provide some details, what are you trying to do (which commands you are executing), and what is the output (logs).
I am trying to create esLint Report and import the report to SonarQube 7.9.1.
Based on your suggestion, I try to create the report this command using eslint -f json -o report.json . I got this error log.
Then I found another command from other sites which is npm i eslint -f json > test2.json , the report is created. Here is the report that has been created using this command.
But when I try to import that report, it failed. Here is the log.
What should I do?
I think you are mixing some things. Command
npm i eslint is actually using npm package manager to install eslint into your project. Once you have installed it, you should not launch
npm i eslint, because that would just install it again.
You need to run eslint, to run locally installed package you can use
npx eslint -f json > report.json
Also have a look at eslint documentation here https://eslint.org/docs/user-guide/getting-started
From your suggestion, I use this command “npx eslint -f json > report.json” and just get result as shown below :
Any idea? I just scan one file.js in this case.
Do you mind to share your example project that has been successfully scanned using your command? Thank you.
@fanny_tan, sorry command I gave you was incorrect, I copy&pasted wrong part from the previous post. It should be like written in the doc
npx eslint -f json -o report.json file.js (replace file.js with your file, or directory)
Also, please study documentation on eslint, https://eslint.org/docs/user-guide/getting-started , it will help you troubleshoot issues like this.
Okay, thank you very much, I will try it out and notify you soon about the result
I have scanned the file.js with eslint and I got a json file result that contains issues. The next step is importing external issues to SonarQube 7.9 with this command “.\sonar-scanner -Dsonar.eslint.reportPaths=path-to-report.json”, but the scanner said like shown below :
I expect all violation that has been found in report.json should be imported to SonarQube and I can view it on Issues list, but it didn’t. Instead, it clear up all issues that has been scanned before using SonarQube scanner.
A post was split to a new topic: Where to see eslint reports
Same with me!Do you solved?