Issues using SonarLint in VS2017 (NodeJs)

Hey there!

I’ve recently installed the SonarLint extension for Visual Studio Community 2017 and it sadly doesn’t seem to work very well in my Node.Js Project. I don’t seem to be able to toggle any rules so the only thing that’s currently showing up are when I’m forgetting a “let” statement before a variable assignment.

Inside some more “complex” Javascript files nothing show’s up at all and when I look at the output SonarLint produces it always throws a parsing error at try-catch blocks.
For example even this function can’t be parsed(verbose enabled) :function test() { try { console.log("hello") } catch{ console.log("oh no!") } }
But even when I comment the try-catch blocks out basically nothing shows up since there seems to be only one rule active.
I also have Visual Studio Code installed and if I use SonarLint there everything works perfectly. I can select and deselect rules and the code is being correctly parsed and the issues are being shown.

Is there something I’m doing wrong/that I’m missing?
I did enable JavaScript support, which I didn’t at first but now things are becoming a bit frustrating.

Thank you very much in advance for taking your time to read through this.
Any ideas/hints would be very much appreciated!

Hello, thank you for your feedback.

SonarLint for Visual Studio uses a version of our JavaScript analyzer which is quite old, much older than the one used by SonarLint for VS Code. This can explain why it has fewer rules and probably also why it fails to parse some JS constructs.

This old version of the JavaScript analyzer uses a Java-based parser which we maintained for a few years. This old front end had some limitations, and with the increasing speed of language changes, it had become difficult to keep up to date - which is why it was ultimately replaced in more recent versions with a Node-based front end (from the ESlint project).

Sadly however, SonarLint for Visual Studio hasn’t been updated yet to this new analyzer. You can follow the related issue on GitHub to get notified when we start tackling this issue. Please note that this is not one of the current top priorities.

In the meantime and since we consider VS Code as one of the top IDEs for JS, I can guarantee that we will keep SonarLint for VS Code as up-to-date as possible :slight_smile:

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.

Hello @TheBv ,
I am pleased to announce that the up-to-date support of JavaScript in Visual Studio has been released, I invite you to update to the latest version of SonarLint of Visual Studio.