Parse error # JS + Sonar

Hey there,

Our team uses the project written in JavaScript. We use SonarQube 6.7.7 version, sonar-javascript-plugin 7.3.0.15071 version. Our aim is to make all the lines of code shown, but at that moment we have parse errors in some files containing private variables when the build is done. Therefore, we can`t see the lines of code in these files. We declare a private variable using ‘#’. It looks in the following way (a couple of examples):

[ERROR] Parse error at line 34 column 5:
34: #user = undefined;
^
[ERROR] Parse error at line 16 column 5:
16: #isFiring = false;

How can we improve that?

Thanks & Regards
Dmitry

Hey Dmitry,

The maximum compatible version of our Javascript analyzer with SonarQube v6.7.7 is far less than v7.3 (for comparison, the maximum supported version for SonarQube v7.9 LTS is v6.2.2 (see our Plugin Version Matrix. If you wish to use the latest versions of our analyzers, you should update to the latest SonarQube version (right now, v8.8).

Regardless, the issuee you face is probably the same one as here: SonarJS fails parsing a file: Unexpected character '#'

We need to switch a dependency but ran into some issues. I’ll ping internally to see if it’s a topic we plan to look at it again soon (such as before our upcoming LTS).

Thanks!

Hi Colin,

Is there any news related to this issue?

I checked the question you sent above, they are not quite as similar as I thought.

You mean that sonar.version should be v7.9 and sonar-javascript-plugin should be v6.2.2, right?
If yes, I changed it but it doesn’t solve the problem.

*v6.2.2 *It is the maximum supported version with SonarQube v7.9 LTS (the minimum supported version of SonarQube). Never said it would solve the problem. :slight_smile:

It looks like we are working on SonarSource/SonarJS #2225 in an ongoing sprint, so hopefully, there will be some resoelution before the 8.9 LTS.