1 Star 0 Fork 86

夕林 / Hippy

forked from 腾讯开源 / Hippy 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
commitlint.config.js 1.90 KB
一键复制 编辑 原始数据 按行查看 历史
/* eslint-disable no-control-regex */
function asciiAndEmojiCheck(message) {
const asciiAndEmojiReg = /^((\ud83c[\udf00-\udfff])|(\ud83d[\udc00-\ude4f\ude80-\udeff])|[\u2600-\u2B55]|[\x00-\xff])*$/i;
return asciiAndEmojiReg.test(message);
}
module.exports = {
extends: [
'@commitlint/config-conventional',
],
plugins: ['commitlint-plugin-function-rules'],
rules: {
'header-max-length': [2, 'always', 72],
'header-min-length': [0],
'function-rules/header-min-length': [
2,
'always',
(parsed) => {
const { subject } = parsed;
if (!subject) return [false, 'header subject cannot be empty'];
const { length } = subject;
const minLength = 8;
if (length >= minLength) {
return [true];
}
return [false, `header subject cannot be shorter than ${minLength} characters, current length is ${length}`];
},
],
'type-enum': [
2,
'always',
[
'build', // build
'ci', // ci
'chore', // Other changes that don't modify src or test files.
'docs', // Adds or alters documentation.
'feat', // Adds a new feature.
'fix', // Solves a bug.
'perf', // Improves performance.
'refactor', // Rewrites code without feature, performance or bug changes.
'revert', // Reverts a previous commit.
'style', // Improves formatting, white-space.
'test', // Adds or modifies tests.
],
],
'scope-empty': [2, 'never'],
'subject-case': [0],
'function-rules/subject-case': [
2,
'always',
(parsed) => {
const { header, body } = parsed;
const isAsciiAndEmoji = [header, body].every(message => asciiAndEmojiCheck(message));
if (isAsciiAndEmoji) {
return [true];
}
return [false, 'commit message header and body must only use English or Emoji'];
},
],
},
};
JavaScript
1
https://gitee.com/gaoluona/Hippy.git
git@gitee.com:gaoluona/Hippy.git
gaoluona
Hippy
Hippy
master

搜索帮助