woldner/VisualLinter

Visual Studio 1017 - No Local Eslint Found

Closed this issue · 9 comments

Installed product versions

  • Visual Studio: 2017 Enterprise Version 15.9.12
  • This extension: [1.1.104]

Description

VisualLinter prints "exception: no local eslint found"

However, ESLint shows warnings and bugs in the Error window. I don't know if the Output window text is wrong or if this is a real problem.

Steps to recreate

  1. Build or rebuild an ASPNet MVC project that has javascript files.
  2. Open the Output Window
  3. Show output from: VisualLinter
  4. VisualLinter prints "exception: no local eslint found"

Current behavior

VisualLinter prints "exception: no local eslint found"

Expected behavior

Should not display the above message. Because VisualLinter has always done this, I don't know what, if anything, VisualLinter should print to the Output window. It needs to work properly for me to know what to expect.
Output Window
Error Window
About Visual Studio
Visual Studio Extensions and Updates

Hey @jpx2001!
Are you sure that you've installed eslint locally (e.g. exists in your package.json) and it is VisualLinter that are reporting the errors in the error list?
You see, Visual Studio 2017, and newer, has built in ESLint support. The difference between VisualLinter and the built in functionality is that VisualLinter will always use the ESLint version you've installed in your project, while the built in is using a bundled (and often very old) version of ESLint.

See the Troubleshooting section of the readme, on how to disable the built in features and ensure it is VisualLinter that reports the errors.

No problem!
The default behavior is set to use a local installation of ESLint (per project).

If you wish to use a global ESLint installation, you will need to enable this option in Visual Studio under Tools > Options > VisualLinter.

See the notes section of the readme on how to configure global installation and/or config settings. 😸

I'm on Visual Studio 2019 (16.1.3) and getting the same error.

I have ESlint installed locally. Running ./bin/eslint . works fine. The built-in version is also running the locally installed ESLint.

Could you share the full path to the file you're trying to lint and also the full path to where eslint is installed (in node_modules)

Thanks

It’s something like z:\code\project\file.js

ESLint and the plugin are installed at z:\code\project\package.json

The problem is ESLint looks for plugins relative to the current working directory, which is the user directory when run from Visual Studio. When I remove all plugins from the config, it works just fine.

Same issue on VS 2019.

VisualLinter configured to use local install (and analyze only ts/tsx files).
ESLint is installed in the project.
Running eslint manually works fine.

image

image

After playing a little with it, I found out that it was because Visual Studio actually butchered the local packages.

What I did to fix the issue:

  • First, deactivate automatic npm restore by VS
    image
  • Delete node_modules folder
  • run npm install

And it works.

Sorry everyone; but the development of this extension has been suspended.
You can read more about it here:
https://github.com/jwldnr/VisualLinter#deprecated