-
-
Notifications
You must be signed in to change notification settings - Fork 29
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
Fails to load when XO is installed using yarn PnP #71
Comments
I took a look on the Yarn v2 docs, and I thought that we should use the Editor SDK, but XO is currently not on the supported tools list. I suppose that we should send a PR to add support of XO to the editor sdk, and then turn back to the extension side of supporting pnpify. |
I'm closing this as it's up to the Yarn team to resolve any incompatibilities with the existing community. Open an issue on Yarn about this or do:
|
What do I set |
Or |
Yarn v2 (and its successor v3) uses a very non-standard way to store its modules, and all of its module resolution jobs is done by injecting My suggested solution will be switching to Another resolution will be simply specifying |
Sorry for my pedantry, but there is no standard way to store modules. I think it’s fair to develop alternative solutions that are superior for certain use cases.
I’m pretty sure the same solution as
|
@flying-sheep curious why you can't just set the absolute path on your system? There is no "version check" that we do with this extension. We just load the version on startup so you can see that its using the right version, it doesn't actually do anything. If you use the path option, we don't check the version at all, we just call it "custom"...It should just work. I do this when I work on xo itself, because i want to lint xo with xo in vscode: "xo.path": "file:///users/spencer/projects/xo/index.js", The startup in the extension logs look something like: If you update the xo version while vscode is open - you will need to force vscode to recache the new xo version and its easiest to open the command palette and use "Developer: reload window" As a side note: the "runtime" option is a path to the nodejs binary. I have that set in my user settings, and I recommend setting it so you are always running xo with the same version of node you're running in your terminal. |
I commit my project configuration and expect it to be self contained and machine independent. I long ago stopped having absolute paths anywhere. /edit: ah I see about the version stuff, I misinterpreted the code! |
The XO VSCode doesn't work with yarn PNP out of the box. Someone found a solution by createing a patched node runtime that can be used to run XO. xojs/vscode-linter-xo#71 flying-sheep/react-color-scheme-switch#3 yarnpkg/berry#4045 I added the XO plugin to the recommended VSCode extensions and added a workspace config to automatically enable it for the project.
Yarn Plug'n'play is a new feature developed by the yarn maintainers that changes how modules are resolved—XO is no longer found in
node_modules
and must be resolved using a custom resolver.Steps to reproduce
xo
locallyError
We get a pretty standard error: "Failed to load XO library. Make sure XO is installed in your workspace folder using 'npm install xo' and then press Retry."
Recommended Fix
In Yarn v2, there is an automatic solution for this called
pnpify
. One could solve this by allowing the user to specify the path to thenode
executable in the settings for the plugin.pnpify
can handle the rest by setting to node path to.vscode/pnpify
—although submitting a PR there to have it automatically register and handle that would be helpful.The text was updated successfully, but these errors were encountered: