Skip to content

Instantly share code, notes, and snippets.

@shettayyy
Last active September 25, 2025 20:45
Show Gist options
  • Save shettayyy/094c8b5e695ed95467930b0ecfede2a9 to your computer and use it in GitHub Desktop.
Save shettayyy/094c8b5e695ed95467930b0ecfede2a9 to your computer and use it in GitHub Desktop.
This configuration extends @commitlint/config-conventional with strict rules for commit formatting (type, scope, subject, body, footer). It enforces lowercase casing, specific type/scope enums, and line-length limits. The prompt section customizes the interactive commit wizard with descriptive messages, emojis, and guided questions, helping cont…
const CASE = "lower-case";
const config = {
defaultIgnores: true,
extends: ["@commitlint/config-conventional"],
prompt: {
messages: {
emptyWarning: "can not be empty",
lowerLimitWarning: "below limit",
max: "upper %d chars",
min: "%d chars at least",
skip: ":skip",
upperLimitWarning: "over limit",
},
questions: {
body: {
description: "Provide a longer description of the change",
},
breaking: {
description: "Describe the breaking changes",
},
breakingBody: {
description:
"A BREAKING CHANGE commit requires a body. Please enter a longer description of the commit itself",
},
isBreaking: {
description: "Are there any breaking changes?",
},
isIssueAffected: {
description: "Does this change affect any open issues?",
},
issues: {
description: 'Add issue references (e.g. "fix #123", "re #123".)',
},
issuesBody: {
description:
"If issues are closed, the commit requires a body. Please enter a longer description of the commit itself",
},
scope: {
description:
"What is the scope of this change (e.g. component or file name)",
},
subject: {
description:
"Write a short, imperative tense description of the change",
},
type: {
description: "Select the type of change that you're committing:",
enum: {
build: {
description:
"Changes that affect the build system or external dependencies (example scopes: gulp, broccoli, npm)",
emoji: "πŸ› ",
title: "Builds",
},
chore: {
description: "Other changes that don't modify src or test files",
emoji: "♻️",
title: "Chores",
},
ci: {
description:
"Changes to our CI configuration files and scripts (example scopes: Travis, Circle, BrowserStack, SauceLabs)",
emoji: "βš™οΈ",
title: "Continuous Integrations",
},
docs: {
description: "Documentation only changes",
emoji: "πŸ“š",
title: "Documentation",
},
feat: {
description: "A new feature",
emoji: "✨",
title: "Features",
},
fix: {
description: "A bug fix",
emoji: "πŸ›",
title: "Bug Fixes",
},
perf: {
description: "A code change that improves performance",
emoji: "πŸš€",
title: "Performance Improvements",
},
refactor: {
description:
"A code change that neither fixes a bug nor adds a feature",
emoji: "πŸ“¦",
title: "Code Refactoring",
},
revert: {
description: "Reverts a previous commit",
emoji: "πŸ—‘",
title: "Reverts",
},
style: {
description:
"Changes that do not affect the meaning of the code (white-space, formatting, visual changes, missing semi-colons, etc)",
emoji: "πŸ’Ž",
title: "Styles",
},
test: {
description: "Adding missing tests or correcting existing tests",
emoji: "🚨",
title: "Tests",
},
},
},
},
settings: {
enableMultipleScopes: true,
scopeEnumSeparator: ",",
},
},
rules: {
"body-leading-blank": [2, "always"],
"body-max-line-length": [2, "always", 100],
"footer-leading-blank": [2, "always"],
"footer-max-line-length": [2, "always", 100],
"header-max-length": [2, "always", 100],
"scope-case": [2, "always", CASE],
"scope-empty": [2, "never"],
"scope-enum": [
2,
"always",
[
"dep",
"config",
"util",
"asset",
"ui",
"hook",
"context",
"store",
"route"
],
],
"subject-empty": [2, "never"],
"subject-full-stop": [2, "never", "."],
"type-case": [2, "always", CASE], // Ensure blank line after subject
"type-enum": [
2,
"always",
[
"feat", // A new feature
"fix", // A bug fix
"refactor", // A code change that neither fixes a bug nor adds a feature
"style", // Changes that do not affect the meaning of the code
"chore", // Regular maintenance tasks
"perf", // A code change that improves performance
"test", // Adding tests or correcting existing tests
"doc", // Documentation only changes
"build", // Changes that affect the build system or external dependencies
"ci", // Changes to CI configuration files and scripts
"revert", // Reverts a previous commit
],
], // Ensure blank line before footer
},
};
export default config;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment