Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Investigate supporting the NodeJS based-version of SonarJS #1188

Closed
4 tasks
duncanp-sonar opened this issue Jan 8, 2020 · 5 comments
Closed
4 tasks

Investigate supporting the NodeJS based-version of SonarJS #1188

duncanp-sonar opened this issue Jan 8, 2020 · 5 comments

Comments

@duncanp-sonar
Copy link
Contributor

Description

The SonarJS plugin shipped in SLVS has not been updated for some time so users are not benefiting from the latest and greatest analysis rules.

However, the SonarJS plugin has changed so that it now requires NodeJS to run some of the rules (and more rules will be migrated from the Java to the NodeJS implementation going forward).

TODO

  • investigate whether NodeJS ships with VS: which version of NodeJS, which versions of VS
  • if so, can we reliably locate the NodeJS used by VS?
  • if not, can we install a version ourselves? (size, licensing, complexity etc)
  • investigate the performance/UX impact of the new version of the plugin.
@duncanp-sonar duncanp-sonar changed the title Investigation support of the NodeJS based-version of SonarJS Investigate supporting the NodeJS based-version of SonarJS Jan 8, 2020
@bernieatwar
Copy link

What's the ETA for the support of the NodeJS Based version of SonarJS? My comment stems from #921. I have warnings show up on our Azure Pipelines Builds and would love to find a way around this. Thanks a lot
azure-devops

@duncanp-sonar
Copy link
Contributor Author

@bernieatwar, changes in SonarLint won't have any impact on your Azure Pipeline builds.
The version of SonarJS used in the Azure build is the one from SonarQube/SonarCloud. If you are using SonarQube then you can upgrade the SonarJS plugin yourself (although make sure you read the release notes first since clearly the requirements for running the plugin have changed).

If you need more info, please open a thread in the community forum.

@bernieatwar
Copy link

Ohhh indeed, very good point. I'll check it out. Thanks @duncanp-sonar!

@H4CKS4F3
Copy link

H4CKS4F3 commented Mar 4, 2020

For what it's worth, I believe since VS 2017 (perhaps earlier, too?), VS has shipped "external tools." I'm now running 2019, and the location of the external tools is located at C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\Web\External.

These can be configured via Tools > Options:
image

My VS Version:
image

My default set of packages (in .\node_modules\.bin):

  • bower
  • cake
  • coffee
  • coffeelint
  • csslint
  • grunt
  • nopt
  • rimraf
  • strip-json-comments

Although I didn't see node or npm in there, there is a vs-task-server folder with a npm-commands.js file that appears to ensure npm is available and loaded.

@peter-dolkens
Copy link

VS will ship node only if it is selected in one of the installation packs.

If VS ships node, it installs a local copy, and loads it into the PATH of the running process from VSInstalledExternalTools

Importantly though - you can't just browse there - you need to obey the ordering of external web tools (which can be found under Tools > Options). This order is set in Windows Registry, though the exact location moves between versions, the rough location is:

HKCU\Software\Microsoft\VisualStudio\14.0\ApplicationPrivateSettings\Microsoft\VisualStudio\Web\PackageManagement\ExternalTools\ExternalToolsOptionsPage

Given all this, I suggest simply running node -v and parsing the result, then installing a portable version of node into a .node or similar folder should a copy not already exist.

You may also want to run npm -v and do the same.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants