-
Notifications
You must be signed in to change notification settings - Fork 943
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
Conversation
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.
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
vs code
vs-code
git-bash
git-bash
cmd
cmd
power shell
power-shell
@ViniDevBR I think a PR with an example with gitmoji in the documentation would be welcome.
ViniDevBR
commented
Aug 26, 2025
@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
Uh oh!
There was an error while loading. Please reload this page.
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 theemojiInHeader
option functions as expected.Types of changes
Checklist: