Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

feat(cz-commitlint): support customizable commit prompt with emojis #4540

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
parloti wants to merge 2 commits into conventional-changelog:master
base: master
Choose a base branch
Loading
from parloti:master

Conversation

Copy link

@parloti parloti commented Aug 26, 2025
edited
Loading

Description

This PR adds customizable emojis to the Commitlint prompt. This allows users to define richer, more informative options for commit types, which enhances the user experience and provides better context during the commit process.

Motivation and Context

The previous prompt was limited to displaying simple, text-based commit types. There was no way to add visual cues like emojis or descriptive text directly within the prompt's options, which made it less intuitive for developers. This change addresses that limitation.

TODO emoji + title
#3618
#4534

Usage examples

The documentation was updated with examples.

How Has This Been Tested?

Extensive tests were added to confirm that the enumList is formatted correctly, alignment is handled properly, and the emojiInHeader option functions as expected.

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.

Copy link

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.

Copy link
Author

parloti commented Aug 26, 2025
edited
Loading

Hey guys, tabs like I mentioned here don't work well.
Each terminal handles emojis differently; if you correct them for one, they break in another. So using single spaces allows the user to customize them to their needs.

I only have Windows 11 here, on other systems you may have different behaviors.

Default configuration

vs code
vs-code

git-bash
git-bash

cmd
cmd

power shell
power_shell

Adding space to force alignment in vs code

example

vs code
vs-code

git-bash
git-bash

cmd
cmd

power shell
power-shell

Copy link
Author

parloti commented Aug 26, 2025

@ViniDevBR I think a PR with an example with gitmoji in the documentation would be welcome.

Copy link

@ViniDevBR I think a PR with an example with gitmoji in the documentation would be welcome.

Nice. but i think that them will not accept this PR because of the space in powershell. But lets wait for this.
If not approve we can just remove the icon from CLI and just add this in the final message.

About the documentation...
I created one in other issue or PR that you was with me

import { UserConfig } from "@commitlint/types";
import gitmoji from 'commitlint-config-gitmoji'
/**
 * @type {import('@commitlint/types').UserConfig}
 */
module.exports = {
 extends: ['@commitlint/config-conventional'],
 prompt: {
 questions: {
 type: {
 description: "Select the type of change that you're committing",
 enum: {
 feat: {
 description: "A new feature",
 title: "Features",
 emoji: "✨",
 },
 fix: {
 description: "A bug fix",
 title: "Bug Fixes",
 emoji: "🐛",
 },
 docs: {
 description: "Documentation only changes",
 title: "Documentation",
 emoji: "📚",
 },
 style: {
 description:
 "Changes that do not affect the meaning of the code (linters)",
 title: "Styles",
 emoji: "🎨",
 },
 refactor: {
 description:
 "A code change that neither fixes a bug nor adds a feature",
 title: "Code Refactoring",
 emoji: "📦",
 },
 perf: {
 description: "A code change that improves performance",
 title: "Performance Improvements",
 emoji: "🚀",
 },
 test: {
 description: "Adding missing tests or correcting existing tests",
 title: "Tests",
 emoji: "🚨",
 },
 build: {
 description:
 "Changes that affect the build system or external dependencies (yarn)",
 title: "Builds",
 emoji: "🏗️ ",
 },
 ci: {
 description:
 "Changes to our CI configuration files and scripts (GitActions)",
 title: "Continuous Integrations",
 emoji: "⚙️ ",
 },
 chore: {
 description: "Other changes that don't modify src or test files",
 title: "Chores",
 emoji: "♻️ ",
 },
 revert: {
 description: "Reverts a previous commit",
 title: "Reverts",
 emoji: "⏪",
 },
 },
 },
 },
 },
 parserPreset: {
 parserOpts: gitmoji.parserPreset.parserOpts,
 plugins: [gitmoji.parserPreset.plugins],
 },
 ...gitmoji.rules,
 ...gitmoji.plugins
} as UserConfig

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Reviewers
No reviews
Assignees
No one assigned
Labels
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

AltStyle によって変換されたページ (->オリジナル) /