Does not work with the latest version of XO #91
yakov116 posted onGitHub
Failed to load XO library. Make sure XO is installed in your workspace folder using 'npm install xo' and then press Retry.
This appears to be caused by XO v0.40 migrating the project to ESM, and with it breaking compatibility with this extension. Upon further inspection, the error is instead some issue with resolving eslint-config-xo
when trying to load the XO library.
Error: Cannot find module 'eslint-config-xo'
Require stack:
- C:\Users\Jack\AppData\Local\Programs\Microsoft VS Code\__placeholder__.js
at Function._resolveFilename (internal/modules/cjs/loader.js:934:15)
at Function.resolve (internal/modules/cjs/helpers.js:94:19)
As far as I can tell, https://github.com/xojs/xo/pull/534 introduced some change to XO's config resolver, which in turn broke the logic that loads the XO library.
@lolPants is right, the version just before 0.39.1
is working well with this extension
Hi @Richienb, this issue is very much related to https://github.com/xojs/xo/issues/543.
xo@0.40.1
is looking for eslint-config-xo
within the vscode extension’s context, and not within the extension’s workspace root.
xo
is loading using resolveModule(workspaceRoot, 'xo')
, see https://github.com/SamVerschueren/vscode-linter-xo/blob/master/server/src/server.ts#L131.
Then it throws when trying to load eslint-config-xo
– installing eslint-xo-config
within the extension server’s root fixes the issue.
ESLint is only able to resolve plugins from the same node_modules folder that it is installed in or the node_modules of the project directory its cwd
is set to. I think 0.40.0 just made it do the other thing but I can't be certain.
Could the cwd
option in xo
be of use for now?
It could but makes this plugin useless. Also makes linting so much harder.
Yeah, that is definitly the issue, eslint-config-xo
is being searched within the CWD
.
The issue is not when linting files, but when loading the package.
The cwd
option is actually already set when linting (https://github.com/SamVerschueren/vscode-linter-xo/blob/master/server/src/server.ts#L198)
For those seeking a workaround until this is otherwise resolved, you can use xo v0.39.1, the most recent working version:
npm install xo@0.39.1 --save-dev
or the equivalent shorter command:
npm i xo@0.39.1 -D
If you want to see xo's description of what's in the last few releases: https://github.com/xojs/xo/releases/
added this issue here for visibility: https://github.com/xojs/xo/issues/563
@SamVerschueren can we get any confirmation on if this extension is dead or alive? It doesn't look like its had any real activity in 2 years. Should we look for a new solution for vscode integration?
Is there anyone here that would like to fix this for money? I am willing to pay.
Willing to monetarily support an update to this, as well.
@yakov116 has funded $20.00 to this issue.
- Submit pull request via IssueHunt to receive this reward.
- Want to contribute? Chip in to this issue via IssueHunt.
- Checkout the IssueHunt Issue Explorer to see more funded issues.
- Need help from developers? Add your repository on IssueHunt to raise funds.
An anonymous user has funded $20.00 to this issue.
- Submit pull request via IssueHunt to receive this reward.
- Want to contribute? Chip in to this issue via IssueHunt.
- Checkout the IssueHunt Issue Explorer to see more funded issues.
- Need help from developers? Add your repository on IssueHunt to raise funds.
An anonymous user has funded $20.00 to this issue.
@yakov116 Er, that wasn't supposed to be anonymous. But in any event, I've matched funding.
@tusbar has funded $20.00 to this issue.
- Submit pull request via IssueHunt to receive this reward.
- Want to contribute? Chip in to this issue via IssueHunt.
- Checkout the IssueHunt Issue Explorer to see more funded issues.
- Need help from developers? Add your repository on IssueHunt to raise funds.
I forked and published this package as a new extension - since it seems this is no longer being maintained or accepting PRs. Please try this via the link below, and feel free to file issues in my fork. My extension should work now for all versions of XO. @tusbar @yakov116 @savearray2 -- if you have any problems definitely let me know and I will try to fix right away.
https://marketplace.visualstudio.com/items?itemName=spence-s.linter-xo
@Spence-S Thank you for the update! It is much appreciated. I'm in the middle of switching laptops. I'll check it out in the next day or so :)
I forked and published this package as a new extension - since it seems this is no longer being maintained or accepting PRs. Please try this via the link below, and feel free to file issues in my fork. My extension should work now for all versions of XO. @tusbar @yakov116 @savearray2 -- if you have any problems definitely let me know and I will try to fix right away.
https://marketplace.visualstudio.com/items?itemName=spence-s.linter-xo
@Spence-S your extension works perfect ly! @SamVerschueren can you merge the PR?
If it does not get merged in the next week I will credit you the bounty.
Can you try to link the pull request? If this does not work I will email them
@SamVerschueren I think you may have to reward it since your the repository owner. @Spence-S I will send them an email now. If they don't get back to me in a prompt matter, I will send it to u via PayPal etc.
@yakov116 feel free to email me @ sasnyde2@gmail.com if you need anything else from my end. Will try to stop spamming these threads here 😄 - but thanks for your support on this.
Not entirely sure how this works. I'll check tomorrow on my computer. I tried linking the PR, not sure if that did it...
I think you have to go onto issue hunt and award it there
@samverschueren has rewarded $54.00 to @spence-s. See it on IssueHunt
- :moneybag: Total deposit: $60.00
- :tada: Repository reward(0%): $0.00
- :wrench: Service fee(10%): $6.00
Yes. I found it :). Great work everyone!