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

synckit dependency breaks usage of this plugin with Yarn PnP in VSCode #164

Closed
noahnu opened this issue Aug 4, 2022 · 1 comment
Closed

Comments

@noahnu
Copy link

noahnu commented Aug 4, 2022

When using Yarn PnP and VSCode, Yarn provides an ESLint patch that injects the PnP runtime into ESLint's lib/api.js file. All javascript in this eslint process have access to the PnP runtime. This plugin uses synckit which creates a worker process. That worker does not have access to the PnP runtime.

Yarn users can fix this by patching eslint-import-resolver-typescript, however a more ideal fix would be to detect if we're using pnp and expose the runtime to the worker. One way to do this is something along the lines of:

if (process.versions.pnp) {
    process.env.SYNCKIT_EXEC_ARV = `-r ${require.resolve('pnpapi')}`
}

(this particular example doesn't actually work, needs to be tweaked)

The other solution is to build this into synckit itself. I've put up a PR for that.

Note that the SYNCKIT_EXEC_ARV env var is spelled correctly. There's another PR which fixes the typo.

If going with the env var approach, I think this change makes sense to do in this repository because eslint-import-resolver-typescript is what brings in synckit and understands the required execution context for the worker.


I know this is very Yarn specific, but compatibility with Yarn PnP is only a few lines of code and opens up this plugin to be used by a large community.

@JounQin
Copy link
Collaborator

JounQin commented Aug 4, 2022

No worry, I'm the owner of synckit at the same time. 😁

So I'll close this one and track it on synckit instead.

And thanks for your great explanation of issue content!

@JounQin JounQin closed this as not planned Won't fix, can't repro, duplicate, stale Aug 4, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

2 participants