Repository navigation
fix(resolve-extends): support Yarn Plug'n'Play - #4933
Conversation
Confidence Score: 5/5The PR appears safe to merge. No blocking failure remains.
|
| Filename | Overview |
|---|---|
| @commitlint/resolve-extends/src/index.ts | Adds guarded Yarn PnP package lookup and preserves the prior node_modules fallback behavior. |
| @commitlint/resolve-extends/src/index.test.ts | Adds focused coverage for PnP pure-ESM resolution and confirms that pnpapi is not loaded outside PnP. |
Reviews (3): Last reviewed commit: "test(resolve-extends): isolate non-PnP f..." | Re-trigger Greptile
Code Review by Qodo
1.
|
There was a problem hiding this comment.
Pull request overview
This PR updates @commitlint/resolve-extends to resolve pure-ESM preset packages in Yarn Plug’n’Play (PnP) projects by consulting the PnP API first, while keeping the existing node_modules walk fallback for non-PnP installs.
Changes:
- Add a Yarn PnP resolution path for pure-ESM preset fallback resolution via
pnpapi.resolveToUnqualified. - Refactor ESM-only package resolution into a shared helper (
resolveEsmPackage) used by both PnP andnode_modulesfallback paths. - Add unit tests covering the PnP code path and ensuring behavior differs when PnP is not active.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| @commitlint/resolve-extends/src/index.ts | Adds PnP-aware resolution before the existing node_modules walk for pure-ESM presets. |
| @commitlint/resolve-extends/src/index.test.ts | Adds scaffolding and tests for simulating PnP resolution and validating behavior. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
Have a look at the feedback, not sure how important that really is |
|
It was valid. Fixed in 5008895; the non-PnP test now deletes and restores the PnP marker. The focused tests, lint, formatting, and build pass. |

Description
Adds Yarn Plug'n'Play resolution to the pure ESM preset fallback while preserving the existing node_modules lookup.
Motivation and Context
Yarn PnP projects do not have a node_modules tree, so import-only ESM presets cannot be found by the existing fallback. The resolver now asks the PnP API for the package location first.
Closes #2637.
Usage examples
Existing Yarn PnP configurations work without changes.
How Has This Been Tested?
Types of changes
Checklist: