I am trying to migrate from SonarQube 6.7.7 to SonarQube 7.9.1
I tried to scan using esLint Scanner and the it run. But the result is not as expected. The codes is in javascript and it should have violation. Am I doing it wrong? How to scan with esLint scanner?
it’s not clear to me what you are trying to achieve. To scan JavaScript project, you should use SonarScanner , to import eslint issues, you should create the report and import it by setting sonar.eslint.reportPaths property.
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.
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.
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
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.