Skip to content

fix(load): run the parser factory of scoped conventional-changelog presets - #4968

Merged
escapedcat merged 2 commits into
conventional-changelog:masterfrom
maximilliangrand:fix/scoped-conventional-changelog-parser-preset
Aug 22, 2026
Merged

escapedcat merged 2 commits into
conventional-changelog:masterfrom
maximilliangrand:fix/scoped-conventional-changelog-parser-preset

Conversation

@maximilliangrand

Copy link
Copy Markdown
Contributor

Description

fixes #2488

@commitlint/load only invoked a preset's parserOpts factory when the preset name started with conventional-changelog-. A preset published under a scope, for example @scope/conventional-changelog-preset, never matched that check, so the factory was passed through untouched and the preset's parser options were silently dropped. commitlint then parsed commits with default options and gave no error.

Root cause: the parser.name.startsWith("conventional-changelog-") guard on the factory branch in @commitlint/load/src/utils/load-parser-opts.ts.

Reproduced on the published @commitlint/load@21.2.2: with two identical factory presets in node_modules, conventional-changelog-myorg resolves parserOpts to an object while @scope/conventional-changelog-myorg leaves it as a function.

Fix

Strip a leading @scope/ before the prefix check, so a scoped preset is recognized the same way an unscoped one already is. Behavior for every other preset shape is unchanged.

Test

load-parser-opts.test.ts gains a case for a scoped preset exposing a parserOpts factory. It fails without the fix (parserOpts stays a function) and passes with it. Full suite stays green.

…esets

A preset published under a scope, such as `@scope/conventional-changelog-preset`,
never matched the `conventional-changelog-` name check, so its `parserOpts`
factory was never called. The factory function was passed through as-is and the
configured parser options were silently dropped.

fixes conventional-changelog#2488
@greptile-apps

greptile-apps Bot commented Aug 22, 2026

Copy link
Copy Markdown

Confidence Score: 5/5

The PR appears safe to merge, with no concrete changed-code failures identified.

The normalization preserves existing unscoped behavior while recognizing the standard @scope/conventional-changelog-* form, and the new regression test directly covers the repaired factory path.

Important Files Changed

Filename Overview
@commitlint/load/src/utils/load-parser-opts.ts Safely extends the existing conventional-changelog factory branch to scoped package names without changing other established preset shapes.
@commitlint/load/src/utils/load-parser-opts.test.ts Adds focused regression coverage demonstrating that a scoped preset factory resolves to parser options.

Reviews (1): Last reviewed commit: "fix(load): run the parser factory of sco..." | Re-trigger Greptile

@escapedcat
escapedcat added this pull request to the merge queue Aug 22, 2026
@escapedcat

Copy link
Copy Markdown
Member

Thanks!

Merged via the queue into conventional-changelog:master with commit a42b18c Aug 22, 2026
12 checks passed
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.

@commitlint/load silently fails to load conventional changelog preset if it has a scoped package name

2 participants