-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Description
- I'd be willing to implement this feature (contributing guide)
- This feature is important to have in this repository; a contrib plugin wouldn't do (because it’s a SDK)
Describe the user story
I want to use the VS Code extension for XO directly instead of the eslint configs, together with yarn.
Describe the solution you'd like
Adding a SDK should be straightforward. When xo
is used:
-
Add a relative path to a binary as value of a VS Code config option:
"xo.runtime": "./.yarn/sdks/xo/node.sh"
-
Add the binary.
yarn node
in not enough, sincexo.runtime
only accepts a path to a binary, not a command line with arguments. It would be a portable version of this (experimental-loader
is necessary)#!/bin/bash pdir="$(realpath "$(dirname -- "$0")/../../..")" # project dir export NODE_OPTIONS="--no-warnings --require=\"$pdir/.pnp.cjs\" --experimental-loader=\"$pdir/.pnp.loader.mjs\"" exec node "$@"
-
Add
"samverschueren.linter-xo"
to the recommended extensions
Describe the drawbacks of your solution
Two bugs used to block this, so very new versions of node and yarn are needed:
- discussion about how to fix child_process 'spawn' not ready to send messages on ESM nodejs/node#41134 was fixed in node 17.4
- [Bug?]: PnP fails to resolve dynamic require from CJS #3687 will be fixed in yarn 3.2
Describe alternatives you've considered
Letting xo users stumble through the same compatibility hell that I walked through