Skip to content

fix(types): add presetConfig to ParserPreset interface#4749

Merged
escapedcat merged 1 commit into
conventional-changelog:masterfrom
SAY-5:fix/parserpreset-presetconfig
May 12, 2026
Merged

fix(types): add presetConfig to ParserPreset interface#4749
escapedcat merged 1 commit into
conventional-changelog:masterfrom
SAY-5:fix/parserpreset-presetconfig

Conversation

@SAY-5

@SAY-5 SAY-5 commented May 7, 2026

Copy link
Copy Markdown

Description

Add presetConfig?: unknown to the ParserPreset interface in @commitlint/types so TypeScript users can configure presets like conventional-changelog-conventionalcommits without a type error.

Motivation and Context

Fixes #4748.

The presetConfig field is documented in docs/reference/configuration.md (### presetConfig) and is the standard way to customize presets like conventional-changelog-conventionalcommits (which exports a factory accepting a presetConfig argument). However, the ParserPreset interface only declared name, path, parserOpts, and parser, so passing presetConfig from a TypeScript config produced Object literal may only specify known properties, and 'presetConfig' does not exist in type 'ParserPreset'.

unknown is used (matching parserOpts/parser) because the shape of presetConfig is preset-specific.

Usage examples

// commitlint.config.ts
import type { UserConfig } from "@commitlint/types";

const config: UserConfig = {
  parserPreset: {
    name: "conventional-changelog-conventionalcommits",
    presetConfig: {
      types: [
        { type: "feat", section: "Features" },
        { type: "fix", section: "Bug Fixes" },
        { type: "docs", section: "Documentation", hidden: false },
        { type: "chore", hidden: true },
      ],
    },
  },
};

export default config;
echo "feat: add new feature" | commitlint # passes

How Has This Been Tested?

  • Added @commitlint/types/src/load.test-d.ts with compile-time checks asserting that presetConfig is assignable on both UserConfig.parserPreset and ParserPreset directly. Verified the test fails on master with the exact error from the issue and passes with this change.
  • yarn build, yarn vitest run @commitlint/types, yarn lint, and yarn format all pass.

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Checklist:

  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have added tests to cover my changes.
  • All new and existing tests passed.

Fixes conventional-changelog#4748

Signed-off-by: SAY-5 <saiasish.cnp@gmail.com>
@qodo-code-review

Copy link
Copy Markdown

Review Summary by Qodo

Add presetConfig field to ParserPreset interface

🐞 Bug fix

Grey Divider

Walkthroughs

Description
• Add presetConfig field to ParserPreset interface
• Allows TypeScript users to configure presets without type errors
• Add compile-time type checks via .test-d.ts file
Diagram
flowchart LR
  A["ParserPreset interface"] -->|"add presetConfig field"| B["Support preset configuration"]
  C["load.test-d.ts"] -->|"compile-time checks"| B
  B -->|"fixes #4748"| D["TypeScript config validation"]
Loading

Grey Divider

File Changes

1. @commitlint/types/src/load.ts 🐞 Bug fix +1/-0

Add presetConfig field to ParserPreset interface

• Add presetConfig?: unknown field to ParserPreset interface
• Enables preset-specific configuration like conventional-changelog-conventionalcommits
• Uses unknown type matching existing parserOpts and parser fields

@commitlint/types/src/load.ts


2. @commitlint/types/src/load.test-d.ts 🧪 Tests +29/-0

Add compile-time type checks for presetConfig

• Create new compile-time type check file for UserConfig and ParserPreset
• Test presetConfig assignability on both UserConfig.parserPreset and ParserPreset directly
• Verify regression fix for issue #4748 with practical configuration example

@commitlint/types/src/load.test-d.ts


Grey Divider

Qodo Logo

@qodo-code-review

qodo-code-review Bot commented May 7, 2026

Copy link
Copy Markdown

Code Review by Qodo

🐞 Bugs (0) 📘 Rule violations (0) 📎 Requirement gaps (0)

Grey Divider

Great, no issues found!

Qodo reviewed your code and found no material issues that require review

Grey Divider

Qodo Logo

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds missing typing for parserPreset.presetConfig in @commitlint/types, aligning the public TypeScript surface with the documented configuration option so TS users can configure conventional-changelog presets without excess property errors.

Changes:

  • Extend ParserPreset with optional presetConfig?: unknown.
  • Add a *.test-d.ts compile-time regression test ensuring presetConfig is assignable via UserConfig.parserPreset and ParserPreset.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
@commitlint/types/src/load.ts Adds presetConfig?: unknown to ParserPreset to match documented config usage and unblock TS configs.
@commitlint/types/src/load.test-d.ts Adds compile-time type assertions preventing regressions for parserPreset.presetConfig typing.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@escapedcat escapedcat merged commit e402cd4 into conventional-changelog:master May 12, 2026
15 checks passed
pat-s pushed a commit to devxygmbh/ansible-data-science-core that referenced this pull request May 14, 2026
…ocker tag to v21 (#88)

This PR contains the following updates:

| Package | Update | Change |
|---|---|---|
| [cr.codefloe.com/docker.io/commitlint/commitlint](https://github.com/conventional-changelog/commitlint) | major | `20.5.3` → `21.0.1` |

---

### Release Notes

<details>
<summary>conventional-changelog/commitlint (cr.codefloe.com/docker.io/commitlint/commitlint)</summary>

### [`v21.0.1`](https://github.com/conventional-changelog/commitlint/blob/HEAD/CHANGELOG.md#2101-2026-05-12)

[Compare Source](conventional-changelog/commitlint@v21.0.0...v21.0.1)

##### Bug Fixes

- **load:** only resolve relative formatter paths ([#&#8203;4761](conventional-changelog/commitlint#4761)) ([f8be069](conventional-changelog/commitlint@f8be069))
- **types:** add presetConfig to ParserPreset interface ([#&#8203;4749](conventional-changelog/commitlint#4749)) ([e402cd4](conventional-changelog/commitlint@e402cd4)), closes [#&#8203;4748](conventional-changelog/commitlint#4748)

### [`v21.0.0`](https://github.com/conventional-changelog/commitlint/blob/HEAD/CHANGELOG.md#2100-2026-05-08)

[Compare Source](conventional-changelog/commitlint@v20.5.3...v21.0.0)

##### Bug Fixes

- widen cz-commitlint inquirer peer dep to support v9-v12 [#&#8203;4554](conventional-changelog/commitlint#4554) ([#&#8203;4682](conventional-changelog/commitlint#4682)) ([341f0c4](conventional-changelog/commitlint@341f0c4))

- chore!: minimum node version v22 ([#&#8203;4679](conventional-changelog/commitlint#4679)) ([ac2b3f4](conventional-changelog/commitlint@ac2b3f4)), closes [#&#8203;4679](conventional-changelog/commitlint#4679)

##### BREAKING CHANGES

- drop node v18 and v20 support

* Bump engines to >=v22 in all 39 package.json files
* Update [@&#8203;types/node](https://github.com/types/node) to ^22.0.0
* Update CI matrix to \[22, 24]
* Update Ubuntu baseline job to ubuntu:26.04
* Update Dockerfile.ci, .mise.toml, .codesandbox/ci.json
* Update pre-commit hook to use --ignore-engines
* Update README and docs

Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

#### [20.5.3](conventional-changelog/commitlint@v20.5.2...v20.5.3) (2026-04-30)

**Note:** Version bump only for package [@&#8203;commitlint/root](https://github.com/commitlint/root)

#### [20.5.2](conventional-changelog/commitlint@v20.5.1...v20.5.2) (2026-04-25)

##### Bug Fixes

- update dependency global-directory to v5 ([#&#8203;4698](conventional-changelog/commitlint#4698)) ([a8b6224](conventional-changelog/commitlint@a8b6224))

#### [20.5.1](conventional-changelog/commitlint@v20.5.0...v20.5.1) (2026-03-31)

##### Bug Fixes

- **cz-commitlint:** add VS16 to single character emojis ([#&#8203;4666](conventional-changelog/commitlint#4666)) ([9e3e2d3](conventional-changelog/commitlint@9e3e2d3))
- **cz-commitlint:** handle modifiers correctly ([#&#8203;4667](conventional-changelog/commitlint#4667)) ([5a3ebf5](conventional-changelog/commitlint@5a3ebf5))
- update dependency global-directory to v5 ([#&#8203;4671](conventional-changelog/commitlint#4671)) ([a300d32](conventional-changelog/commitlint@a300d32))

##### Reverts

- Revert "fix: update dependency global-directory to v5 ([#&#8203;4671](conventional-changelog/commitlint#4671))" ([#&#8203;4677](conventional-changelog/commitlint#4677)) ([0f124c9](conventional-changelog/commitlint@0f124c9)), closes [#&#8203;4671](conventional-changelog/commitlint#4671) [#&#8203;4677](conventional-changelog/commitlint#4677)

</details>

---

### Configuration

📅 **Schedule**: Branch creation - Between 12:00 AM and 03:59 AM ( * 0-3 * * * ) (UTC), Automerge - Between 12:00 AM and 03:59 AM ( * 0-3 * * * ) (UTC).

🚦 **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 this update 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:eyJjcmVhdGVkSW5WZXIiOiI0My4zMS4wIiwidXBkYXRlZEluVmVyIjoiNDMuMzEuMCIsInRhcmdldEJyYW5jaCI6Im1haW4iLCJsYWJlbHMiOltdfQ==-->

Co-authored-by: devxy-bot <no-reply@devxy.io>
Reviewed-on: https://codefloe.com/devxy/ansible-data-science-core/pulls/88
pat-s pushed a commit to devxygmbh/starlight-theme-celestia that referenced this pull request May 26, 2026
…ocker tag to v21 (#16)

This PR contains the following updates:

| Package | Update | Change |
|---|---|---|
| [cr.codefloe.com/docker.io/commitlint/commitlint](https://github.com/conventional-changelog/commitlint) | major | `20.5.3` → `21.0.1` |

---

### Release Notes

<details>
<summary>conventional-changelog/commitlint (cr.codefloe.com/docker.io/commitlint/commitlint)</summary>

### [`v21.0.1`](https://github.com/conventional-changelog/commitlint/blob/HEAD/CHANGELOG.md#2101-2026-05-12)

[Compare Source](conventional-changelog/commitlint@v21.0.0...v21.0.1)

##### Bug Fixes

- **load:** only resolve relative formatter paths ([#&#8203;4761](conventional-changelog/commitlint#4761)) ([f8be069](conventional-changelog/commitlint@f8be069))
- **types:** add presetConfig to ParserPreset interface ([#&#8203;4749](conventional-changelog/commitlint#4749)) ([e402cd4](conventional-changelog/commitlint@e402cd4)), closes [#&#8203;4748](conventional-changelog/commitlint#4748)

### [`v21.0.0`](https://github.com/conventional-changelog/commitlint/blob/HEAD/CHANGELOG.md#2100-2026-05-08)

[Compare Source](conventional-changelog/commitlint@v20.5.3...v21.0.0)

##### Bug Fixes

- widen cz-commitlint inquirer peer dep to support v9-v12 [#&#8203;4554](conventional-changelog/commitlint#4554) ([#&#8203;4682](conventional-changelog/commitlint#4682)) ([341f0c4](conventional-changelog/commitlint@341f0c4))

- chore!: minimum node version v22 ([#&#8203;4679](conventional-changelog/commitlint#4679)) ([ac2b3f4](conventional-changelog/commitlint@ac2b3f4)), closes [#&#8203;4679](conventional-changelog/commitlint#4679)

##### BREAKING CHANGES

- drop node v18 and v20 support

* Bump engines to >=v22 in all 39 package.json files
* Update [@&#8203;types/node](https://github.com/types/node) to ^22.0.0
* Update CI matrix to \[22, 24]
* Update Ubuntu baseline job to ubuntu:26.04
* Update Dockerfile.ci, .mise.toml, .codesandbox/ci.json
* Update pre-commit hook to use --ignore-engines
* Update README and docs

Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

#### [20.5.3](conventional-changelog/commitlint@v20.5.2...v20.5.3) (2026-04-30)

**Note:** Version bump only for package [@&#8203;commitlint/root](https://github.com/commitlint/root)

#### [20.5.2](conventional-changelog/commitlint@v20.5.1...v20.5.2) (2026-04-25)

##### Bug Fixes

- update dependency global-directory to v5 ([#&#8203;4698](conventional-changelog/commitlint#4698)) ([a8b6224](conventional-changelog/commitlint@a8b6224))

#### [20.5.1](conventional-changelog/commitlint@v20.5.0...v20.5.1) (2026-03-31)

##### Bug Fixes

- **cz-commitlint:** add VS16 to single character emojis ([#&#8203;4666](conventional-changelog/commitlint#4666)) ([9e3e2d3](conventional-changelog/commitlint@9e3e2d3))
- **cz-commitlint:** handle modifiers correctly ([#&#8203;4667](conventional-changelog/commitlint#4667)) ([5a3ebf5](conventional-changelog/commitlint@5a3ebf5))
- update dependency global-directory to v5 ([#&#8203;4671](conventional-changelog/commitlint#4671)) ([a300d32](conventional-changelog/commitlint@a300d32))

##### Reverts

- Revert "fix: update dependency global-directory to v5 ([#&#8203;4671](conventional-changelog/commitlint#4671))" ([#&#8203;4677](conventional-changelog/commitlint#4677)) ([0f124c9](conventional-changelog/commitlint@0f124c9)), closes [#&#8203;4671](conventional-changelog/commitlint#4671) [#&#8203;4677](conventional-changelog/commitlint#4677)

</details>

---

### Configuration

📅 **Schedule**: Branch creation - Between 12:00 AM and 03:59 AM ( * 0-3 * * * ) (UTC), Automerge - Between 12:00 AM and 03:59 AM ( * 0-3 * * * ) (UTC).

🚦 **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 this update 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:eyJjcmVhdGVkSW5WZXIiOiI0My4zMS4wIiwidXBkYXRlZEluVmVyIjoiNDMuMzEuMCIsInRhcmdldEJyYW5jaCI6Im1haW4iLCJsYWJlbHMiOltdfQ==-->

Co-authored-by: devxy-bot <no-reply@devxy.io>
Reviewed-on: https://codefloe.com/devxy/starlight-theme-celestia/pulls/16
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.

fix: config.parserPreset.presetConfig unknown field

3 participants