woldner/VisualLinter

Setting for using global eslint seems broken

Closed this issue · 8 comments

Installed product versions

  • Visual Studio: 2017 Professional
  • This extension: 1.0.238

Description

I installed eslint globally, and marked the global option in the Visual Studio configuration, but the output panel from VisualLinter says "fatal: no local eslint config found". I rebooted my PC but get the same result. Would I have better results if I removed eslint and reinstalled non-globally?

Steps to recreate

  1. use npm to install eslint globally
  2. in Visual Studio, for VisualLinter, mark the global option
  3. open a JavaScript file
  4. note the output panel from VisualLinter says "fatal: no local eslint config found"

Current behavior

It does not seem to honor the global setting.

Expected behavior

Honor the global setting, so that when set the global installation of eslint is used.

Thank you for the feedback @fspafford

If you want to get started with the extension fast then switching to the local variant should help since all options are set to default false.

However with that said I would like to get to the bottom of this problem:

Have you tried unchecking/checking the option again after you first received the "local" error message?

I am planning on adding a verbose logging option that will log to the output window when an options value is changed. This will help determine if the option is actually set or not.

I'll update this issue once a version with verbose logging is available for you to test.

You are welcome!

I have tried unchecking/checking the option, and see the same behavior.

@fspafford I've pushed a new version (1.0.240) of VisualLinter to the Marketplace which should be available for download in a minute.

This new update adds a new option Enable verbose logging under
Tools -> Options... -> VisualLinter -> Advanced, please see below:

verboselogging

Once this option is checked, click OK to save the options and re-open the options window using
Tools -> Options... and all the option values of the view you're standing on (either General or Advanced should be logged in the output window.
Remember to clear the output window between opening the options window.

If you check the Use global ESLint installation instead of local and click OK, is the value for property UseGlobalEslint set to true?

Yes.

The output is:
[GetPropertyValue] ShouldOverrideEslint value is False
[GetPropertyValue] EslintOverridePath value is
[GetPropertyValue] ShouldOverrideEslintConfig value is False
[GetPropertyValue] EslintConfigOverridePath value is
[GetPropertyValue] ShouldOverrideEslintIgnore value is False
[GetPropertyValue] EslintIgnoreOverridePath value is
[GetPropertyValue] EnableVerboseLogging value is True
[GetPropertyValue] UseGlobalEslint value is True
[GetPropertyValue] EnableHtmlLanguageSupport value is False
[GetPropertyValue] EnableJavaScriptLanguageSupport value is True
[GetPropertyValue] EnableReactLanguageSupport value is False
[GetPropertyValue] EnableVueLanguageSupport value is False
[GetPropertyValue] UsePersonalConfig value is False
[GetPropertyValue] DisableEslintIgnore value is False

Ok that's good. Now we'll have to see what value is used when actually linting.
I'll test using your options and see if I can reproduce it on my end, otherwise I'll have to push an update for you to test. I'll update here once it's available.

Still unable to reproduce on my end, but I've pushed a new version (1.0.241) to the Marketplace which should be available in just a minute. I've changed the name of the option so you'll need to re-enable it under Advanced options.

Ensure that option UseGlobalEslint is true when you open options (as you did previously), then save a javascript file you want to lint in Visual Studio. The output window should then have information for you to post back here!

I tried the new version, and here is my output:

fatal: no local eslint config found
[GetPropertyValue] ShouldOverrideEslint is False
[GetPropertyValue] EslintOverridePath is
[GetPropertyValue] ShouldOverrideEslintConfig is False
[GetPropertyValue] EslintConfigOverridePath is
[GetPropertyValue] ShouldOverrideEslintIgnore is False
[GetPropertyValue] EslintIgnoreOverridePath is
[GetPropertyValue] ShowDebugInformation is True
[GetPropertyValue] UseGlobalEslint is False
[GetPropertyValue] EnableHtmlLanguageSupport is False
[GetPropertyValue] EnableJavaScriptLanguageSupport is True
[GetPropertyValue] EnableReactLanguageSupport is False
[GetPropertyValue] EnableVueLanguageSupport is False
[GetPropertyValue] UsePersonalConfig is False
[GetPropertyValue] DisableEslintIgnore is False
[GetPropertyValue] DisableEslintIgnore is False
[GetPropertyValue] EnableHtmlLanguageSupport is False
[GetPropertyValue] EnableJavaScriptLanguageSupport is True
[GetPropertyValue] EnableReactLanguageSupport is False
[GetPropertyValue] EnableVueLanguageSupport is False
[GetPropertyValue] UseGlobalEslint is True
[GetPropertyValue] UsePersonalConfig is False
[GetPropertyValue] ShouldOverrideEslint is False
[GetPropertyValue] EslintOverridePath is
[GetPropertyValue] ShouldOverrideEslintConfig is False
[GetPropertyValue] EslintConfigOverridePath is
[GetPropertyValue] ShouldOverrideEslintIgnore is False
[GetPropertyValue] EslintIgnoreOverridePath is
[GetPropertyValue] ShowDebugInformation is True
ShouldOverrideEslint: False
UseGlobalEslint: True
using eslint @ C:\Users\franks\AppData\Roaming\npm\eslint.CMD
ShouldOverrideEslintConfig: False
UsePersonalConfig: False
fatal: no local eslint config found
ShouldOverrideEslint: False
UseGlobalEslint: True
using eslint @ C:\Users\franks\AppData\Roaming\npm\eslint.CMD
ShouldOverrideEslintConfig: False
UsePersonalConfig: False
fatal: no local eslint config found

Does the last line above indicate my problem?

Regards,
Frank

Hi @fspafford
Yep! that's exactly it, and should definitely be clarified, because:

You've told the extension to use a global ESLint installation (eg npm install eslint --global) but using a local ESLint config, is still default unless Use personal ESLint config instead of local is checked (value true) in options.

I'll update the notes section of the readme to include this information for future reference.
Thank you for your contribution Frank!