@fast-china/eslint-config 1.0.48 → 2.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,288 +1,231 @@
1
+ // src/define-rules.ts
2
+ var defineRules = (rules) => rules;
3
+
1
4
  // src/rules/common.ts
2
5
  var commonRules = {
3
- // 确保数组的回调函数(如 Array.prototype.map、Array.prototype.filter、Array.prototype.reduce 等)总是有一个返回值
6
+ // 要求数组回调在所有可到达分支返回值,避免 map/filter 等调用静默产生 undefined。
4
7
  "array-callback-return": "error",
5
- // 强制使用块级作用域变量(let 或 const),避免使用函数作用域变量(var)
6
- "block-scoped-var": "error",
7
- // 禁止使用 alert、confirm 和 prompt 等浏览器弹出对话框
8
+ // 浏览器弹窗通常不适合生产代码;使用 warn 允许原型调试,同时确保发布前能够被发现。
8
9
  "no-alert": "warn",
9
- // 禁止在 switch 语句的 case 或 default 子句中声明变量
10
+ // switch 的 case 不创建词法作用域;要求用花括号包裹声明,避免跨 case 冲突。
10
11
  "no-case-declarations": "error",
11
- // 禁止使用多行字符串,即不允许使用反斜杠 \ 来连接多行字符串
12
+ // 禁止反斜杠续行字符串,优先使用可读性更好的模板字符串。
12
13
  "no-multi-str": "error",
13
- // 禁止使用 with 语句
14
+ // with 会让标识符解析不可预测,并且在严格模式和 ESM 中不可用。
14
15
  "no-with": "error",
15
- // 禁止使用 void 操作符
16
- "no-void": "error",
17
- // 禁止多个空行
18
- "@stylistic/no-multiple-empty-lines": [
16
+ // 允许用 `void promise` 明确忽略 Promise,但禁止在普通表达式中滥用 void。
17
+ "no-void": [
19
18
  "error",
20
19
  {
21
- // 最多允许1行
22
- max: 1
20
+ allowAsStatement: true
23
21
  }
24
22
  ],
25
- // import 排序
23
+ // 要求严格相等;保留 `value == null` 同时判断 null/undefined 的常用写法。
24
+ eqeqeq: ["error", "always", { null: "ignore" }],
25
+ // 幂运算统一使用 **,减少 Math.pow 嵌套并保持现代语法风格。
26
+ "prefer-exponentiation-operator": "error",
27
+ // 使用 Object.hasOwn,避免对象覆盖或缺少 hasOwnProperty 时产生异常。
28
+ "prefer-object-has-own": "error",
29
+ // [可自动修复] 声明间顺序交给 import-x;这里只排序同一 import 的成员。
26
30
  "sort-imports": [
27
31
  "warn",
28
32
  {
29
- // 不忽略导入语句中模块名的大小写
30
33
  ignoreCase: false,
31
- // 忽略导入声明的排序
32
34
  ignoreDeclarationSort: true,
33
- // 不忽略导入成员的排序
34
35
  ignoreMemberSort: false,
35
- // 成员语法排序顺序
36
36
  memberSyntaxSortOrder: ["none", "all", "multiple", "single"],
37
- // 不允许分组导入
38
37
  allowSeparatedGroups: false
39
38
  }
40
- ],
41
- // 强制在数学运算中使用 ** 运算符代替 Math.pow()
42
- "prefer-exponentiation-operator": "error"
39
+ ]
43
40
  };
44
41
 
45
42
  // src/rules/import.ts
46
- var importUseLodashUnifiedRules = {
47
- // 限制某些模块导入
48
- "no-restricted-imports": [
49
- "error",
50
- {
51
- paths: [
52
- { name: "lodash", message: "Use lodash-unified instead." },
53
- { name: "lodash-es", message: "Use lodash-unified instead." }
54
- ],
55
- patterns: [
56
- {
57
- group: ["lodash/*", "lodash-es/*"],
58
- message: "Use lodash-unified instead."
59
- }
60
- ]
61
- }
62
- ]
63
- };
64
- var importUseLodashRules = {
65
- // 限制某些模块导入
66
- "no-restricted-imports": [
67
- "error",
68
- {
69
- paths: [
70
- { name: "lodash-es", message: "Use lodash instead." },
71
- { name: "lodash-unified", message: "Use lodash instead." }
72
- ],
73
- patterns: [
74
- {
75
- group: ["lodash-es/*", "lodash-unified/*"],
76
- message: "Use lodash instead."
77
- }
78
- ]
79
- }
80
- ]
81
- };
82
43
  var importRules = {
83
- // 确保所有的 import 语句位于文件的顶部,紧接在文件的开头部分,且在任何其他代码之前
44
+ // import 必须位于其他语句之前,避免模块依赖散落在执行逻辑中。
84
45
  "import-x/first": "error",
85
- // 禁止在同一文件中出现重复的 import 语句
46
+ // 合并同一模块的重复 import,避免绑定分散或副作用被误读。
86
47
  "import-x/no-duplicates": "error",
87
- // 导入模块排序风格
48
+ // [高影响][可自动修复] 按来源分组并排序;带副作用的裸 import 仅报告,人工移动前必须确认执行顺序。
88
49
  "import-x/order": [
89
50
  "error",
90
51
  {
91
- // 导入模块分组
92
52
  groups: [
93
53
  // Node.js 内置模块
94
54
  "builtin",
95
- // 第三方模块
55
+ // 第三方依赖
96
56
  "external",
97
- // 项目内部模块
57
+ // 项目内部别名模块
98
58
  "internal",
99
- // 父级目录中的模块
59
+ // 父级目录模块
100
60
  "parent",
101
- // 具有相同父级的模块
61
+ // 同级目录模块
102
62
  "sibling",
103
- // 当前目录的 index.js 或 index.ts 文件
63
+ // 当前目录入口模块
104
64
  "index",
65
+ // TypeScript import = require() 导入
105
66
  "object",
67
+ // TypeScript 类型导入
106
68
  "type",
69
+ // 无法识别分类的导入
107
70
  "unknown"
108
71
  ],
109
- pathGroups: [
110
- {
111
- pattern: "@dcloudio/*",
112
- group: "external",
113
- position: "before"
114
- },
115
- {
116
- pattern: "vue",
117
- group: "external",
118
- position: "before"
119
- },
120
- {
121
- pattern: "@vue/**",
122
- group: "external",
123
- position: "before"
124
- },
125
- {
126
- pattern: "element-plus",
127
- group: "external",
128
- position: "before"
129
- },
130
- {
131
- pattern: "@element-plus/**",
132
- group: "external",
133
- position: "before"
134
- },
135
- {
136
- pattern: "fast-element-plus",
137
- group: "external",
138
- position: "before"
139
- },
140
- {
141
- pattern: "@fast-element-plus/**",
142
- group: "external",
143
- position: "before"
144
- },
145
- {
146
- pattern: "@fast-china/**",
147
- group: "external",
148
- position: "before"
149
- },
150
- {
151
- pattern: "lodash",
152
- group: "external",
153
- position: "before"
154
- },
155
- {
156
- pattern: "lodash-es",
157
- group: "external",
158
- position: "before"
159
- },
160
- {
161
- pattern: "lodash-unified",
162
- group: "external",
163
- position: "before"
164
- }
165
- ],
166
- pathGroupsExcludedImportTypes: ["type"],
167
- // 禁止不同组之间进行换行
168
- "newlines-between": "never",
169
- // 根据字母顺序对每个组内的顺序进行排序
72
+ // 不同 import 分组之间必须保留一个空行
73
+ "newlines-between": "always",
74
+ // 同一分组内按照模块路径字母升序排列
170
75
  alphabetize: {
171
76
  order: "asc",
172
77
  caseInsensitive: true
173
- }
78
+ },
79
+ // 对没有赋值给变量的副作用导入进行排序检查
80
+ warnOnUnassignedImports: true
174
81
  }
175
82
  ],
176
- // 关闭 - 禁用对无法解析的模块导入的检查
83
+ // [默认关闭] Vite/TypeScript 别名由项目解析器校验,避免共享配置绑定特定 resolver。
177
84
  "import-x/no-unresolved": "off",
178
- // 关闭 - 禁用对命名空间导入(例如,import * as)的检查
85
+ // [默认关闭] 未配置 resolver 时,namespace 导出的静态分析容易产生误报。
179
86
  "import-x/namespace": "off",
180
- // 关闭 - 禁用对默认导入的检查
87
+ // [默认关闭] 未配置 resolver 时,默认导出的静态分析容易产生误报。
181
88
  "import-x/default": "off",
182
- // 关闭 - 禁用对以默认导出方式作为命名导入的检查
89
+ // [默认关闭] 不限制同时存在默认导出与相近命名导出的模块 API 风格。
183
90
  "import-x/no-named-as-default": "off",
184
- // 关闭 - 禁用对将默认导出成员当作命名导入的检查
91
+ // [默认关闭] 不限制通过默认导入对象访问同名属性的项目 API 风格。
185
92
  "import-x/no-named-as-default-member": "off",
186
- // 关闭 - 禁用对命名导入(即从模块中导入特定命名的内容)的检查
93
+ // [默认关闭] 未配置 resolver 时,命名导出的静态分析容易产生误报。
187
94
  "import-x/named": "off"
188
95
  };
189
96
 
190
97
  // src/rules/javascript.ts
191
98
  var javascriptRules = {
192
- // JS/TS (http://eslint.cn/docs/rules)
193
- // 强制使用 camelCase 命名风格
194
- camelcase: [
195
- "error",
196
- {
197
- // 允许对象属性使用非 camelCase 风格
198
- properties: "never"
199
- }
200
- ],
201
- // 禁止使用控制台
99
+ // 控制台调用在应用源码中需要人工确认;warn/error 仍可用于必要的诊断输出。
202
100
  "no-console": [
203
101
  "warn",
204
102
  {
205
- // 允许除 warn/error 之外的其他 console.xx 方法
206
103
  allow: ["warn", "error"]
207
104
  }
208
105
  ],
209
- // 禁止使用 debugger
210
- "no-debugger": "warn",
211
- // 禁止在条件语句中使用常量条件
106
+ // 防止调试断点进入发布代码并中断运行。
107
+ "no-debugger": "error",
108
+ // 禁止意外的恒定条件,但允许 while (true) 等有明确退出逻辑的循环。
212
109
  "no-constant-condition": [
213
110
  "error",
214
111
  {
215
- // 允许在循环语句中使用常量条件
216
112
  checkLoops: false
217
113
  }
218
114
  ],
219
- // 禁止使用某些特定的语法
220
- "no-restricted-syntax": [
221
- "error",
222
- // 禁止使用标记语句(labeled statements)
223
- "LabeledStatement",
224
- // 禁止使用 with 语句
225
- "WithStatement"
226
- ],
227
- // 禁止在 return 语句中使用 await
228
- "@typescript-eslint/return-await": "error",
229
- // 禁止使用 var 关键字,强制使用 let 或 const
115
+ // [高影响] 禁止标签语句;包含多层循环 labeled break/continue 的代码需先重构控制流。
116
+ "no-restricted-syntax": ["error", "LabeledStatement"],
117
+ // [高影响][可自动修复] 使用 let/const 替代 var;首次启用需复核循环闭包和声明提升行为。
230
118
  "no-var": "error",
231
- // 禁止使用空的块语句
119
+ // 禁止无说明的空代码块;允许用于“忽略失败”语义的空 catch。
232
120
  "no-empty": [
233
121
  "error",
234
122
  {
235
- // 允许空的 catch 块
236
123
  allowEmptyCatch: true
237
124
  }
238
125
  ],
239
- // 该规则禁止使用不规则或不标准的空白字符
126
+ // 拒绝肉眼难以识别、可能导致解析差异的非常规空白字符。
240
127
  "no-irregular-whitespace": "error",
241
- // 禁止在函数或变量定义之前使用它们
242
- "no-use-before-define": "warn",
243
- // 强制使用 const 声明不被修改的变量
128
+ // 变量和类先声明后使用;函数声明允许提升。warn 保留函数式组合和循环依赖重构空间。
129
+ "no-use-before-define": [
130
+ "warn",
131
+ {
132
+ classes: true,
133
+ functions: false,
134
+ variables: true
135
+ }
136
+ ],
137
+ // [可自动修复] 能保持引用不变的变量优先使用 const;读取发生在赋值前时不做不可靠判断。
244
138
  "prefer-const": [
245
139
  "warn",
246
140
  {
247
- // 在解构赋值时也推荐使用 const
248
141
  destructuring: "all",
249
- // 允许在变量首次赋值前读取变量的值
250
142
  ignoreReadBeforeAssign: true
251
143
  }
252
144
  ],
253
- // 强制使用箭头函数而非普通函数
145
+ // [高影响][可自动修复] 优先箭头回调;批量修复后应复核 this/arguments 与函数名栈信息。
254
146
  "prefer-arrow-callback": [
255
147
  "error",
256
148
  {
257
- // 不允许使用命名函数作为回调函数
258
149
  allowNamedFunctions: false,
259
- // 允许在箭头函数中使用 this 绑定的上下文
260
150
  allowUnboundThis: true
261
151
  }
262
152
  ],
263
- // 强制使用对象字面量的方法和属性简写语法
153
+ // [可自动修复] 属性和值同名时使用对象简写,带引号键名不强制改写。
264
154
  "object-shorthand": [
265
155
  "error",
266
156
  "always",
267
157
  {
268
- // 不忽略构造函数中的属性简写
269
158
  ignoreConstructors: false,
270
- // 强制避免在属性名中使用引号
271
159
  avoidQuotes: true
272
160
  }
273
161
  ],
274
- // 强制使用 rest 参数代替 arguments 对象
162
+ // [高影响][可自动修复] 使用 ||=、&&=、??=;涉及 getter/Proxy 的代码应复核求值次数。
163
+ "logical-assignment-operators": ["error", "always", { enforceForIfStatements: true }],
164
+ // [可自动修复] 合并对象时优先展开语法,避免 Object.assign 的额外目标对象样板。
165
+ "prefer-object-spread": "error",
166
+ // 可变参数函数优先 rest 参数,避免依赖类数组 arguments;该规则只报告,不自动改写签名。
275
167
  "prefer-rest-params": "error",
276
- // 强制使用展开运算符(...)代替 Function.prototype.apply
168
+ // 调用可迭代对象时优先 spread;该规则只报告,避免自动改变 apply 的 this 语义。
277
169
  "prefer-spread": "error",
278
- // 强制使用模板字面量代替字符串连接
170
+ // [可自动修复] 字符串拼接优先模板字符串,便于阅读和多段插值。
279
171
  "prefer-template": "error",
280
- // 禁止在同一作用域中重新声明变量
172
+ // 同一作用域禁止重复声明,避免后声明遮盖前声明。
281
173
  "no-redeclare": "error"
282
174
  };
283
175
 
176
+ // src/rules/lodash.ts
177
+ var preferLodashUnifiedRules = {
178
+ // [高影响][按需启用] 禁止混用 lodash 与 lodash-es,避免同一项目维护多套等价依赖入口。
179
+ "no-restricted-imports": [
180
+ "error",
181
+ {
182
+ paths: [
183
+ {
184
+ name: "lodash",
185
+ message: 'Use "lodash-unified" consistently instead of "lodash".'
186
+ },
187
+ {
188
+ name: "lodash-es",
189
+ message: 'Use "lodash-unified" consistently instead of "lodash-es".'
190
+ }
191
+ ],
192
+ patterns: [
193
+ {
194
+ group: ["lodash/*", "lodash-es/*"],
195
+ message: 'Use exports from "lodash-unified" instead of Lodash subpath imports.'
196
+ }
197
+ ]
198
+ }
199
+ ]
200
+ };
201
+ var preferLodashRules = {
202
+ // [高影响][按需启用] 禁止混用 lodash-es 与 lodash-unified,保持运行时和类型来源一致。
203
+ "no-restricted-imports": [
204
+ "error",
205
+ {
206
+ paths: [
207
+ {
208
+ name: "lodash-es",
209
+ message: 'Use "lodash" consistently instead of "lodash-es".'
210
+ },
211
+ {
212
+ name: "lodash-unified",
213
+ message: 'Use "lodash" consistently instead of "lodash-unified".'
214
+ }
215
+ ],
216
+ patterns: [
217
+ {
218
+ group: ["lodash-es/*", "lodash-unified/*"],
219
+ message: 'Use "lodash" or a "lodash/*" subpath consistently.'
220
+ }
221
+ ]
222
+ }
223
+ ]
224
+ };
225
+
284
226
  // src/rules/sort-package.ts
285
227
  var packageJsonSortRules = {
228
+ // [高影响][可自动修复][按需启用] npm 的 files 清单按字母排序;数组顺序不改打包集合,但首次 diff 较大。
286
229
  "jsonc/sort-array-values": [
287
230
  "error",
288
231
  {
@@ -290,8 +233,10 @@ var packageJsonSortRules = {
290
233
  pathPattern: "^files$"
291
234
  }
292
235
  ],
236
+ // [高影响][可自动修复][按需启用] 仅排序明确安全的 package.json 区域,不进入 exports 条件对象。
293
237
  "jsonc/sort-keys": [
294
238
  "error",
239
+ // 根字段按常见阅读顺序组织,减少不同项目之间的清单噪声。
295
240
  {
296
241
  order: [
297
242
  "name",
@@ -339,14 +284,12 @@ var packageJsonSortRules = {
339
284
  ],
340
285
  pathPattern: "^$"
341
286
  },
287
+ // 各类依赖映射按包名排序,方便发现重复或异常依赖。
342
288
  {
343
289
  order: { type: "asc" },
344
290
  pathPattern: "^(?:dev|peer|optional|bundled)?[Dd]ependencies(Meta)?$"
345
291
  },
346
- {
347
- order: ["types", "require", "import", "default"],
348
- pathPattern: "^exports.*$"
349
- },
292
+ // overrides/resolutions 只排序直接键;修改前仍应关注包管理器的模式匹配语义。
350
293
  {
351
294
  order: { type: "asc" },
352
295
  pathPattern: "^(?:resolutions|overrides|pnpm.overrides)$"
@@ -356,14 +299,17 @@ var packageJsonSortRules = {
356
299
 
357
300
  // src/rules/sort-tsconfig.ts
358
301
  var tsconfigJsonSortRules = {
359
- // 允许注释
302
+ // tsconfig 是 JSONC,注释用于解释不直观的编译器取舍,必须保留。
360
303
  "jsonc/no-comments": "off",
304
+ // [高影响][可自动修复][按需启用] 只调整顶层和 compilerOptions 的键顺序,不改写任何选项值或数组。
361
305
  "jsonc/sort-keys": [
362
306
  "error",
307
+ // 顶层按继承、选项、项目引用和文件范围的阅读顺序排列。
363
308
  {
364
309
  order: ["extends", "compilerOptions", "references", "files", "include", "exclude"],
365
310
  pathPattern: "^$"
366
311
  },
312
+ // compilerOptions 的顺序跟随 TypeScript 文档主题,便于检索和代码审查。
367
313
  {
368
314
  order: [
369
315
  /* Projects */
@@ -471,110 +417,76 @@ var tsconfigJsonSortRules = {
471
417
 
472
418
  // src/rules/typescript.ts
473
419
  var typescriptRules = {
474
- // TS (https://typescript-eslint.io/rules)
475
- // 要求在导出函数和类的公共方法上显式声明返回类型
476
- "@typescript-eslint/explicit-module-boundary-types": [
420
+ // 使用 TypeScript 版本避免核心规则误判声明合并、类型和值的同名声明。
421
+ "@typescript-eslint/no-redeclare": "error",
422
+ // [高影响][可自动修复] 未使用符号视为错误;以下划线开头可显式表示参数或变量被有意忽略。
423
+ "@typescript-eslint/no-unused-vars": [
477
424
  "error",
478
425
  {
479
- allowArgumentsExplicitlyTypedAsAny: true
426
+ args: "after-used",
427
+ argsIgnorePattern: "^_",
428
+ caughtErrors: "all",
429
+ caughtErrorsIgnorePattern: "^_",
430
+ ignoreRestSiblings: true,
431
+ varsIgnorePattern: "^_"
480
432
  }
481
433
  ],
482
- // 要求在 TypeScript 函数和方法中显式地指定返回类型
483
- "@typescript-eslint/explicit-function-return-type": "error",
484
- // 禁止在同一作用域中重新声明 TypeScript 变量
485
- "@typescript-eslint/no-redeclare": "error",
486
- // 禁止定义未使用的变量,方法参数排除。
487
- "@typescript-eslint/no-unused-vars": ["error", { args: "none" }],
488
- // 允许使用自定义TypeScript模块和命名空间
434
+ // [默认关闭] 声明文件、全局扩展和部分 SDK 仍需要 namespace。
489
435
  "@typescript-eslint/no-namespace": "off",
490
- // 允许使用 any 类型
491
- "@typescript-eslint/no-explicit-any": "off",
492
- // 禁止在 TypeScript 文件中使用 require 函数进行模块导入
436
+ // any 会绕过类型检查,但在第三方边界和渐进式类型完善中有合理用途,因此只警告。
437
+ "@typescript-eslint/no-explicit-any": "warn",
438
+ // [高影响] 默认要求 ESM import;CommonJS、动态加载或工具链互操作代码可能需要按文件关闭。
493
439
  "@typescript-eslint/no-require-imports": "error",
494
- // 禁止定义空函数
495
- "@typescript-eslint/no-empty-function": ["error", { allow: [] }],
496
- // 禁止无用的表达式
440
+ // 使用 TS 版本识别类型断言等语法;允许常见的短路和三元表达式调用模式。
497
441
  "@typescript-eslint/no-unused-expressions": [
498
442
  "error",
499
443
  {
500
- // 允许短路操作符(&& 和 ||)中的无副作用表达式
501
444
  allowShortCircuit: true,
502
- // 允许三元操作符中的无副作用表达式
503
445
  allowTernary: true
504
446
  }
505
447
  ],
506
- // 禁止在 TypeScript 代码中对类型已经可以被推断的变量或参数进行显式的类型注解
448
+ // [可自动修复] 删除可由 TypeScript 明确推断的原始值类型标注,减少重复信息。
507
449
  "@typescript-eslint/no-inferrable-types": "error",
508
- // 禁止使用后缀运算符的非空断言(!)
509
- "@typescript-eslint/no-non-null-assertion": "error",
510
- // 禁止在可选链(?)后使用非空断言(!)
450
+ // 非空断言可能隐藏空值缺陷;以警告提示逐步消除,避免一次性产生大量阻断错误。
451
+ "@typescript-eslint/no-non-null-assertion": "warn",
452
+ // 可选链之后再做非空断言逻辑矛盾,通常表示边界条件设计有误。
511
453
  "@typescript-eslint/no-non-null-asserted-optional-chain": "error",
512
- // 禁止在代码中使用 @ts-ignore 注释
513
- "@typescript-eslint/ban-ts-comment": ["error", { "ts-ignore": false }],
514
- // 一致地使用 TypeScript 类型导入
454
+ // [高影响][可自动修复] 类型依赖改用内联 type import;需复核仅靠 import 触发的模块副作用。
515
455
  "@typescript-eslint/consistent-type-imports": [
516
456
  "error",
517
457
  {
518
- // 允许使用类型注解
519
- disallowTypeAnnotations: false
458
+ disallowTypeAnnotations: false,
459
+ fixStyle: "inline-type-imports",
460
+ prefer: "type-imports"
520
461
  }
521
462
  ]
522
463
  };
523
464
 
524
465
  // src/rules/vue.ts
525
466
  var vueRules = {
526
- // vue (https://eslint.vuejs.org/rules)
527
- // 允许使用 v-html
528
- "vue/no-v-html": "off",
529
- // 禁用所有 props 必填时,必须提供默认值
467
+ // [安全关注] v-html 可能引入 XSS;保留 warn 以兼容经过净化的富文本场景。
468
+ "vue/no-v-html": "warn",
469
+ // [默认关闭] TypeScript 类型 props 和 required 声明已能表达可选性,不强制每个可选 prop 提供默认值。
530
470
  "vue/require-default-prop": "off",
531
- // 强制组件中必须使用 emits 选项声明事件
471
+ // [高影响] 组件必须声明对外事件;首次启用时会暴露未建模的公共事件 API。
532
472
  "vue/require-explicit-emits": "error",
533
- // 禁用组件名称必须是多单词
473
+ // [默认关闭] 允许 App、Layout 等约定俗成的单词组件名。
534
474
  "vue/multi-word-component-names": "off",
535
- // 关闭 - 强制从 vue 中导入 Vue相关 API
536
- "vue/prefer-import-from-vue": "off",
537
- // 强制 HTML 属性使用 camelCase 风格
538
- "vue/attribute-hyphenation": [
539
- "error",
540
- "never",
541
- {
542
- ignore: [
543
- // 忽略 Element-Plus 加载文案"element-loading-text"
544
- "element-loading-text",
545
- // 忽略 UniApp view 标签的一些属性
546
- "hover-class",
547
- "hover-stop-propagation",
548
- "hover-start-time",
549
- "hover-stay-time"
550
- ]
551
- }
552
- ],
553
- // 禁止重复的字段名
475
+ // 优先从 vue 入口导入由 Vue 重新导出的 API,避免依赖内部包边界。
476
+ "vue/prefer-import-from-vue": "warn",
477
+ // 防止 props、data、computed、methods 等组件命名空间出现冲突。
554
478
  "vue/no-dupe-keys": "error",
555
- // 禁止直接修改 props 的值
479
+ // [高影响] 禁止组件直接修改 props,要求通过事件或本地状态维持单向数据流。
556
480
  "vue/no-mutating-props": "error",
557
- // 禁止使用 Vue.js 内置的保留组件名称(如 transition、keep-alive 等)作为自定义组件名称
481
+ // 避免自定义组件名与 Vue 内置组件冲突。
558
482
  "vue/no-reserved-component-names": "error",
559
- // 禁止在自定义组件上使用 v-text 或 v-html 指令
560
- "vue/no-v-text-v-html-on-component": "off",
561
- // 防止<script setup>使用的变量<template>被标记为未使用,此规则仅在启用该no-unused-vars规则时有效。
562
- // "vue/script-setup-uses-vars": "error",
563
- // 强制自定义事件名称使用 camelCase 风格命名
483
+ // [安全关注] 禁止在组件节点上使用 v-text/v-html,避免覆盖组件内容和模糊数据边界。
484
+ "vue/no-v-text-v-html-on-component": "error",
485
+ // 统一模板与脚本中的自定义事件名称为 camelCase。
564
486
  "vue/custom-event-name-casing": ["error", "camelCase"],
565
- // 强制每个 Vue 文件中只包含一个 Vue 组件
487
+ // [默认关闭] 允许在一个 SFC 中声明仅供当前文件使用的小型辅助组件。
566
488
  "vue/one-component-per-file": "off",
567
- // 闭合标签换行风格
568
- "vue/html-closing-bracket-newline": [
569
- "error",
570
- {
571
- // 强制要求当 HTML 元素跨多行时,闭合标签必须出现在新的一行上
572
- multiline: "always",
573
- // 强制要求当 HTML 元素只有一行时,闭合标签应与开始标签在同一行上
574
- singleline: "never"
575
- }
576
- ],
577
- // 强制 Vue 模板中 HTML 元素的属性按照指定的顺序排列
489
+ // [高影响][可自动修复] 统一模板属性分组;首次启用可能产生大量仅排序的模板差异。
578
490
  "vue/attributes-order": [
579
491
  "error",
580
492
  {
@@ -582,15 +494,7 @@ var vueRules = {
582
494
  }
583
495
  ]
584
496
  };
585
- export {
586
- commonRules,
587
- importRules,
588
- importUseLodashRules,
589
- importUseLodashUnifiedRules,
590
- javascriptRules,
591
- packageJsonSortRules,
592
- tsconfigJsonSortRules,
593
- typescriptRules,
594
- vueRules
595
- };
497
+
498
+ export { commonRules, defineRules, importRules, javascriptRules, packageJsonSortRules, preferLodashRules, preferLodashUnifiedRules, tsconfigJsonSortRules, typescriptRules, vueRules };
499
+ //# sourceMappingURL=index.js.map
596
500
  //# sourceMappingURL=index.js.map