Skip to content

feat(resolve-extends): resolve pure-ESM presets (conventional-changelog v7/v9/v10)#4859

Merged
escapedcat merged 4 commits into
masterfrom
chore/conventional-changelog-family-bump
Jun 30, 2026
Merged

feat(resolve-extends): resolve pure-ESM presets (conventional-changelog v7/v9/v10)#4859
escapedcat merged 4 commits into
masterfrom
chore/conventional-changelog-family-bump

Conversation

@escapedcat

@escapedcat escapedcat commented Jun 30, 2026

Copy link
Copy Markdown
Member

Adopts the conventional-changelog family majors released 2026-06-26. Supersedes the three Renovate PRs (#4858, #4857, #4856).

Structured as four commits — the shared ESM resolver as a feat, then one fix per dependency bump:

Why the feat

conventional-changelog-angular@9 and conventional-changelog-conventionalcommits@10 are now pure ESM whose exports map declares only the import condition (no require/default/main). commitlint's CommonJS resolvers (require.resolve, resolve-from, resolve-pkg) fail with No "exports" main defined when resolving a string parser preset. @commitlint/resolve-extends now falls back to an ESM-aware node_modules walk only after CommonJS resolution fails — so resolution of normal packages is unchanged — with the equivalent fallback in the test bootstrap. Covered by new unit tests on synthetic exports-only manifests.

angular@9 typings

v9 ships its own types: createPreset() is typed {} and the named parser export was dropped (still present at runtime). The affected source/tests now read the options via createPreset().parser and drop the now-unused @ts-expect-error directives. The runtime in @commitlint/parse was already calling createPreset().parser, so only the cast/types changed.

User impact

Suitable for a minor release. commitlint only consumes these packages' parserOpts, never their writer/template side, and Node 22 was already required. The new capability is resolving pure-ESM parser presets; the one behavior change is the parser footer fix (conventional-changelog#1485) where BREAKING CHANGE notes no longer absorb trailing footer trailers.

Verification

  • pnpm build (tsc -b --force, clean) ✅
  • Full test suite: 1208 passed (incl. 3 new resolver tests) ✅
  • oxlint ✅ · oxfmt --check
  • Manual CLI smoke test against @commitlint/config-conventional (valid / invalid / BREAKING CHANGE) ✅

🤖 Generated with Claude Code

@qodo-code-review

Copy link
Copy Markdown

Qodo reviews are paused for this user.

Troubleshooting steps vary by plan Learn more →

On a Teams plan?
Reviews resume once this user has a paid seat and their Git account is linked in Qodo.
Link Git account →

Using GitHub Enterprise Server, GitLab Self-Managed, or Bitbucket Data Center?
These require an Enterprise plan - Contact us
Contact us →

@escapedcat escapedcat force-pushed the chore/conventional-changelog-family-bump branch from 4bee721 to 40ac266 Compare June 30, 2026 09:06
@greptile-apps

greptile-apps Bot commented Jun 30, 2026

Copy link
Copy Markdown

Confidence Score: 5/5

Safe to merge; the new ESM resolver is a strict fallback that only activates after both CJS paths fail, leaving normal resolution behaviour unchanged.

The ESM fallback in resolveFrom is guarded by a try/catch and only fires when CommonJS resolution has already given up, so there is no regression risk for packages that CJS can already resolve. Root-entry resolution of pure-ESM packages is correct and covered by new unit tests. The one open gap — the subpath branch ignores the exports map for subpath entries — does not affect the declared targets.

@commitlint/resolve-extends/src/index.ts lines 86-93 (subpath resolution) if support for exports-mapped subpaths is ever needed.

Important Files Changed

Filename Overview
@commitlint/resolve-extends/src/index.ts Adds resolveExportsEntry and resolveEsmOnly as a CJS-fallback for pure-ESM packages; root-entry resolution is correct but the subpath branch skips the exports map and does a raw filesystem walk, which can miss non-trivial subpath mappings
@commitlint/resolve-extends/src/index.test.ts Three new unit tests cover pure-ESM root resolution and fallback-to-main; the subpath test succeeds only because the file is at the naive path, not because the exports map was consulted
@commitlint/parse/src/index.ts Removes @ts-expect-error and adds a runtime-safe cast to read `preset.parser
@commitlint/parse/src/index.test.ts Introduces angularParserOpts() helper to access createPreset().parser with correct typings; removes four @ts-expect-error directives cleanly
@packages/test/src/npm.ts Adds resolveModuleDir as a last-resort fallback that walks up from the current module file to find a package directory; handles pure-ESM packages that resolvePkg/require.resolve cannot locate
@commitlint/rules/src/references-empty.test.ts Replaces @ts-expect-error with proper cast to { parser: ParserOptions } and switches from parserOpts to parser to match angular@9 API
@commitlint/rules/src/subject-exclamation-mark.test.ts Same @ts-expect-error removal and parserOpts to parser field rename as references-empty.test.ts; clean change
@commitlint/config-conventional/package.json Bumps conventional-changelog-conventionalcommits from ^9.2.0 to ^10.0.0
@commitlint/parse/package.json Bumps conventional-changelog-angular to ^9.0.0 and conventional-commits-parser to ^7.0.0

Reviews (3): Last reviewed commit: "fix: update dependency conventional-chan..." | Re-trigger Greptile

Comment thread @commitlint/resolve-extends/src/index.ts Outdated
Comment thread @packages/test/src/npm.ts
@escapedcat escapedcat force-pushed the chore/conventional-changelog-family-bump branch from 40ac266 to 91b2556 Compare June 30, 2026 09:31
@escapedcat escapedcat changed the title fix: update conventional-changelog dependencies to v7/v9/v10 feat(resolve-extends): resolve pure-ESM presets (conventional-changelog v7/v9/v10) Jun 30, 2026
escapedcat and others added 4 commits June 30, 2026 11:43
Parser presets published as pure ESM expose an exports map with only the import
condition (no require/default/main). The CommonJS preset resolver could not read
these and threw "No exports main defined". Add an ESM-aware node_modules fallback
that runs only after CommonJS resolution fails, plus the same fallback in the test
bootstrap.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
v9 ships its own typings: createPreset() is typed as {} and the named parser export was
dropped (still present at runtime). Read the parser options via createPreset().parser and
drop the now-unused @ts-expect-error directives.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@escapedcat escapedcat force-pushed the chore/conventional-changelog-family-bump branch from 91b2556 to edb6005 Compare June 30, 2026 09:44
@escapedcat escapedcat merged commit fdb566f into master Jun 30, 2026
14 checks passed
@escapedcat escapedcat deleted the chore/conventional-changelog-family-bump branch June 30, 2026 09:50
sys-support pushed a commit to 3caravelle/renovate that referenced this pull request Jun 30, 2026
This PR contains the following updates:

| Package | Change | [Age](https://docs.renovatebot.com/merge-confidence/) | [Confidence](https://docs.renovatebot.com/merge-confidence/) |
|---|---|---|---|
| [@commitlint/cli](https://commitlint.js.org/) ([source](https://github.com/conventional-changelog/commitlint/tree/HEAD/@commitlint/cli)) | [`21.1.0` → `21.2.0`](https://renovatebot.com/diffs/npm/@commitlint%2fcli/21.1.0/21.2.0) | ![age](https://developer.mend.io/api/mc/badges/age/npm/@commitlint%2fcli/21.2.0?slim=true) | ![confidence](https://developer.mend.io/api/mc/badges/confidence/npm/@commitlint%2fcli/21.1.0/21.2.0?slim=true) |
| [@commitlint/config-conventional](https://commitlint.js.org/) ([source](https://github.com/conventional-changelog/commitlint/tree/HEAD/@commitlint/config-conventional)) | [`21.1.0` → `21.2.0`](https://renovatebot.com/diffs/npm/@commitlint%2fconfig-conventional/21.1.0/21.2.0) | ![age](https://developer.mend.io/api/mc/badges/age/npm/@commitlint%2fconfig-conventional/21.2.0?slim=true) | ![confidence](https://developer.mend.io/api/mc/badges/confidence/npm/@commitlint%2fconfig-conventional/21.1.0/21.2.0?slim=true) |

---

### Release Notes

<details>
<summary>conventional-changelog/commitlint (@&#8203;commitlint/cli)</summary>

### [`v21.2.0`](https://github.com/conventional-changelog/commitlint/blob/HEAD/@&#8203;commitlint/cli/CHANGELOG.md#2120-2026-06-30)

[Compare Source](conventional-changelog/commitlint@v21.1.0...v21.2.0)

##### Features

- **resolve-extends:** resolve pure-ESM presets (conventional-changelog v7/v9/v10) ([#&#8203;4859](conventional-changelog/commitlint#4859)) ([fdb566f](conventional-changelog/commitlint@fdb566f))

</details>

<details>
<summary>conventional-changelog/commitlint (@&#8203;commitlint/config-conventional)</summary>

### [`v21.2.0`](https://github.com/conventional-changelog/commitlint/blob/HEAD/@&#8203;commitlint/config-conventional/CHANGELOG.md#2120-2026-06-30)

[Compare Source](conventional-changelog/commitlint@v21.1.0...v21.2.0)

##### Features

- **resolve-extends:** resolve pure-ESM presets (conventional-changelog v7/v9/v10) ([#&#8203;4859](conventional-changelog/commitlint#4859)) ([fdb566f](conventional-changelog/commitlint@fdb566f))

</details>

---

### Configuration

📅 **Schedule**: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined).

🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied.

♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.

🔕 **Ignore**: Close this PR and you won't be reminded about these updates again.

---

 - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box

---

This PR has been generated by [Renovate Bot](https://github.com/renovatebot/renovate).
<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiI0Mi44MS4zIiwidXBkYXRlZEluVmVyIjoiNDIuODEuMyIsInRhcmdldEJyYW5jaCI6Im1haW4iLCJsYWJlbHMiOltdfQ==-->

Reviewed-on: https://git.3caravelle.net/3Caravelle/renovate/pulls/43
Co-authored-by: Renovate Bot <renovate-bot@3caravelle.com>
Co-committed-by: Renovate Bot <renovate-bot@3caravelle.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

1 participant