berry
berry copied to clipboard
fix: The eslint.nodePath path generated by @yarnpkg/sdks cannot be resolved by eslint using require.resolve
What's the problem this PR addresses?
https://github.com/yarnpkg/berry/issues/6007 ...
How did you fix it?
Removed a call to path.dirname and set nodePath to ".yarn/sdks/eslint" ...
Checklist
- [ ] I have read the Contributing Guide.
- [ ] I have set the packages that need to be released for my changes to be effective.
- [ ] I will check that all automated PR checks pass before the PR gets reviewed.
According to the VSCode-Eslint documentation,
nodePath
needs to point to anode_modules
folder:
eslint.nodePath
- use this setting if an installed ESLint package can't be detected, for example/myGlobalNodePackages/node_modules
.
Jan 23, 2024 View reviewed changes
Yes, there is no problem parsing node_modules under normal circumstances. But in submodule, there is a problem that it cannot be parsed. It can be seen from the VSCode-Eslint plug-in source code that the eslint plug-in is parsed through require.resolve of nodejs. In submodule, if it cannot be resolved in node_modules, it will be searched upward. It seems to be a depth-first search.
https://github.com/microsoft/vscode-languageserver-node/blob/4812428a8621dff4153282407fc71494b994eda3/server/src/node/files.ts#L41