Skip to content

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

Closed as not planned
@noahnu

Description

@noahnu

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions