UNPKG

@tianyio/quality-helper

Version:

A comprehensive quality helper tool for project scaffolding and management

181 lines (180 loc) 5.74 kB
module.exports = { extends: ['@commitlint/config-conventional'], rules: { 'type-enum': [ 2, 'always', [ /* 'feat', // 新功能 (兼容标准) 'fix', // 修复bug (兼容标准) */ 'update', // 新功能 (自定义) 'defect', // 修复bug (自定义) 'docs', // 文档更新 'style', // 代码格式化 'refactor', // 重构 'perf', // 性能优化 'test', // 测试相关 'build', // 构建相关 'ci', // CI/CD相关 'chore', // 其他杂项 'revert', // 回滚 'wip', // 进行中的工作 'release', // 发布版本 'hotfix', // 热修复 'security', // 安全修复 ], ], 'type-case': [2, 'always', 'lower-case'], 'type-empty': [2, 'never'], 'scope-case': [2, 'always', 'lower-case'], 'scope-empty': [0, 'never'], // 允许空的 scope 'subject-case': [2, 'never', ['sentence-case', 'start-case', 'pascal-case', 'upper-case']], 'subject-empty': [2, 'never'], 'subject-full-stop': [2, 'never', '.'], 'subject-min-length': [2, 'always', 4], // 主题最少4个字符 'subject-max-length': [2, 'always', 50], // 主题最多50个字符 'header-max-length': [2, 'always', 100], 'body-leading-blank': [1, 'always'], 'body-max-line-length': [2, 'always', 100], // 正文每行最多100字符 'footer-leading-blank': [1, 'always'], 'footer-max-line-length': [2, 'always', 100], // 页脚每行最多100字符 }, prompt: { questions: { type: { description: '选择你要提交的类型:', enum: { /* feat: { description: '新功能 (标准)', title: 'Features', emoji: '✨' }, fix: { description: '修复bug (标准)', title: 'Bug Fixes', emoji: '🐛' }, */ update: { description: '新功能', title: 'Features', emoji: '✨', }, defect: { description: '修复bug', title: 'Bug Fixes', emoji: '🐛', }, docs: { description: '文档更新', title: 'Documentation', emoji: '📚', }, style: { description: '代码格式化(不影响代码运行的变动)', title: 'Styles', emoji: '💎', }, refactor: { description: '重构(既不是新增功能,也不是修改bug的代码变动)', title: 'Code Refactoring', emoji: '📦', }, perf: { description: '性能优化', title: 'Performance Improvements', emoji: '🚀', }, test: { description: '增加测试', title: 'Tests', emoji: '🚨', }, build: { description: '构建过程或辅助工具的变动', title: 'Builds', emoji: '🛠', }, ci: { description: 'CI配置文件和脚本的变动', title: 'Continuous Integrations', emoji: '⚙️', }, chore: { description: '其他不修改src或测试文件的变动', title: 'Chores', emoji: '♻️', }, revert: { description: '回滚之前的提交', title: 'Reverts', emoji: '🗑', }, wip: { description: '进行中的工作', title: 'Work in Progress', emoji: '🚧', }, release: { description: '发布版本', title: 'Releases', emoji: '🔖', }, hotfix: { description: '热修复', title: 'Hotfixes', emoji: '🚑', }, security: { description: '安全修复', title: 'Security', emoji: '🔒', }, }, }, scope: { description: '本次提交的影响范围(可选,如: api, ui, core):', }, subject: { description: '简短描述 (4-50个字符):', }, body: { description: '详细描述(可选):', }, isBreaking: { description: '是否包含破坏性变更?', }, breakingBody: { description: '破坏性变更的详细描述:', }, breaking: { description: '描述破坏性变更:', }, isIssueAffected: { description: '是否影响某个issue?', }, issuesBody: { description: '如果issues已关闭,提交需要一个body。请输入一个更长的描述:', }, issues: { description: '添加issue引用 (例如: "fix #123", "close #123", "ref #123"):', }, }, // 自定义提示消息 messages: { type: '请选择提交类型:', scope: '请输入修改范围 (可选):', customScope: '请输入自定义的修改范围:', subject: '请简要描述提交 (必填):', body: '请输入详细描述 (可选,使用 "|" 换行):', breaking: '列出任何破坏性变更 (可选):', footer: '请输入要关闭的issue (可选):', confirmCommit: '确认使用以上信息提交?(y/n)', }, }, // 忽略某些提交 ignores: [commit => commit.includes('init'), commit => commit.includes('wip')], // 默认忽略合并提交 defaultIgnores: true, // 帮助信息 helpUrl: 'https://github.com/conventional-changelog/commitlint/#what-is-commitlint', }