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

extension not working #365

Closed
sfabriece opened this issue Dec 15, 2017 · 23 comments
Closed

extension not working #365

sfabriece opened this issue Dec 15, 2017 · 23 comments
Labels
info-needed Issue requires more information from poster

Comments

@sfabriece
Copy link

I'm trying to setup a simple nodejs project but the extension is throwing errors.

config:

'use strict';

module.exports = {
    'extends': 'eslint-config-hapi',
    rules: {
        'no-undef': 'error'
    }
};

error:

[Info  - 15:51:44] ESLint server is running.
[Info  - 15:51:49] ESLint library loaded from: {path_to_project}\node_modules\eslint\lib\api.js
[Error - 15:51:50] 
Failed to load plugin react: Cannot find module 'eslint-plugin-react'
Happened while validating {path_to_project}\index.js
This can happen for a couple of reasons:
1. The plugin name is spelled incorrectly in an ESLint configuration file (e.g. .eslintrc).
2. If ESLint is installed globally, then make sure 'eslint-plugin-react' is installed globally as well.
3. If ESLint is installed locally, then 'eslint-plugin-react' isn't installed correctly.

package.json:

  "devDependencies": {
    "eslint": "4.13.1",
    "eslint-config-hapi": "11.1.0",
    "eslint-plugin-hapi": "4.1.0"
  },
@dbaeumer dbaeumer added the info-needed Issue requires more information from poster label Dec 15, 2017
@dbaeumer
Copy link
Member

@sfabriece what happens when you run eslint from a teminal. If this works without problem can you proivide a Github repository that I can clone which demos the problem with steps on how to reproduce.

@sfabriece
Copy link
Author

it works fine from the terminal. Let me try to put together a repo.

@sfabriece
Copy link
Author

@dbaeumer here is a repo to reproduce: https://github.com/sfabriece/vscode-eslint-test

@dbaeumer
Copy link
Member

This works for me without problems using the above github repository

capture

Any additional info?

@sfabriece
Copy link
Author

any special settings for eslint?

I'm using npm v5
i'm on windows 10

It might also be another plugin messing with my settings.

@dbaeumer
Copy link
Member

I am using npm 5.5.1 and node 8.9.1. I am on Windows 10 also.

Are you sure that in your setup eslint and all eslint plugins are either installed locally or globally. This has to be that way and is a limitation of ESLint npm module itself.

@sfabriece
Copy link
Author

They are installed locally. It might be another extension messing with eslint. I'll try disabling all of them and see if I can identify which.

@sfabriece
Copy link
Author

I installed vscode insider edition and only installed the eslint extension. I'm still getting the same result. I have no idea what is wrong.

@dbaeumer
Copy link
Member

Any special paths (e.g. paths with spaces, special unicode charactes, ....)

@sfabriece
Copy link
Author

I'll have a look and let you know.

@lmonilsson
Copy link

This might happen if you have a global ~/.eslintrc that uses eslint-plugin-react. I have a problem where Visual Studio or ReSharper or something sometimes creates ~/.eslintrc upon startup, and it includes some plugin that isn't present in the project's package.json. After that, vscode-eslint doesn't work until I've removed ~/.eslintrc.

I've seen bug reports about ~/.eslintrc being used despite there being a project-local config file, and @dbaeumer hasn't been able to reproduce the problem. But it actually seems like the global config file is parsed but then ignored, except that failure in the parsing makes it break down.

@lmonilsson
Copy link

@dbaeumer: Can you reproduce the problem where an invalid ~/.eslintrc stops the extension from working?

@dbaeumer
Copy link
Member

@Lajnold only if there is no project local config. But this is nothing VS Code can fix because in such a setup eslint on the command line doesn't succeed either.

@lmonilsson
Copy link

lmonilsson commented Feb 19, 2018

In my case, there is a project local config. If I have different but valid settings in the project local config and ~/.eslintrc, the project local config gets precedence in both command line and VSCode. But if ~/.eslintrc has an invalid configuration, either syntactically or by including some plugin that is missing in the project, command line works while vscode-eslint fails to load.

@dbaeumer
Copy link
Member

@Lajnold what kind of error are you seeing? This works for me with the following broken .eslintrc.json file in my home directory.

////
{

@dbaeumer
Copy link
Member

Setup problem. I was not able to reproduce this. I see now:

capture

@dbaeumer
Copy link
Member

But I don't known why this is happening since I am not instructing eslint to read the config.

@dbaeumer
Copy link
Member

This actually fails in ESLInt itself

capture

I don't know why in a library setup they read that file and fail and in a command line setup they don't

@dbaeumer
Copy link
Member

The problematic part in ESLint lib is this

            if (localConfigDirectory === PERSONAL_CONFIG_DIR && localConfigFile !== projectConfigPath) {

Need to understand why this is not working when used as a library.

@dbaeumer
Copy link
Member

OK. The problem is a path comparing issue: when using the ESLint API they tripple equal paths which in this setup are c:\Users\dirkb and C:\Users\dirkb which are obviously not equal and then they try to read the config from the user dir although it should be ignored.

@lmonilsson
Copy link

Nice, thanks!

@lmonilsson
Copy link

By the way, it looks like you meant to publish 1.4.7, but actually published 1.4.6. The publishing seems to be one step behind.

@dbaeumer
Copy link
Member

1.4.7 is not published yet since I have more fixes in the pipeline.

@vscodebot vscodebot bot locked and limited conversation to collaborators Apr 5, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
info-needed Issue requires more information from poster
Projects
None yet
Development

No branches or pull requests

3 participants