Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
monorepo
/
venus
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
1
Merge Requests
0
Pipelines
Wiki
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit 0b9f2f16
authored
Jan 09, 2026
by
Jaxon
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
feat: 添加 Vue2 自定义 ESLint 配置并调整现有规则
1 parent
f98e0062
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
49 additions
and
2 deletions
internal/lint-configs/eslint-config/src/configs/unicorn.ts
internal/lint-configs/eslint-config/src/configs/vue.ts
internal/lint-configs/eslint-config/src/custom-config/index.ts
internal/lint-configs/eslint-config/src/custom-config/vue2.ts
internal/lint-configs/eslint-config/src/configs/unicorn.ts
View file @
0b9f2f1
...
@@ -23,6 +23,8 @@ export async function unicorn(): Promise<Linter.Config[]> {
...
@@ -23,6 +23,8 @@ export async function unicorn(): Promise<Linter.Config[]> {
ignores
:
[
"**/*.wxml"
],
ignores
:
[
"**/*.wxml"
],
rules
:
{
rules
:
{
...
pluginUnicorn
.
configs
.
recommended
.
rules
,
...
pluginUnicorn
.
configs
.
recommended
.
rules
,
"unicorn/no-array-reduce"
:
"off"
,
"unicorn/prefer-array-some"
:
"off"
,
"unicorn/no-abusive-eslint-disable"
:
"off"
,
"unicorn/no-abusive-eslint-disable"
:
"off"
,
"unicorn/no-this-assignment"
:
"warn"
,
"unicorn/no-this-assignment"
:
"warn"
,
"unicorn/no-empty-file"
:
"off"
,
"unicorn/no-empty-file"
:
"off"
,
...
...
internal/lint-configs/eslint-config/src/configs/vue.ts
View file @
0b9f2f1
...
@@ -109,6 +109,7 @@ export async function vue(): Promise<Linter.Config[]> {
...
@@ -109,6 +109,7 @@ export async function vue(): Promise<Linter.Config[]> {
multiline
:
"never"
,
// 多行标签:闭合括号不换行(如 <image\n src="xxx"\n/>)
multiline
:
"never"
,
// 多行标签:闭合括号不换行(如 <image\n src="xxx"\n/>)
},
},
],
],
"vue/no-child-content"
:
"off"
,
/**
/**
* vue/component-name-in-template-casing: 要求模板中的组件使用 PascalCase 命名
* vue/component-name-in-template-casing: 要求模板中的组件使用 PascalCase 命名
* 设置原因: PascalCase 使组件易于识别,与 JavaScript 类的命名约定一致,提高代码可读性
* 设置原因: PascalCase 使组件易于识别,与 JavaScript 类的命名约定一致,提高代码可读性
...
@@ -154,7 +155,7 @@ export async function vue(): Promise<Linter.Config[]> {
...
@@ -154,7 +155,7 @@ export async function vue(): Promise<Linter.Config[]> {
* vue/eqeqeq: 要求使用 === 和 !== 而不是 == 和 !=
* vue/eqeqeq: 要求使用 === 和 !== 而不是 == 和 !=
* 设置原因: smart 模式允许与 null 比较时使用 ==,避免隐式类型转换导致的 bug,同时保持常见情况的简洁
* 设置原因: smart 模式允许与 null 比较时使用 ==,避免隐式类型转换导致的 bug,同时保持常见情况的简洁
*/
*/
"vue/eqeqeq"
:
[
"
error
"
,
"smart"
],
"vue/eqeqeq"
:
[
"
warn
"
,
"smart"
],
// 控制 Vue 模板中 HTML 标签的缩进
// 控制 Vue 模板中 HTML 标签的缩进
"vue/html-indent"
:
[
"vue/html-indent"
:
[
"error"
,
"error"
,
...
...
internal/lint-configs/eslint-config/src/custom-config/index.ts
View file @
0b9f2f1
...
@@ -13,7 +13,13 @@ import type { Linter } from "eslint";
...
@@ -13,7 +13,13 @@ import type { Linter } from "eslint";
import
{
customConfigMiniprogram
}
from
"./miniprogram"
;
import
{
customConfigMiniprogram
}
from
"./miniprogram"
;
import
{
customConfigUniapp
}
from
"./uniapp"
;
import
{
customConfigUniapp
}
from
"./uniapp"
;
import
{
customConfigVben
}
from
"./vben"
;
import
{
customConfigVben
}
from
"./vben"
;
import
{
customConfigVue2
}
from
"./vue2"
;
const
customConfig
:
Linter
.
Config
[]
=
[
...
customConfigVben
(),
...
customConfigMiniprogram
(),
...
customConfigUniapp
()
];
const
customConfig
:
Linter
.
Config
[]
=
[
...
customConfigVben
(),
...
customConfigMiniprogram
(),
...
customConfigUniapp
(),
...
customConfigVue2
()
];
export
{
customConfig
};
export
{
customConfig
};
internal/lint-configs/eslint-config/src/custom-config/vue2.ts
0 → 100644
View file @
0b9f2f1
import
type
{
Linter
}
from
"eslint"
;
export
function
customConfigVue2
():
Linter
.
Config
[]
{
return
[
{
files
:
[
"apps/**/vue2/**/**"
],
rules
:
{
// VUE3 专用规则关闭
"vue/no-v-for-template-key-on-child"
:
"warn"
,
"vue/attribute-hyphenation"
:
"warn"
,
"unicorn/prefer-query-selector"
:
"warn"
,
"vue/valid-v-for"
:
"warn"
,
"vue/require-valid-default-prop"
:
"warn"
,
"vue/no-unused-components"
:
"warn"
,
"array-callback-return"
:
"warn"
,
"vue/no-deprecated-slot-scope-attribute"
:
"warn"
,
"vue/no-deprecated-slot-attribute"
:
"off"
,
"vue/no-deprecated-v-on-native-modifier"
:
"off"
,
"vue/no-deprecated-filter"
:
"off"
,
"vue/require-explicit-emits"
:
"off"
,
"vue/no-deprecated-delete-set"
:
"off"
,
"vue/no-deprecated-v-bind-sync"
:
"off"
,
"vue/no-setup-props-destructure"
:
"off"
,
"vue/no-unsupported-features"
:
"off"
,
"vue/valid-define-props"
:
"off"
,
"vue/valid-define-emits"
:
"off"
,
"vue/no-multiple-template-root"
:
"off"
,
"vue/no-deprecated-events-api"
:
"off"
,
"vue/require-toggle-inside-transition"
:
"warn"
,
"vue/require-default-prop"
:
"warn"
,
"vue/require-slots-as-functions"
:
"warn"
,
// 其他可选规则
"vue/no-mutating-props"
:
"warn"
,
// 子组件不要直接修改 props
},
},
];
}
Write
Preview
Markdown
is supported
Attach a file
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to post a comment