Skip to content

Commit

Permalink
chore: 🏡 更换commitlint、eslint的配置文件类型,迁移至非js的配置类型
Browse files Browse the repository at this point in the history
  • Loading branch information
Vanisper committed Dec 25, 2024
1 parent 8205a70 commit 66a2f5a
Show file tree
Hide file tree
Showing 7 changed files with 651 additions and 41 deletions.
71 changes: 71 additions & 0 deletions .commitlintrc.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
extends:
- '@commitlint/config-conventional'
rules:
type-enum:
- 2
- always
-
- feat
- perf
- fix
- refactor
- docs
- build
- types
- chore
- examples
- test
- style
- ci
prompt:
messages:
type: '选择你要提交的类型 :'
scope: '选择一个提交范围 (可选) :'
customScope: '请输入自定义的提交范围 :'
subject: "填写简短精炼的变更描述 :\n"
body: "填写更加详细的变更描述 (可选) 。使用 \"|\" 换行 :\n"
breaking: "列举非兼容性重大的变更 (可选) 。使用 \"|\" 换行 :\n"
footerPrefixesSelect: '设置关联issue前缀 (可选) :'
customFooterPrefix: '输入自定义issue前缀 :'
footer: "列举关联issue (可选) 例如: #1 :\n"
confirmCommit: 是否提交或修改commit ?
types:
- value: feat
name: '🚀 Features: 新功能'
emoji: 🚀
- value: perf
name: '🔥 Performance: 性能优化'
emoji: 🔥
- value: fix
name: '🩹 Fixes: 缺陷修复'
emoji: 🩹
- value: refactor
name: '💅 Refactors: 代码重构'
emoji: 💅
- value: docs
name: '📖 Documentation: 文档'
emoji: 📖
- value: build
name: '📦 Build: 构建工具'
emoji: 📦
- value: types
name: '🌊 Types: 类型定义'
emoji: 🌊
- value: chore
name: '🏡 Chore: 简修处理'
emoji: 🏡
- value: examples
name: '🏀 Examples: 例子展示'
emoji: 🏀
- value: test
name: '✅ Tests: 测试用例'
emoji:
- value: style
name: '🎨 Styles: 代码风格'
emoji: 🎨
- value: ci
name: '🤖 CI: 持续集成'
emoji: 🤖
useEmoji: true
scopes: []
maxHeaderLength: 72
5 changes: 4 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,5 +22,8 @@
"yml",
"markdown",
"toml"
]
],
"yaml.schemas": {
"schema\\commitlint.json": ".commitlintrc.yaml"
}
}
38 changes: 0 additions & 38 deletions commitlint.config.cjs

This file was deleted.

File renamed without changes.
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
"release": "npm run build && bumpp",
"prepublishOnly": "npm run build",
"prepare": "simple-git-hooks && npm run build",
"lint": "eslint . --fix",
"lint": "eslint . --fix --flag unstable_ts_config",
"commit": "git-cz",
"example:dev:h5": "npm -C examples run dev",
"example:build:h5": "npm -C examples run build",
Expand Down Expand Up @@ -86,7 +86,7 @@
},
"lint-staged": {
"*.{js,ts,tsx,vue,md}": [
"eslint . --fix"
"eslint . --fix --flag unstable_ts_config"
]
},
"config": {
Expand Down
100 changes: 100 additions & 0 deletions schema/commitlint.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
{
"$schema": "http://json-schema.org/draft-07/schema",
"type": "object",
"definitions": {
"rule": {
"description": "A rule",
"type": "array",
"items": [
{
"description": "Level: 0 disables the rule. For 1 it will be considered a warning, for 2 an error",
"type": "number",
"enum": [0, 1, 2]
},
{
"description": "Applicable: always|never: never inverts the rule",
"type": "string",
"enum": ["always", "never"]
},
{
"description": "Value: the value for this rule",
"items": {
"description": "The allowed commit types (can be any string)."
}
}
],
"minItems": 1,
"maxItems": 3,
"additionalItems": false
}
},
"properties": {
"extends": {
"description": "Resolveable ids to commitlint configurations to extend",
"oneOf": [
{
"type": "array",
"items": { "type": "string" }
},
{ "type": "string" }
]
},
"parserPreset": {
"description": "Resolveable id to conventional-changelog parser preset to import and use",
"oneOf": [
{ "type": "string" },
{
"type": "object",
"properties": {
"name": { "type": "string" },
"path": { "type": "string" },
"parserOpts": {}
},
"additionalProperties": true
},
{ "typeof": "function" }
]
},
"helpUrl": {
"description": "Custom URL to show upon failure",
"type": "string"
},
"formatter": {
"description": "Resolveable id to package, from node_modules, which formats the output",
"type": "string"
},
"rules": {
"description": "Rules to check against",
"type": "object",
"propertyNames": { "type": "string" },
"additionalProperties": { "$ref": "#/definitions/rule" }
},
"plugins": {
"description": "Resolveable ids of commitlint plugins from node_modules",
"type": "array",
"items": {
"anyOf": [
{ "type": "string" },
{
"type": "object",
"required": ["rules"],
"properties": {
"rules": {
"type": "object"
}
}
}
]
}
},
"ignores": {
"type": "array",
"items": { "typeof": "function" },
"description": "Additional commits to ignore, defined by ignore matchers"
},
"defaultIgnores": {
"description": "Whether commitlint uses the default ignore rules",
"type": "boolean"
}
}
}
Loading

0 comments on commit 66a2f5a

Please sign in to comment.