1

I am currently using sonarqube for codecovergae.Karma and jasmine as testing tool. Due to project complexity and dependency, i m using babel transpiler to convert ts to es5.

I am able to configure sonar-qube. However i am getting code smell like Replace "var" with "let" or "const". I check sonar configuration. I didnt find anything where i can set ecmascript version just like "sonar.java.source=1.6" My current configuration:

sonar.host.url=http://sonar.dev.***.com
sonar.projectKey=org.sonarqube:some-key
sonar.projectName=Project name
sonar.projectVersion=1.0
sonar.language=js
sonar.sources=temp/src
sonar.sourceEncoding=UTF-8
sonar.javascript.lcov.reportPath=coveragereports/coverage/lcov.info

Please help.

xdeepakv
  • 7,835
  • 2
  • 22
  • 32

1 Answers1

0

There is no way to set JS version in SonarJS. It parses all versions, and for rules by default only rules making sense for all versions are enabled. Probably you enabled Replace "var" with "let" or "const" manually. Just disable it in SQ UI.

Elena Vilchik
  • 1,085
  • 6
  • 11
  • I m using typescript, angular 4 to write code. However, for testing we are using karma, jasmine. Which compile typescript to es5 while testing. when I am integrating sonarjs with that. It looking all file in es2017. I want to know, is there any way to config – xdeepakv Jan 23 '18 at 10:04
  • If you write in typescript, you should use SonarTS (not SonarJS). See this thread https://stackoverflow.com/questions/48383149/sonarqube-scanning-process-ignores-lcov-info, may be it will help you. And again, to configure rules, go to SQ UI and deactivate the one you don't like – Elena Vilchik Jan 23 '18 at 12:50
  • Aiyo!!.. I know all these plugin. I mention "Due to project complexity and dependency", I have to use convert ts to "js". Anyways, thanks for help. – xdeepakv Jan 23 '18 at 13:39
  • This should be configurable per project settings. Current sonar lint in PhpStorm ignores eslint settings and explicit ES5 code style, keeps displaying unhelpful "replace var with let or const" warnings. – Ingo Steinke Aug 07 '23 at 19:28