fix(types): add scope-delimiter-style types#4592
fix(types): add scope-delimiter-style types#4592escapedcat merged 1 commit intoconventional-changelog:masterfrom
Conversation
PR Compliance Guide 🔍Below is a summary of compliance checks for this PR:
Compliance status legend🟢 - Fully Compliant🟡 - Partial Compliant 🔴 - Not Compliant ⚪ - Requires Further Human Verification 🏷️ - Compliance label |
|||||||||||||||||||||||
|
This pull request is automatically built and testable in CodeSandbox. To see build info of the built libraries, click here or the icon next to each commit SHA. |
PR Code Suggestions ✨Explore these optional code suggestions:
|
|||||||||
There was a problem hiding this comment.
Pull request overview
This PR adds TypeScript type definitions to support object-based configurations for scope-related rules. Previously, the TypeScript types only allowed tuple-based formats while the runtime already supported object-based configurations, causing type errors for valid configurations.
- Introduces
ObjectRuleConfiggeneric type for object-based rule configurations - Extends
scope-caseandscope-enumtypes to support both traditional and object formats with optional delimiters - Adds missing
scope-delimiter-stylerule type definition
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
Thanks! |
|
Now everything works fine. Thank you! |
User description
Description
This PR adds TypeScript support for object-based configurations introduced in the previous changes (#4580).
While the runtime behavior and config validation already support object-based values for scope-enum and scope-case, TypeScript types were still restricted to the tuple-based format only. As a result, valid configurations caused TypeScript errors even though commitlint worked correctly at runtime.
This change extends the rule value types only for the affected rules (
scope-enumandscope-case) to allow object-based configurations, without altering shared generic rule types. This keeps the existing type model intact while aligning TypeScript definitions with the actual supported configuration format.No runtime behavior is changed, this PR only updates TypeScript types to reflect the existing functionality.
Types of changes
Checklist:
PR Type
Bug fix
Description
Add
ObjectRuleConfiggeneric type for object-based rule configurationsExtend
scope-casetype to support object format with cases and delimitersExtend
scope-enumtype to support object format with scopes and delimitersAdd
scope-delimiter-stylerule type to RulesConfigDiagram Walkthrough
File Walkthrough
rules.ts
Add object-based scope rule configuration types@commitlint/types/src/rules.ts
ObjectRuleConfiggeneric type to support object-basedconfigurations
scope-caseto union type allowing bothCaseRuleConfigandobject format with
casesand optionaldelimitersscope-enumto union type allowing bothEnumRuleConfigandobject format with
scopesand optionaldelimitersscope-delimiter-stylerule usingEnumRuleConfigtype