Skip to content

fix(cz-commitlint): handle modifiers correctly#4667

Merged
escapedcat merged 1 commit intoconventional-changelog:masterfrom
mrt181:fix/handle-emoji-modifiers
Mar 17, 2026
Merged

fix(cz-commitlint): handle modifiers correctly#4667
escapedcat merged 1 commit intoconventional-changelog:masterfrom
mrt181:fix/handle-emoji-modifiers

Conversation

@mrt181
Copy link
Copy Markdown
Contributor

@mrt181 mrt181 commented Mar 17, 2026

When adding VS16 to emojis with modifiers, VS16 can not be appended at the end - this creates an invalid unicode symbol. VS16 must be appended between emoji and modifiers.

Description

When emojis are used with modifiers like skin tones the VS16 must be added between emoji and modifier, not at the end.

Motivation and Context

This was a review finding of the fix that added VS16 for emojis without modifiers as a potential bug.

Usage examples

How Has This Been Tested?

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.

@qodo-code-review
Copy link
Copy Markdown

Review Summary by Qodo

Fix VS16 placement for emojis with skin tone modifiers

🐞 Bug fix

Grey Divider

Walkthroughs

Description
• Fix VS16 placement for emojis with modifiers like skin tones
• Insert VS16 between base emoji and modifiers, not at end
• Add comprehensive test coverage for emoji normalization
• Improve documentation of emoji normalization logic
Diagram
flowchart LR
  A["Emoji with modifier<br/>e.g., 🛠🏽"] --> B["Extract base char<br/>and modifiers"]
  B --> C["Check if VS16 needed"]
  C --> D["Insert VS16 between<br/>base and modifiers"]
  D --> E["Normalized emoji<br/>🛠\uFE0F🏽"]
Loading

Grey Divider

File Changes

1. @commitlint/cz-commitlint/src/services/getRuleQuestionConfig.ts 🐞 Bug fix +30/-12

Refactor emoji normalization to handle modifiers correctly

• Add GraphemeSegment interface for type safety
• Refactor normalizeEmoji() to handle emoji clusters with modifiers
• Extract base character and modifiers separately using code points
• Insert VS16 between base emoji and modifiers instead of at the end
• Improve JSDoc comments with detailed explanation of emoji normalization

@commitlint/cz-commitlint/src/services/getRuleQuestionConfig.ts


2. @commitlint/cz-commitlint/src/services/getRuleQuestionConfig.test.ts 🧪 Tests +49/-0

Add test coverage for emoji modifier normalization

• Add new test case for emojis with skin tone modifiers
• Test three emoji scenarios: base emoji, emoji with skin tone, and naturally wide emoji with skin
 tone
• Verify correct VS16 placement in normalized output
• Ensure enum list formatting is correct for all emoji types

@commitlint/cz-commitlint/src/services/getRuleQuestionConfig.test.ts


Grey Divider

Qodo Logo

@qodo-code-review
Copy link
Copy Markdown

qodo-code-review Bot commented Mar 17, 2026

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

ⓘ The new review experience is currently in Beta. Learn more

Grey Divider

Qodo Logo

@codesandbox-ci
Copy link
Copy Markdown

codesandbox-ci Bot commented Mar 17, 2026

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.

@escapedcat

This comment was marked as resolved.

When adding VS16 to emojis with modifiers, VS16 can not be appended
at the end - this creates an invalid unicode symbol. VS16 must be
appended between emoji and modifiers.
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Updates emoji normalization in @commitlint/cz-commitlint to ensure terminal column alignment remains consistent when enum option emojis include additional codepoints (notably skin tone modifiers), and adds regression coverage.

Changes:

  • Adjust normalizeEmoji to insert VS16 (U+FE0F) immediately after the emoji base codepoint within a single grapheme cluster (rather than appending at the end of the string).
  • Add a test case covering normalization behavior for emojis with skin tone modifiers (and ensuring Emoji_Presentation emojis remain unchanged).

Reviewed changes

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

File Description
@commitlint/cz-commitlint/src/services/getRuleQuestionConfig.ts Fixes emoji normalization to place VS16 after the base character so modifiers/ZWJ sequences aren’t disrupted.
@commitlint/cz-commitlint/src/services/getRuleQuestionConfig.test.ts Adds regression test for skin-tone-modified emoji normalization and expected enum list formatting.

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

You can also share your feedback on Copilot code review. Take the survey.

@escapedcat escapedcat merged commit 5a3ebf5 into conventional-changelog:master Mar 17, 2026
20 checks passed
This was referenced Mar 31, 2026
This was referenced Apr 25, 2026
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.

3 participants