Skip to content

Commit 71aa5ab

Browse files
author
白云苍狗
committed
🐳 chore: commitlint
1 parent c5815ff commit 71aa5ab

File tree

5 files changed

+1014
-26
lines changed

5 files changed

+1014
-26
lines changed

.commitlintrc.cts

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
export default {
2+
extends: ["@commitlint/config-conventional"],
3+
parserPreset: {
4+
parserOpts: {
5+
headerPattern:
6+
/^(?::\w*:|(?:\ud83c[\udf00-\udfff])|(?:\ud83d[\udc00-\ude4f\ude80-\udeff])|[\u2600-\u2B55])\s(?<type>\w*)(?:\((?<scope>.*)\))?!?:\s(?<subject>(?:(?!#).)*(?:(?!\s).))(?:\s\(?(?<ticket>#\d*)\)?)?$/,
7+
headerCorrespondence: ["type", "scope", "subject", "ticket"],
8+
},
9+
},
10+
rules: {
11+
"type-case": [2, "always", "lower-case"],
12+
"type-empty": [2, "never"],
13+
"type-enum": [
14+
2,
15+
"always",
16+
[
17+
"feat", // 增加新功能
18+
"fix", // 修复 bug
19+
"update", // 更新功能
20+
"docs", // 文档相关的改动
21+
"style", // 仅仅主题样式变动
22+
"format", // 代码格式化, 仅仅改版代码风格, 比如空格缩进等待
23+
"refactor", // 代码重构, 没有新增功能或修复bug
24+
"perf", // 代码优化, 比如提升性能或体验
25+
"revert", // 撤销,版本回退
26+
"test", // 添加或修改测试
27+
"build", // 构造工具或者相关依赖的改动
28+
"chore", // 改版构建流程或者增加新的依赖或工具
29+
"ci", // CI 配置,脚本文件等改动
30+
],
31+
],
32+
"subject-case": [0],
33+
},
34+
};

.husky/commit-msg

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
#!/usr/bin/env sh
2+
. "$(dirname -- "$0")/_/husky.sh"
3+
npx --no-install commitlint --edit ${1}

.prettierignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
1-
sw.js
1+
sw.js
2+
**/cache/deps

package.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,8 @@
3131
"url": "git+https://github.com/MaLuns/hexo-theme-async.git"
3232
},
3333
"devDependencies": {
34+
"@commitlint/cli": "^17.7.2",
35+
"@commitlint/config-conventional": "^17.7.0",
3436
"@types/node": "^18.8.2",
3537
"@typescript-eslint/eslint-plugin": "^6.7.5",
3638
"@typescript-eslint/parser": "^6.7.5",

0 commit comments

Comments
 (0)