Skip to content

[Feature] xo SDK #4066

@flying-sheep

Description

@flying-sheep
  • 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:

  1. Add a relative path to a binary as value of a VS Code config option: "xo.runtime": "./.yarn/sdks/xo/node.sh"

  2. Add the binary. yarn node in not enough, since xo.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 "$@"
  3. 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:

Describe alternatives you've considered

Letting xo users stumble through the same compatibility hell that I walked through

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions