vscode-eslint: Do not lint if eslint is not installed

Hi there,

Would it be possible to disable linting when eslint is not installed either locally or globally?

screen shot 2016-04-17 at 11 39 05 pm

Thanks!

About this issue

  • Original URL
  • State: closed
  • Created 8 years ago
  • Reactions: 9
  • Comments: 17 (5 by maintainers)

Most upvoted comments

Thats not an option for me, I collaborate on multiple projects used by multiple people, not everyone uses VSCode, and having a editor specific files (.vscode ) checked into source control system is not an option.

I would propose, if eslint is not available, don’t display the error message as an actionable item.

The new 1.0.3 version contains a less intrusive behavior for this. If eslint library can’t be found a message is sent to the output window. The output window is brought once to front per workspace you open. If you open the workspace a second time the message is still printed to the output console but the output pane is not brought to front. Let me know if this behavior is more in line what you expect.

It’s not really easy to “disable” eslint “locally” in every project and add .vscode folder to .gitignore. It’s just more work and gets annoying when working with lots of projects. IDE’s are supposed to help us and make our life easier not the other way around. I shouldn’t be responsible to disable this plugin when I don’t want to use it, it should understand this logic by default. If there’s no .eslintrc file, it should stop working. ESLint plugin for Atom got this right, there is also an option to toggle this logic: Disable when no .eslintrc has been found and Use global eslint package when not found locally.

Agreed. The current behaviour seems a bit obstrusive to me. Perhaps a command to quickly enable/disable eslint globally would be desirable? Oh well, I guess this could be an idea for plugin.

We could also look at how it’s implemented on Sublime Text Linter plugin. It has different linting mode available.

image

Then people will complain that the linter is not working.… The warning is necessary imo.

FWIW, I’ve been trying VS Code as an alternative to Atom and I believe this is how the Atom plugin for ESLint works (it does nothing if there’s no ESLint available). I’ve never found the Atom behavior to be problematic and the very in-your-face warning in this plugin is literally the single most annoying thing to me so far using VS Code :\

I definitely understand that the message is attempting to help someone get configured properly, but it would be great if the error were at least a little less intrusive. I love ESLint, but as a consultant, I work on a wide variety of projects maintained by different teams, and not all of them use or even want to use ESLint, so the message winds up being way more annoying than helpful for me.

You can add a workspace setting for that and add .vscode to your .gitignore file.

I often use VSCode to open all manner of folders full of files that aren’t necessarily large working projects. Besides the extra effort in configuring the project every time I open an ad-hoc directory, I really don’t want to litter my hard drive with .vscode files.

I like the heuristic of looking for both an ESLint executable and one of the various ESLint config files and, if both are missing, suppressing the error message. It seems pretty likely that, in that case, the user is not trying to get ESLint to run.

Otherwise, @sarbbottam’s solution above is a workable one. I personally would prefer the default value for that setting be to not show the error.

You can disable eslint using either global or local settings. The settings key is: "eslint.enable". Set it to false to disable it.

I don’t want to disable it. I would prefer to lint if eslint is enabled or else do nothing, rather respect the projects setting.

@dbaeumer I guess there could be setting for extensions, please refer https://github.com/Microsoft/vscode/issues/5710

Wondering if there could be a user setting to suppress this error message.

PS: I would not prefer to disable eslint, but suppress the error message via user setting not workspace setting.

@sarbbottam thanks for your input. I will look what we can do to make this a more pleasant experience.

You can add a workspace setting for that and add .vscode to your .gitignore file.

Nah, I don’t prefer to make any editor specific changes in the code base.

Then people will complain that the linter is not working. Or new people will think that the plugin uses it’s own internal eslint package. The warning is necessary imo.

I see your point, but its a distraction for me. May be if the message could have been conveyed as a warning instead of error and not as a prompt, it would not have been distracting.

I would leave it to the repo owner to close the issue or take further action.

I am sorry to say, but I will stick to command line and uninstalling the plugin.

You can disable eslint using either global or local settings. The settings key is: “eslint.enable”. Set it to false to disable it.

Simply checking for .eslintrc.json file is not enough since ESLint has quite a sophisticated configuration story (parent folders, package.json, …) and we don’t want to reprogram the logic in the extension. Therefore we decided to improve the following:

  • allow to install eslint locally from the extension (no need for you to go to the command line)
  • provide a don’t ask me again question which disables ESLint for that workspace folder.