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

Failed to resolve module: xo. Ensure that xo is installed. #100

Closed
Yash-Singh1 opened this issue Oct 15, 2021 · 10 comments
Closed

Failed to resolve module: xo. Ensure that xo is installed. #100

Yash-Singh1 opened this issue Oct 15, 2021 · 10 comments

Comments

@Yash-Singh1
Copy link

Some of my repositories don't use xo and every second that I type some javascript code, a popup appears saying: Failed to resolve module: xo. Ensure that xo is installed.

Screenshot from 2021-10-14 18-46-38

Maybe, the extension will not show the popup if it is not installed because not all repositories use xo.

Thanks for making this vscode extension!

@spence-s
Copy link
Collaborator

You can disable the extension per workspace in vscode.

Perhaps this is too aggressive. I'll leave this open and see if others find it too annoying. I will just have it report this particular error in the in the extension tab only.

@tbrolin
Copy link

tbrolin commented Oct 15, 2021

Yesterday I reopened my project and started to get the failed to resolve module xo error. My workspace root is not a npm package and only one subfolder is using xo, with xo configuration in the package.json file. The plugin has worked fine up until now...

Did downgrade to version 3.2.0 and it works again.

@spence-s
Copy link
Collaborator

spence-s commented Oct 15, 2021

I went ahead and published an update (3.3.2) so that particular error message should only be shown once and then it will continue to try to resolve xo in the background, without showing an error, until you install it.

I may consider removing this message altogether in the future but I feel it could be helpful to new users. Hopefully this is a good middle ground.

My workspace root is not a npm package and only one subfolder is using xo, with xo configuration in the package.json file.

Not sure what your workflow is here, but 3.2 does not have proper support for "multi-root/multi-folder" workspaces. 3.3+ now can resolve different versions of xo for each folder and apply them properly. It sounds like you were possibly using the a work around that no longer applies now that full support is in 3.3. @tbrolin - if you think this is a separate problem - maybe let me know some more specifics about your set up so I can repro and fix.

@darkred
Copy link

darkred commented Oct 16, 2021

I also find this message annoying and aggressive.

So, I'd like to offer an approach I came up with: to check the current folder tree's package.json, and

@sachinraja
Copy link

I agree with @darkred, and their solution sounds good to me provided xo config files are also checked for. This error assumes that xo is used in all javascript projects.

@spence-s
Copy link
Collaborator

spence-s commented Oct 16, 2021

@darkred @sachinraja - do you feel it is still aggressive even as it is now - showing only 1 time per open instance of VScode?

@darkred I like that idea - I will implement it that way. - however, I won't make it depend on xo being in package.json, it will attempt to resolve xo and lint no matter what, but if xo isn't present in package deps - it will fail silently. Otherwise it will show the error once per folder.

Thanks for the suggestion.

@sachinraja xo does not need any config files to work. It requires 0 config so searching for a config like the eslint extension does is pointless.

@sachinraja
Copy link

I do feel that is still aggressive as the error shows every time I open vscode to a project without xo.

@darkred
Copy link

darkred commented Oct 16, 2021

do you feel it is still aggressive even as it is now - showing only 1 time per open instance of VScode?

Yes, because e.g. my repo doesn't use XO, and so, I shouldn't get the message at all - it's irrelevant and therefore distracting:
it makes the user wrongly think that XO module should be installed in repos that don't actually use it.
And, in general, XO, being an ESLint wrapper, regardless of how useful it is, it's less commonly used than ESLint alone.

@spence-s
Copy link
Collaborator

spence-s commented Oct 18, 2021

The extension will only show the resolution error now if xo is listed in package.json :) thanks yall!

@sachinraja
Copy link

Thank you for listening to our feedback @spence-s! Really appreciate your work on this extension

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

No branches or pull requests

5 participants