You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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)
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.
The text was updated successfully, but these errors were encountered:
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:
(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.
The text was updated successfully, but these errors were encountered: