-
Notifications
You must be signed in to change notification settings - Fork 2k
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
feat(eslint): support yarn2 PnP projects #1777
Conversation
local pnp_cjs = util.path.join(new_root_dir, '.pnp.cjs') | ||
local pnp_js = util.path.join(new_root_dir, '.pnp.js') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Globbing might be nicer here, but wanted to avoid vim.fn
call.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
btw, this is not working with experimental .pnp.loader.mjs
which is tries to load vscode-eslint-language-server esm format, and fails because of cjs module
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, do you happen to know whether simply adding .pnp.loader.mjs
here would do it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes it would help, but because of this issue it doesn't work, but its not related to this PR
Is this ready for merge? |
d1ca6f7
to
90dc57c
Compare
Yep! I just tested it again in a PNP workspace, works fine (and doesn't work without this). |
https://yarnpkg.com/features/pnp
Yarn's PnP feature changes the way packages are installed. Instead of building on the
node_modules
resolution, it introduces a single.pnp.*js
file in the project. This file is responsible for orchestrating and resolving dependencies. The eslint LSP server will assume that regularnode_modules
resolution applies when locating theeslint
package - which will not work in Yarn PnP projects.To work around this, Yarn provides the ability to run Node programs in "PnP-compat" mode via
yarn exec
andyarn node
. My understanding is that this simply hooks into therequire()
function to resolve modules via PnP instead Node's builtin module resolution.