fix(eslint): resolve VS Code plugin error with PNPM #13025
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Recent versions of PNPM (v10+) no longer automatically hoist ESLint packages to the root of the
node_modules
directory. This change causes the VS Code ESLint extension to fail, as it cannot find its required modules.This commit adds
public-hoist-pattern[]=*eslint*
to the.npmrc
file. This configuration explicitly tells PNPM to hoist ESLint-related packages, restoring the functionality of the VS Code ESLint extension without resorting to a fully hoistednode_modules
structure.What?
This PR updates the
.npmrc
file to include apublicHoistPattern
PNPM workspace settings for ESLint packages.Why?
The VS Code ESLint extension fails to initialize in new PayloadCMS projects that use PNPM. This is caused by a breaking change in PNPM v10 which no longer hoists ESLint packages by default, leading to a
MODULE_NOT_FOUND
error. This change is discussed in the pnpm repository issue pnpm/pnpm#8378.Relevant error
How?
This change adds
public-hoist-pattern[]=*eslint*
to the.npmrc
file. This configuration explicitly instructs PNPM to hoist all ESLint-related packages to the root of the node_modules directory, making them accessible to the VS Code ESLint extension and resolving the error.Note
ESLint recommendation's was considered as well to use
node-linker=hoisted
. However, that approach alters PNPM's default dependency resolution strategy to mimic NPM, which is a broader change than necessary. Thepublic-hoist-pattern
is a more targeted solution that fixes the tooling incompatibility while preserving the benefits of PNPM's standard non-hoisted node modules structure.