@pawover/kit-eslint-rules 0.0.5 → 0.1.0-alpha.1

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.
Files changed (44) hide show
  1. package/LICENSE +1 -1
  2. package/dist/index.d.ts +100 -67
  3. package/dist/index.js +4225 -60
  4. package/package.json +24 -48
  5. package/dist/core.antfu.cjs +0 -78
  6. package/dist/core.antfu.d.cts +0 -1
  7. package/dist/core.antfu.d.ts +0 -74
  8. package/dist/core.antfu.js +0 -79
  9. package/dist/core.imports.cjs +0 -59
  10. package/dist/core.imports.d.cts +0 -1
  11. package/dist/core.imports.d.ts +0 -61
  12. package/dist/core.imports.js +0 -59
  13. package/dist/core.importsSort.cjs +0 -7
  14. package/dist/core.importsSort.d.cts +0 -1
  15. package/dist/core.importsSort.d.ts +0 -7
  16. package/dist/core.importsSort.js +0 -7
  17. package/dist/core.javascript.cjs +0 -1208
  18. package/dist/core.javascript.d.cts +0 -1
  19. package/dist/core.javascript.d.ts +0 -1216
  20. package/dist/core.javascript.js +0 -1208
  21. package/dist/core.react.cjs +0 -551
  22. package/dist/core.react.d.cts +0 -1
  23. package/dist/core.react.d.ts +0 -551
  24. package/dist/core.react.js +0 -551
  25. package/dist/core.reactHooks.cjs +0 -107
  26. package/dist/core.reactHooks.d.cts +0 -1
  27. package/dist/core.reactHooks.d.ts +0 -107
  28. package/dist/core.reactHooks.js +0 -107
  29. package/dist/core.stylistic.cjs +0 -608
  30. package/dist/core.stylistic.d.cts +0 -1
  31. package/dist/core.stylistic.d.ts +0 -595
  32. package/dist/core.stylistic.js +0 -608
  33. package/dist/core.typescript.cjs +0 -905
  34. package/dist/core.typescript.d.cts +0 -1
  35. package/dist/core.typescript.d.ts +0 -917
  36. package/dist/core.typescript.js +0 -906
  37. package/dist/core.vue.cjs +0 -312
  38. package/dist/core.vue.d.cts +0 -1
  39. package/dist/core.vue.d.ts +0 -293
  40. package/dist/core.vue.js +0 -313
  41. package/dist/index.cjs +0 -126
  42. package/dist/index.d.cts +0 -1
  43. package/dist/preset-Cxv7kssz.js +0 -98
  44. package/dist/preset-D2hG0SBb.cjs +0 -103
package/dist/index.js CHANGED
@@ -1,24 +1,4035 @@
1
- import core_antfu_default from "./core.antfu.js";
2
- import core_imports_default from "./core.imports.js";
3
- import core_importsSort_default from "./core.importsSort.js";
4
- import core_javascript_default from "./core.javascript.js";
5
- import core_react_default from "./core.react.js";
6
- import core_reactHooks_default from "./core.reactHooks.js";
7
- import core_stylistic_default from "./core.stylistic.js";
8
- import core_typescript_default from "./core.typescript.js";
9
- import core_vue_default from "./core.vue.js";
10
- //#region src/index.ts
1
+ import eslintReact from "@eslint-react/eslint-plugin";
2
+ import stylistic from "@stylistic/eslint-plugin";
3
+ import antfu from "eslint-plugin-antfu";
4
+ import importLite from "eslint-plugin-import-lite";
5
+ import reactHooks from "eslint-plugin-react-hooks";
6
+ import simpleImportSort from "eslint-plugin-simple-import-sort";
7
+ import vue from "eslint-plugin-vue";
8
+ import vueEslintParser from "vue-eslint-parser";
9
+ import typescriptEslint from "typescript-eslint";
10
+ //#region src/preset.ts
11
+ /**
12
+ * 预设配置
13
+ *
14
+ * 供各规则组共享的基础预设(缩进大小与 TypeScript 类成员排序规则),仅内部使用,不构成包公开 API。
15
+ */
16
+ var preset_default = {
17
+ /** 缩进大小 */
18
+ indent: 2,
19
+ /** TypeScript 类成员排序 */
20
+ tsMemberOrder: [
21
+ "signature",
22
+ "call-signature",
23
+ "static-field",
24
+ "static-initialization",
25
+ "#private-instance-field",
26
+ "private-instance-field",
27
+ "protected-instance-field",
28
+ "public-instance-field",
29
+ "instance-field",
30
+ "#private-field",
31
+ "private-field",
32
+ "protected-field",
33
+ "public-field",
34
+ "field",
35
+ "private-constructor",
36
+ "protected-constructor",
37
+ "public-constructor",
38
+ "#private-static-get",
39
+ "#private-static-set",
40
+ "private-static-get",
41
+ "private-static-set",
42
+ "protected-static-get",
43
+ "protected-static-set",
44
+ "public-static-get",
45
+ "public-static-set",
46
+ "static-get",
47
+ "static-set",
48
+ "protected-abstract-get",
49
+ "protected-abstract-set",
50
+ "public-abstract-get",
51
+ "public-abstract-set",
52
+ "abstract-get",
53
+ "abstract-set",
54
+ "#private-instance-get",
55
+ "#private-instance-set",
56
+ "private-instance-get",
57
+ "private-instance-set",
58
+ "protected-instance-get",
59
+ "protected-instance-set",
60
+ "public-instance-get",
61
+ "public-instance-set",
62
+ "instance-get",
63
+ "instance-set",
64
+ "private-decorated-get",
65
+ "private-decorated-set",
66
+ "protected-decorated-get",
67
+ "protected-decorated-set",
68
+ "public-decorated-get",
69
+ "public-decorated-set",
70
+ "decorated-get",
71
+ "decorated-set",
72
+ "#private-get",
73
+ "#private-set",
74
+ "private-get",
75
+ "private-set",
76
+ "protected-get",
77
+ "protected-set",
78
+ "public-get",
79
+ "public-set",
80
+ "get",
81
+ "set",
82
+ "#private-static-method",
83
+ "private-static-method",
84
+ "protected-static-method",
85
+ "public-static-method",
86
+ "static-method",
87
+ "#private-instance-method",
88
+ "private-instance-method",
89
+ "protected-instance-method",
90
+ "public-instance-method",
91
+ "instance-method",
92
+ "private-method",
93
+ "protected-method",
94
+ "public-method",
95
+ "#private-method",
96
+ "method"
97
+ ]
98
+ };
99
+ //#endregion
100
+ //#region src/core.antfu.ts
101
+ /**
102
+ * `antfu` 规则组配置
103
+ *
104
+ * 规则名 → 严重级别/配置的映射:`antfu` 组经预设工厂(`src/config.ts`)装配进 flat config,注册名 `antfu`。
105
+ */
106
+ const rules$8 = {
107
+ /**
108
+ * @desc 强制链式成员访问的换行风格保持一致
109
+ * @descEN Enforce consistent line breaks for chaining member access
110
+ * @see https://github.com/antfu/eslint-plugin-antfu/blob/main/src/rules/consistent-chaining.md
111
+ */
112
+ "antfu/consistent-chaining": 2,
113
+ /**
114
+ * @desc 强制括号和圆括号内部的换行风格保持一致
115
+ * @descEN Enforce consistent line breaks inside braces and parentheses
116
+ * @see https://github.com/antfu/eslint-plugin-antfu/blob/main/src/rules/consistent-list-newline.md
117
+ */
118
+ "antfu/consistent-list-newline": 2,
119
+ /**
120
+ * @desc 个人偏好的花括号规则,允许单行同时使用两种风格
121
+ * @descEN Opinionated curly bracket enforcement that allows both styles on one-liners
122
+ * @see https://github.com/antfu/eslint-plugin-antfu/blob/main/src/rules/curly.md
123
+ */
124
+ "antfu/curly": 0,
125
+ /**
126
+ * @desc 强制 if 语句与其后续表达式之间换行
127
+ * @descEN Enforce a newline between `if` and its consequent
128
+ * @see https://github.com/antfu/eslint-plugin-antfu/blob/main/src/rules/if-newline.md
129
+ */
130
+ "antfu/if-newline": 2,
131
+ /**
132
+ * @desc 自动去重来自同一来源的具名导入
133
+ * @descEN Auto-fix duplicate named imports from the same source
134
+ * @see https://github.com/antfu/eslint-plugin-antfu/blob/main/src/rules/import-dedupe.md
135
+ */
136
+ "antfu/import-dedupe": 2,
137
+ /**
138
+ * @desc 强制 `unindent` 模板字符串标签内的缩进风格保持一致
139
+ * @descEN Enforce consistent indentation inside `unindent` tagged template strings
140
+ * @see https://github.com/antfu/eslint-plugin-antfu/blob/main/src/rules/indent-unindent.md
141
+ */
142
+ "antfu/indent-unindent": [2, {
143
+ indent: preset_default.indent,
144
+ tags: [
145
+ "$",
146
+ "unindent",
147
+ "unIndent"
148
+ ]
149
+ }],
150
+ /**
151
+ * @desc 禁止从本地 dist 文件夹导入
152
+ * @descEN Prevent importing from a local `dist` folder
153
+ * @see https://github.com/antfu/eslint-plugin-antfu/blob/main/src/rules/no-import-dist.md
154
+ */
155
+ "antfu/no-import-dist": 2,
156
+ /**
157
+ * @desc 禁止通过相对或绝对路径从 node_modules 导入
158
+ * @descEN Prevent importing from `node_modules` by relative or absolute path
159
+ * @see https://github.com/antfu/eslint-plugin-antfu/blob/main/src/rules/no-import-node-modules-by-path.md
160
+ */
161
+ "antfu/no-import-node-modules-by-path": 2,
162
+ /**
163
+ * @desc 禁止顶层 await
164
+ * @descEN Prevent top-level `await`
165
+ * @see https://github.com/antfu/eslint-plugin-antfu/blob/main/src/rules/no-top-level-await.md
166
+ */
167
+ "antfu/no-top-level-await": 0,
168
+ /**
169
+ * @desc 禁止使用 TypeScript 的 export = 语法
170
+ * @descEN Disallow TypeScript's `export =` syntax
171
+ * @see https://github.com/antfu/eslint-plugin-antfu/blob/main/src/rules/no-ts-export-equal.md
172
+ */
173
+ "antfu/no-ts-export-equal": 2,
174
+ /**
175
+ * @desc 强制顶层函数使用 function 关键字声明
176
+ * @descEN Enforce top-level functions to be declared with the `function` keyword
177
+ * @see https://github.com/antfu/eslint-plugin-antfu/blob/main/src/rules/top-level-function.md
178
+ */
179
+ "antfu/top-level-function": 2
180
+ };
181
+ //#endregion
182
+ //#region src/core.imports.ts
183
+ /**
184
+ * `imports` 规则组配置
185
+ *
186
+ * 规则名 → 严重级别/配置的映射:`imports` 组经预设工厂(`src/config.ts`)装配进 flat config,注册名 `imports`。
187
+ */
188
+ const rules$7 = {
189
+ /**
190
+ * @desc 强制类型导入的标记风格保持一致(顶级或内联)
191
+ * @descEN Enforce consistent style for type-only import specifiers (top-level vs inline)
192
+ * @see https://github.com/9romise/eslint-plugin-import-lite/blob/main/src/rules/consistent-type-specifier-style/README.md
193
+ */
194
+ "imports/consistent-type-specifier-style": [2, "prefer-top-level"],
195
+ /**
196
+ * @desc 确保所有导出语句都在文件末尾
197
+ * @descEN Ensure all exports are declared at the bottom of the file
198
+ * @see https://github.com/9romise/eslint-plugin-import-lite/blob/main/src/rules/exports-last/README.md
199
+ */
200
+ "imports/exports-last": 0,
201
+ /**
202
+ * @desc 确保所有 import 语句在文件顶部
203
+ * @descEN Ensure all imports are at the top of the file
204
+ * @see https://github.com/9romise/eslint-plugin-import-lite/blob/main/src/rules/first/README.md
205
+ */
206
+ "imports/first": 2,
207
+ /**
208
+ * @desc 强制在最后一个 import 或 require 语句后留有空行
209
+ * @descEN Enforce one or more empty lines after the last top-level import or require
210
+ * @see https://github.com/9romise/eslint-plugin-import-lite/blob/main/src/rules/newline-after-import/README.md
211
+ */
212
+ "imports/newline-after-import": [2, { count: 1 }],
213
+ /**
214
+ * @desc 禁止使用默认导出
215
+ * @descEN Disallow default exports
216
+ * @see https://github.com/9romise/eslint-plugin-import-lite/blob/main/src/rules/no-default-export/README.md
217
+ */
218
+ "imports/no-default-export": 0,
219
+ /**
220
+ * @desc 禁止重复导入同一模块
221
+ * @descEN Disallow duplicate imports from the same module
222
+ * @see https://github.com/9romise/eslint-plugin-import-lite/blob/main/src/rules/no-duplicates/README.md
223
+ */
224
+ "imports/no-duplicates": 2,
225
+ /**
226
+ * @desc 禁止使用 var 或 let 导出可变绑定
227
+ * @descEN Forbid mutable exports using `var` or `let`
228
+ * @see https://github.com/9romise/eslint-plugin-import-lite/blob/main/src/rules/no-mutable-exports/README.md
229
+ */
230
+ "imports/no-mutable-exports": 2,
231
+ /**
232
+ * @desc 禁止将默认导入作为具名导入使用
233
+ * @descEN Disallow named import of default exports
234
+ * @see https://github.com/9romise/eslint-plugin-import-lite/blob/main/src/rules/no-named-default/README.md
235
+ */
236
+ "imports/no-named-default": 2,
237
+ /**
238
+ * @desc 优先使用默认导出而非具名导出
239
+ * @descEN Prefer default export over named export
240
+ * @see https://github.com/9romise/eslint-plugin-import-lite/blob/main/src/rules/prefer-default-export/README.md
241
+ */
242
+ "imports/prefer-default-export": 0
243
+ };
244
+ //#endregion
245
+ //#region src/core.importsSort.ts
246
+ /**
247
+ * `importsSort` 规则组配置
248
+ *
249
+ * 规则名 → 严重级别/配置的映射:`importsSort` 组经预设工厂(`src/config.ts`)装配进 flat config,注册名 `importsSort`。
250
+ */
251
+ const rules$6 = {
252
+ "importsSort/imports": 2,
253
+ "importsSort/exports": 2
254
+ };
255
+ //#endregion
256
+ //#region src/core.javascript.ts
257
+ /**
258
+ * `javascript` 规则组配置
259
+ *
260
+ * 规则名 → 严重级别/配置的映射:`javascript` 组随预设工厂(`src/config.ts`)常开,直接作用于全部源文件(ESLint 核心规则,无需插件注册)。
261
+ */
262
+ const rules$5 = {
263
+ /**
264
+ * @desc 强制数组回调函数中必须包含 return 语句
265
+ * @descEN Enforce return statements in callbacks of array methods
266
+ * @see https://eslint.org/docs/latest/rules/array-callback-return
267
+ */
268
+ "array-callback-return": 2,
269
+ /**
270
+ * @desc 确保构造函数中调用了 super()
271
+ * @descEN Require `super()` calls in constructors
272
+ * @see https://eslint.org/docs/latest/rules/constructor-super
273
+ */
274
+ "constructor-super": 2,
275
+ /**
276
+ * @desc 强制 for 循环方向正确
277
+ * @descEN Enforce "for" loop update clause moving the counter in the right direction
278
+ * @see https://eslint.org/docs/latest/rules/for-direction
279
+ */
280
+ "for-direction": 2,
281
+ /**
282
+ * @desc 强制 getter 函数中必须有 return 语句
283
+ * @descEN Enforce that a getter returns a value
284
+ * @see https://eslint.org/docs/latest/rules/getter-return
285
+ */
286
+ "getter-return": 2,
287
+ /**
288
+ * @desc 禁止使用异步函数作为 Promise 执行器
289
+ * @descEN Disallow using an async function as a Promise executor
290
+ * @see https://eslint.org/docs/latest/rules/no-async-promise-executor
291
+ */
292
+ "no-async-promise-executor": 2,
293
+ /**
294
+ * @desc 禁止在循环中使用 await
295
+ * @descEN Disallow `await` inside loops
296
+ * @see https://eslint.org/docs/latest/rules/no-await-in-loop
297
+ */
298
+ "no-await-in-loop": 0,
299
+ /**
300
+ * @desc 禁止给类赋值
301
+ * @descEN Disallow reassigning class members
302
+ * @see https://eslint.org/docs/latest/rules/no-class-assign
303
+ */
304
+ "no-class-assign": 2,
305
+ /**
306
+ * @desc 禁止与 -0 进行比较
307
+ * @descEN Disallow comparing against -0
308
+ * @see https://eslint.org/docs/latest/rules/no-compare-neg-zero
309
+ */
310
+ "no-compare-neg-zero": 2,
311
+ /**
312
+ * @desc 禁止在条件表达式中使用赋值运算符
313
+ * @descEN Disallow assignment operators in conditional expressions
314
+ * @see https://eslint.org/docs/latest/rules/no-cond-assign
315
+ */
316
+ "no-cond-assign": 2,
317
+ /**
318
+ * @desc 禁止修改 const 声明的变量
319
+ * @descEN Disallow reassigning `const` variables
320
+ * @see https://eslint.org/docs/latest/rules/no-const-assign
321
+ */
322
+ "no-const-assign": 2,
323
+ /**
324
+ * @desc 禁止在常量条件、比较和表达式中出现逻辑错误
325
+ * @descEN Disallow expressions where the operation doesn't match the type
326
+ * @see https://eslint.org/docs/latest/rules/no-constant-binary-expression
327
+ */
328
+ "no-constant-binary-expression": 2,
329
+ /**
330
+ * @desc 禁止在条件中使用常量表达式
331
+ * @descEN Disallow constant expressions in conditions
332
+ * @see https://eslint.org/docs/latest/rules/no-constant-condition
333
+ */
334
+ "no-constant-condition": 2,
335
+ /**
336
+ * @desc 禁止构造函数中显式 return 值
337
+ * @descEN Disallow returning a value from a constructor
338
+ * @see https://eslint.org/docs/latest/rules/no-constructor-return
339
+ */
340
+ "no-constructor-return": 2,
341
+ /**
342
+ * @desc 禁止在正则表达式中使用控制字符
343
+ * @descEN Disallow control characters in regular expressions
344
+ * @see https://eslint.org/docs/latest/rules/no-control-regex
345
+ */
346
+ "no-control-regex": 2,
347
+ /**
348
+ * @desc 禁止使用 debugger
349
+ * @descEN Disallow the use of `debugger`
350
+ * @see https://eslint.org/docs/latest/rules/no-debugger
351
+ */
352
+ "no-debugger": 2,
353
+ /**
354
+ * @desc 禁止函数参数重复
355
+ * @descEN Disallow duplicate arguments in function definitions
356
+ * @see https://eslint.org/docs/latest/rules/no-dupe-args
357
+ */
358
+ "no-dupe-args": 2,
359
+ /**
360
+ * @desc 禁止类成员重复
361
+ * @descEN Disallow duplicate class members
362
+ * @see https://eslint.org/docs/latest/rules/no-dupe-class-members
363
+ */
364
+ "no-dupe-class-members": 2,
365
+ /**
366
+ * @desc 禁止 if-else-if 链中出现重复条件
367
+ * @descEN Disallow duplicate conditions in if-else-if chains
368
+ * @see https://eslint.org/docs/latest/rules/no-dupe-else-if
369
+ */
370
+ "no-dupe-else-if": 2,
371
+ /**
372
+ * @desc 禁止对象字面量中出现重复键
373
+ * @descEN Disallow duplicate keys in object literals
374
+ * @see https://eslint.org/docs/latest/rules/no-dupe-keys
375
+ */
376
+ "no-dupe-keys": 2,
377
+ /**
378
+ * @desc 禁止 switch 中出现重复 case
379
+ * @descEN Disallow duplicate case labels
380
+ * @see https://eslint.org/docs/latest/rules/no-duplicate-case
381
+ */
382
+ "no-duplicate-case": 2,
383
+ /**
384
+ * @desc 禁止重复导入
385
+ * @descEN Disallow duplicate imports
386
+ * @see https://eslint.org/docs/latest/rules/no-duplicate-imports
387
+ */
388
+ "no-duplicate-imports": 2,
389
+ /**
390
+ * @desc 禁止在正则字符类中使用空字符
391
+ * @descEN Disallow empty character classes in regular expressions
392
+ * @see https://eslint.org/docs/latest/rules/no-empty-character-class
393
+ */
394
+ "no-empty-character-class": 2,
395
+ /**
396
+ * @desc 禁止解构赋值中出现空模式
397
+ * @descEN Disallow empty destructuring patterns
398
+ * @see https://eslint.org/docs/latest/rules/no-empty-pattern
399
+ */
400
+ "no-empty-pattern": 2,
401
+ /**
402
+ * @desc 禁止对 catch 异常参数赋值
403
+ * @descEN Disallow reassigning exceptions in `catch` clauses
404
+ * @see https://eslint.org/docs/latest/rules/no-ex-assign
405
+ */
406
+ "no-ex-assign": 2,
407
+ /**
408
+ * @desc 禁止 switch 穿透
409
+ * @descEN Disallow fallthrough of `case` statements
410
+ * @see https://eslint.org/docs/latest/rules/no-fallthrough
411
+ */
412
+ "no-fallthrough": 0,
413
+ /**
414
+ * @desc 禁止对函数声明重新赋值
415
+ * @descEN Disallow reassigning function declarations
416
+ * @see https://eslint.org/docs/latest/rules/no-func-assign
417
+ */
418
+ "no-func-assign": 2,
419
+ /**
420
+ * @desc 禁止给导入绑定赋值
421
+ * @descEN Disallow assigning to imported bindings
422
+ * @see https://eslint.org/docs/latest/rules/no-import-assign
423
+ */
424
+ "no-import-assign": 2,
425
+ /**
426
+ * @desc 禁止在嵌套代码块中声明变量或函数
427
+ * @descEN Disallow variable or function declarations in nested blocks
428
+ * @see https://eslint.org/docs/latest/rules/no-inner-declarations
429
+ */
430
+ "no-inner-declarations": 2,
431
+ /**
432
+ * @desc 禁止使用无效的正则表达式
433
+ * @descEN Disallow invalid regular expressions in string literals
434
+ * @see https://eslint.org/docs/latest/rules/no-invalid-regexp
435
+ */
436
+ "no-invalid-regexp": 2,
437
+ /**
438
+ * @desc 禁止不规则的空白字符
439
+ * @descEN Disallow irregular whitespace characters
440
+ * @see https://eslint.org/docs/latest/rules/no-irregular-whitespace
441
+ */
442
+ "no-irregular-whitespace": [2, {
443
+ skipStrings: true,
444
+ skipComments: false,
445
+ skipRegExps: true,
446
+ skipTemplates: true,
447
+ skipJSXText: true
448
+ }],
449
+ /**
450
+ * @desc 禁止数字精度丢失
451
+ * @descEN Disallow literal numbers that lose precision
452
+ * @see https://eslint.org/docs/latest/rules/no-loss-of-precision
453
+ */
454
+ "no-loss-of-precision": 2,
455
+ /**
456
+ * @desc 禁止误导性的字符类
457
+ * @descEN Disallow characters which are made with multiple code points in character class syntax
458
+ * @see https://eslint.org/docs/latest/rules/no-misleading-character-class
459
+ */
460
+ "no-misleading-character-class": 2,
461
+ /**
462
+ * @desc 禁止使用 new 调用非构造函数
463
+ * @descEN Disallow `new` operators with global non-constructor functions
464
+ * @see https://eslint.org/docs/latest/rules/no-new-native-nonconstructor
465
+ */
466
+ "no-new-native-nonconstructor": 2,
467
+ /**
468
+ * @desc 禁止对内置全局对象调用
469
+ * @descEN Disallow calling global object properties as functions
470
+ * @see https://eslint.org/docs/latest/rules/no-obj-calls
471
+ */
472
+ "no-obj-calls": 2,
473
+ /**
474
+ * @desc 禁止在 Promise 执行器中返回值
475
+ * @descEN Disallow returning values from Promise executor functions
476
+ * @see https://eslint.org/docs/latest/rules/no-promise-executor-return
477
+ */
478
+ "no-promise-executor-return": [2, { allowVoid: true }],
479
+ /**
480
+ * @desc 禁止直接调用对象原型上的方法
481
+ * @descEN Disallow calling some `Object.prototype` methods directly on objects
482
+ * @see https://eslint.org/docs/latest/rules/no-prototype-builtins
483
+ */
484
+ "no-prototype-builtins": 2,
485
+ /**
486
+ * @desc 禁止自身赋值
487
+ * @descEN Disallow self-assignment
488
+ * @see https://eslint.org/docs/latest/rules/no-self-assign
489
+ */
490
+ "no-self-assign": 2,
491
+ /**
492
+ * @desc 禁止自身比较
493
+ * @descEN Disallow self-comparison
494
+ * @see https://eslint.org/docs/latest/rules/no-self-compare
495
+ */
496
+ "no-self-compare": 2,
497
+ /**
498
+ * @desc 禁止 setter 返回值
499
+ * @descEN Disallow returning a value from a setter
500
+ * @see https://eslint.org/docs/latest/rules/no-setter-return
501
+ */
502
+ "no-setter-return": 2,
503
+ /**
504
+ * @desc 禁止稀疏数组
505
+ * @descEN Disallow sparse arrays
506
+ * @see https://eslint.org/docs/latest/rules/no-sparse-arrays
507
+ */
508
+ "no-sparse-arrays": 2,
509
+ /**
510
+ * @desc 禁止在字符串中使用模板字面量占位符
511
+ * @descEN Disallow template literal placeholder syntax in regular strings
512
+ * @see https://eslint.org/docs/latest/rules/no-template-curly-in-string
513
+ */
514
+ "no-template-curly-in-string": 2,
515
+ /**
516
+ * @desc 确保在构造函数中调用 super() 之前不能访问 this
517
+ * @descEN Disallow using `this`/`super` before `super()` is called
518
+ * @see https://eslint.org/docs/latest/rules/no-this-before-super
519
+ */
520
+ "no-this-before-super": 2,
521
+ /**
522
+ * @desc 禁止只读但从未被赋值的 let/var 变量
523
+ * @descEN Disallow `let` or `var` variables that are read but never assigned
524
+ * @see https://eslint.org/docs/latest/rules/no-unassigned-vars
525
+ */
526
+ "no-unassigned-vars": 2,
527
+ /**
528
+ * @desc 禁止使用未声明的变量
529
+ * @descEN Disallow undeclared variables
530
+ * @see https://eslint.org/docs/latest/rules/no-undef
531
+ */
532
+ "no-undef": 0,
533
+ /**
534
+ * @desc 禁止使用可能引起歧义的多行表达式
535
+ * @descEN Disallow confusing multiline expressions
536
+ * @see https://eslint.org/docs/latest/rules/no-unexpected-multiline
537
+ */
538
+ "no-unexpected-multiline": 2,
539
+ /**
540
+ * @desc 禁止未修改的循环条件
541
+ * @descEN Disallow unmodified loop conditions
542
+ * @see https://eslint.org/docs/latest/rules/no-unmodified-loop-condition
543
+ */
544
+ "no-unmodified-loop-condition": 2,
545
+ /**
546
+ * @desc 禁止无法到达的代码
547
+ * @descEN Disallow unreachable code after control flow statements
548
+ * @see https://eslint.org/docs/latest/rules/no-unreachable
549
+ */
550
+ "no-unreachable": 2,
551
+ /**
552
+ * @desc 禁止只有一次迭代的循环
553
+ * @descEN Disallow loops with a body that allows only one iteration
554
+ * @see https://eslint.org/docs/latest/rules/no-unreachable-loop
555
+ */
556
+ "no-unreachable-loop": 2,
557
+ /**
558
+ * @desc 禁止不安全的 finally 语句
559
+ * @descEN Disallow control flow statements in `finally` blocks
560
+ * @see https://eslint.org/docs/latest/rules/no-unsafe-finally
561
+ */
562
+ "no-unsafe-finally": 2,
563
+ /**
564
+ * @desc 禁止否定运算符与比较运算符混用
565
+ * @descEN Disallow negating the left operand of relational operators
566
+ * @see https://eslint.org/docs/latest/rules/no-unsafe-negation
567
+ */
568
+ "no-unsafe-negation": 2,
569
+ /**
570
+ * @desc 禁止对可选链使用不安全的方式
571
+ * @descEN Disallow assignments that can lead to `undefined` in optional chaining
572
+ * @see https://eslint.org/docs/latest/rules/no-unsafe-optional-chaining
573
+ */
574
+ "no-unsafe-optional-chaining": 2,
575
+ /**
576
+ * @desc 禁止使用未使用的私有类成员
577
+ * @descEN Disallow unused private class members
578
+ * @see https://eslint.org/docs/latest/rules/no-unused-private-class-members
579
+ */
580
+ "no-unused-private-class-members": 1,
581
+ /**
582
+ * @desc 禁止未使用的变量
583
+ * @descEN Disallow unused variables
584
+ * @see https://eslint.org/docs/latest/rules/no-unused-vars
585
+ */
586
+ "no-unused-vars": [1, {
587
+ vars: "local",
588
+ args: "none",
589
+ caughtErrors: "none",
590
+ varsIgnorePattern: "^_",
591
+ destructuredArrayIgnorePattern: "^_"
592
+ }],
593
+ /**
594
+ * @desc 禁止在定义之前使用变量
595
+ * @descEN Disallow the use of variables before they are defined
596
+ * @see https://eslint.org/docs/latest/rules/no-use-before-define
597
+ */
598
+ "no-use-before-define": [2, {
599
+ functions: false,
600
+ classes: false,
601
+ variables: false,
602
+ allowNamedExports: false
603
+ }],
604
+ /**
605
+ * @desc 禁止无用的赋值
606
+ * @descEN Disallow useless assignments
607
+ * @see https://eslint.org/docs/latest/rules/no-useless-assignment
608
+ */
609
+ "no-useless-assignment": 0,
610
+ /**
611
+ * @desc 禁止正则表达式中无用的反向引用
612
+ * @descEN Disallow useless backreferences in regular expressions
613
+ * @see https://eslint.org/docs/latest/rules/no-useless-backreference
614
+ */
615
+ "no-useless-backreference": 2,
616
+ /**
617
+ * @desc 要求原子更新
618
+ * @descEN Require calls to `await` in atomic update expressions
619
+ * @see https://eslint.org/docs/latest/rules/require-atomic-updates
620
+ */
621
+ "require-atomic-updates": [2, { allowProperties: true }],
622
+ /**
623
+ * @desc 强制使用 isNaN() 检查 NaN
624
+ * @descEN Require calls to `isNaN()` when checking for `NaN`
625
+ * @see https://eslint.org/docs/latest/rules/use-isnan
626
+ */
627
+ "use-isnan": 2,
628
+ /**
629
+ * @desc 强制 typeof 比较值是有效的字符串
630
+ * @descEN Enforce comparing `typeof` expressions against valid strings
631
+ * @see https://eslint.org/docs/latest/rules/valid-typeof
632
+ */
633
+ "valid-typeof": 2,
634
+ /**
635
+ * @desc 强制 getter/setter 成对出现
636
+ * @descEN Enforce getter/setter pairs in objects and classes
637
+ * @see https://eslint.org/docs/latest/rules/accessor-pairs
638
+ */
639
+ "accessor-pairs": [2, {
640
+ setWithoutGet: true,
641
+ getWithoutSet: false
642
+ }],
643
+ /**
644
+ * @desc 强制箭头函数体风格
645
+ * @descEN Require or disallow braces around arrow function bodies
646
+ * @see https://eslint.org/docs/latest/rules/arrow-body-style
647
+ */
648
+ "arrow-body-style": 0,
649
+ /**
650
+ * @desc 要求变量声明在块级作用域内
651
+ * @descEN Require variables to be declared in the nearest block scope
652
+ * @see https://eslint.org/docs/latest/rules/block-scoped-var
653
+ */
654
+ "block-scoped-var": 0,
655
+ /**
656
+ * @desc 强制驼峰命名规范
657
+ * @descEN Enforce camelcase naming convention
658
+ * @see https://eslint.org/docs/latest/rules/camelcase
659
+ */
660
+ "camelcase": 0,
661
+ /**
662
+ * @desc 强制注释首字母大小写
663
+ * @descEN Enforce capitalization of the first letter of a comment
664
+ * @see https://eslint.org/docs/latest/rules/capitalized-comments
665
+ */
666
+ "capitalized-comments": 0,
667
+ /**
668
+ * @desc 强制类方法使用 this
669
+ * @descEN Require class methods to use `this`
670
+ * @see https://eslint.org/docs/latest/rules/class-methods-use-this
671
+ */
672
+ "class-methods-use-this": 0,
673
+ /**
674
+ * @desc 限制代码复杂度
675
+ * @descEN Limit cyclomatic complexity
676
+ * @see https://eslint.org/docs/latest/rules/complexity
677
+ */
678
+ "complexity": 0,
679
+ /**
680
+ * @desc 要求一致的 return 语句
681
+ * @descEN Require `return` statements to either always or never specify values
682
+ * @see https://eslint.org/docs/latest/rules/consistent-return
683
+ */
684
+ "consistent-return": 0,
685
+ /**
686
+ * @desc 强制一致的 this 别名
687
+ * @descEN Require or disallow a consistent naming pattern for `this` aliases
688
+ * @see https://eslint.org/docs/latest/rules/consistent-this
689
+ */
690
+ "consistent-this": 0,
691
+ /**
692
+ * @desc 强制花括号风格
693
+ * @descEN Require or disallow braces around all control statements
694
+ * @see https://eslint.org/docs/latest/rules/curly
695
+ */
696
+ "curly": 2,
697
+ /**
698
+ * @desc 要求 switch 语句中有 default 分支
699
+ * @descEN Require `default` case in switch statements
700
+ * @see https://eslint.org/docs/latest/rules/default-case
701
+ */
702
+ "default-case": 2,
703
+ /**
704
+ * @desc 要求 default 分支放在最后
705
+ * @descEN Require `default` case to be the last clause in a switch statement
706
+ * @see https://eslint.org/docs/latest/rules/default-case-last
707
+ */
708
+ "default-case-last": 0,
709
+ /**
710
+ * @desc 强制默认参数放在最后
711
+ * @descEN Require default parameters to be last
712
+ * @see https://eslint.org/docs/latest/rules/default-param-last
713
+ */
714
+ "default-param-last": 2,
715
+ /**
716
+ * @desc 强制使用点号表示法
717
+ * @descEN Require dot notation when possible
718
+ * @see https://eslint.org/docs/latest/rules/dot-notation
719
+ */
720
+ "dot-notation": 0,
721
+ /**
722
+ * @desc 强制使用 === 和 !==
723
+ * @descEN Require the use of `===` and `!==`
724
+ * @see https://eslint.org/docs/latest/rules/eqeqeq
725
+ */
726
+ "eqeqeq": 2,
727
+ /**
728
+ * @desc 强制函数名与赋值的变量名匹配
729
+ * @descEN Require function names to match the name of the variable to which they are assigned
730
+ * @see https://eslint.org/docs/latest/rules/func-name-matching
731
+ */
732
+ "func-name-matching": 2,
733
+ /**
734
+ * @desc 强制命名函数表达式
735
+ * @descEN Require or disallow named function expressions
736
+ * @see https://eslint.org/docs/latest/rules/func-names
737
+ */
738
+ "func-names": 1,
739
+ /**
740
+ * @desc 强制函数声明与函数表达式的风格
741
+ * @descEN Require or disallow the use of function declarations
742
+ * @see https://eslint.org/docs/latest/rules/func-style
743
+ */
744
+ "func-style": 0,
745
+ /**
746
+ * @desc 强制访问器属性成对出现
747
+ * @descEN Require grouped accessor pairs in object literals and classes
748
+ * @see https://eslint.org/docs/latest/rules/grouped-accessor-pairs
749
+ */
750
+ "grouped-accessor-pairs": [2, "getBeforeSet"],
751
+ /**
752
+ * @desc 强制 for-in 循环中需要 if 保护
753
+ * @descEN Require `for-in` loops to include an `if` statement
754
+ * @see https://eslint.org/docs/latest/rules/guard-for-in
755
+ */
756
+ "guard-for-in": 2,
757
+ /**
758
+ * @desc 禁止使用指定标识符名称
759
+ * @descEN Disallow specified identifier names
760
+ * @see https://eslint.org/docs/latest/rules/id-denylist
761
+ */
762
+ "id-denylist": 0,
763
+ /**
764
+ * @desc 限制标识符长度
765
+ * @descEN Limit minimum and maximum identifier lengths
766
+ * @see https://eslint.org/docs/latest/rules/id-length
767
+ */
768
+ "id-length": 0,
769
+ /**
770
+ * @desc 强制标识符命名匹配指定模式
771
+ * @descEN Require identifiers to match a specified regular expression
772
+ * @see https://eslint.org/docs/latest/rules/id-match
773
+ */
774
+ "id-match": 0,
775
+ /**
776
+ * @desc 强制变量初始化
777
+ * @descEN Require or disallow initialization in variable declarations
778
+ * @see https://eslint.org/docs/latest/rules/init-declarations
779
+ */
780
+ "init-declarations": 0,
781
+ /**
782
+ * @desc 强制使用逻辑赋值运算符
783
+ * @descEN Require or disallow logical assignment operators
784
+ * @see https://eslint.org/docs/latest/rules/logical-assignment-operators
785
+ */
786
+ "logical-assignment-operators": 0,
787
+ /**
788
+ * @desc 限制单个文件中的类数量
789
+ * @descEN Limit the number of classes per file
790
+ * @see https://eslint.org/docs/latest/rules/max-classes-per-file
791
+ */
792
+ "max-classes-per-file": 0,
793
+ /**
794
+ * @desc 限制代码块嵌套深度
795
+ * @descEN Enforce a maximum depth that blocks can be nested
796
+ * @see https://eslint.org/docs/latest/rules/max-depth
797
+ */
798
+ "max-depth": [2, 5],
799
+ /**
800
+ * @desc 限制文件行数
801
+ * @descEN Enforce a maximum number of lines per file
802
+ * @see https://eslint.org/docs/latest/rules/max-lines
803
+ */
804
+ "max-lines": 0,
805
+ /**
806
+ * @desc 限制函数中的行数
807
+ * @descEN Enforce a maximum number of lines per function
808
+ * @see https://eslint.org/docs/latest/rules/max-lines-per-function
809
+ */
810
+ "max-lines-per-function": 0,
811
+ /**
812
+ * @desc 限制回调嵌套深度
813
+ * @descEN Enforce a maximum depth that callbacks can be nested
814
+ * @see https://eslint.org/docs/latest/rules/max-nested-callbacks
815
+ */
816
+ "max-nested-callbacks": 0,
817
+ /**
818
+ * @desc 限制参数数量
819
+ * @descEN Enforce a maximum number of parameters in function definitions
820
+ * @see https://eslint.org/docs/latest/rules/max-params
821
+ */
822
+ "max-params": 0,
823
+ /**
824
+ * @desc 限制函数中的语句数量
825
+ * @descEN Enforce a maximum number of statements allowed in function blocks
826
+ * @see https://eslint.org/docs/latest/rules/max-statements
827
+ */
828
+ "max-statements": 0,
829
+ /**
830
+ * @desc 要求构造函数名以大写字母开头
831
+ * @descEN Require constructor names to begin with a capital letter
832
+ * @see https://eslint.org/docs/latest/rules/new-cap
833
+ */
834
+ "new-cap": [2, { capIsNew: false }],
835
+ /**
836
+ * @desc 禁止使用 alert
837
+ * @descEN Disallow the use of `alert`, `confirm`, and `prompt`
838
+ * @see https://eslint.org/docs/latest/rules/no-alert
839
+ */
840
+ "no-alert": 0,
841
+ /**
842
+ * @desc 禁止使用 Array 构造函数
843
+ * @descEN Disallow `Array` constructors
844
+ * @see https://eslint.org/docs/latest/rules/no-array-constructor
845
+ */
846
+ "no-array-constructor": 2,
847
+ /**
848
+ * @desc 禁止使用位运算符
849
+ * @descEN Disallow bitwise operators
850
+ * @see https://eslint.org/docs/latest/rules/no-bitwise
851
+ */
852
+ "no-bitwise": 0,
853
+ /**
854
+ * @desc 禁止使用 caller 或 callee
855
+ * @descEN Disallow the use of `arguments.caller` or `arguments.callee`
856
+ * @see https://eslint.org/docs/latest/rules/no-caller
857
+ */
858
+ "no-caller": 2,
859
+ /**
860
+ * @desc 禁止在 case/default 子句中使用词法声明
861
+ * @descEN Disallow lexical declarations in case/default clauses
862
+ * @see https://eslint.org/docs/latest/rules/no-case-declarations
863
+ */
864
+ "no-case-declarations": 2,
865
+ /**
866
+ * @desc 禁止使用 console
867
+ * @descEN Disallow the use of `console`
868
+ * @see https://eslint.org/docs/latest/rules/no-console
869
+ */
870
+ "no-console": 0,
871
+ /**
872
+ * @desc 禁止使用 continue
873
+ * @descEN Disallow the use of `continue`
874
+ * @see https://eslint.org/docs/latest/rules/no-continue
875
+ */
876
+ "no-continue": 0,
877
+ /**
878
+ * @desc 禁止删除变量
879
+ * @descEN Disallow deleting variables
880
+ * @see https://eslint.org/docs/latest/rules/no-delete-var
881
+ */
882
+ "no-delete-var": 2,
883
+ /**
884
+ * @desc 禁止使用正则除法标记
885
+ * @descEN Disallow division operators which might be confused with regular expressions
886
+ * @see https://eslint.org/docs/latest/rules/no-div-regex
887
+ */
888
+ "no-div-regex": 2,
889
+ /**
890
+ * @desc 禁止在 else 分支中使用 return
891
+ * @descEN Disallow `else` blocks after `return` statements in `if` blocks
892
+ * @see https://eslint.org/docs/latest/rules/no-else-return
893
+ */
894
+ "no-else-return": 0,
895
+ /**
896
+ * @desc 禁止空块语句
897
+ * @descEN Disallow empty block statements
898
+ * @see https://eslint.org/docs/latest/rules/no-empty
899
+ */
900
+ "no-empty": [2, { allowEmptyCatch: true }],
901
+ /**
902
+ * @desc 禁止空函数
903
+ * @descEN Disallow empty functions
904
+ * @see https://eslint.org/docs/latest/rules/no-empty-function
905
+ */
906
+ "no-empty-function": 0,
907
+ /**
908
+ * @desc 禁止空静态代码块
909
+ * @descEN Disallow empty static blocks
910
+ * @see https://eslint.org/docs/latest/rules/no-empty-static-block
911
+ */
912
+ "no-empty-static-block": 2,
913
+ /**
914
+ * @desc 禁止使用 == 与 null 比较
915
+ * @descEN Disallow `==` and `!=` comparisons against `null`
916
+ * @see https://eslint.org/docs/latest/rules/no-eq-null
917
+ */
918
+ "no-eq-null": 2,
919
+ /**
920
+ * @desc 禁止使用 eval
921
+ * @descEN Disallow the use of `eval()`
922
+ * @see https://eslint.org/docs/latest/rules/no-eval
923
+ */
924
+ "no-eval": 2,
925
+ /**
926
+ * @desc 禁止扩展原生对象
927
+ * @descEN Disallow extending native types
928
+ * @see https://eslint.org/docs/latest/rules/no-extend-native
929
+ */
930
+ "no-extend-native": 2,
931
+ /**
932
+ * @desc 禁止不必要的函数绑定
933
+ * @descEN Disallow unnecessary calls to `.bind()`
934
+ * @see https://eslint.org/docs/latest/rules/no-extra-bind
935
+ */
936
+ "no-extra-bind": 2,
937
+ /**
938
+ * @desc 禁止不必要的布尔类型转换
939
+ * @descEN Disallow unnecessary boolean casts
940
+ * @see https://eslint.org/docs/latest/rules/no-extra-boolean-cast
941
+ */
942
+ "no-extra-boolean-cast": 2,
943
+ /**
944
+ * @desc 禁止不必要的标签
945
+ * @descEN Disallow unnecessary labels
946
+ * @see https://eslint.org/docs/latest/rules/no-extra-label
947
+ */
948
+ "no-extra-label": 0,
949
+ /**
950
+ * @desc 禁止对全局对象赋值
951
+ * @descEN Disallow assignments to native objects or read-only global variables
952
+ * @see https://eslint.org/docs/latest/rules/no-global-assign
953
+ */
954
+ "no-global-assign": 2,
955
+ /**
956
+ * @desc 禁止隐式类型转换
957
+ * @descEN Disallow shorthand type conversions
958
+ * @see https://eslint.org/docs/latest/rules/no-implicit-coercion
959
+ */
960
+ "no-implicit-coercion": [2, { allow: ["!!"] }],
961
+ /**
962
+ * @desc 禁止隐式全局变量
963
+ * @descEN Disallow declarations in the global scope
964
+ * @see https://eslint.org/docs/latest/rules/no-implicit-globals
965
+ */
966
+ "no-implicit-globals": 0,
967
+ /**
968
+ * @desc 禁止隐式 eval
969
+ * @descEN Disallow the use of `eval()`-like methods
970
+ * @see https://eslint.org/docs/latest/rules/no-implied-eval
971
+ */
972
+ "no-implied-eval": 2,
973
+ /**
974
+ * @desc 禁止行内注释
975
+ * @descEN Disallow inline comments after code
976
+ * @see https://eslint.org/docs/latest/rules/no-inline-comments
977
+ */
978
+ "no-inline-comments": 0,
979
+ /**
980
+ * @desc 禁止无效的 this
981
+ * @descEN Disallow use of `this` in contexts where the value of `this` is `undefined`
982
+ * @see https://eslint.org/docs/latest/rules/no-invalid-this
983
+ */
984
+ "no-invalid-this": 0,
985
+ /**
986
+ * @desc 禁止使用 __iterator__
987
+ * @descEN Disallow the use of the `__iterator__` property
988
+ * @see https://eslint.org/docs/latest/rules/no-iterator
989
+ */
990
+ "no-iterator": 2,
991
+ /**
992
+ * @desc 禁止 label 与变量同名
993
+ * @descEN Disallow labels that share a name with a variable
994
+ * @see https://eslint.org/docs/latest/rules/no-label-var
995
+ */
996
+ "no-label-var": 2,
997
+ /**
998
+ * @desc 禁止使用标签语句
999
+ * @descEN Disallow labeled statements
1000
+ * @see https://eslint.org/docs/latest/rules/no-labels
1001
+ */
1002
+ "no-labels": 2,
1003
+ /**
1004
+ * @desc 禁止不必要的代码块
1005
+ * @descEN Disallow unnecessary nested blocks
1006
+ * @see https://eslint.org/docs/latest/rules/no-lone-blocks
1007
+ */
1008
+ "no-lone-blocks": 2,
1009
+ /**
1010
+ * @desc 禁止 if 作为唯一语句的 else 块
1011
+ * @descEN Disallow `if` statements as the only statement in `else` blocks
1012
+ * @see https://eslint.org/docs/latest/rules/no-lonely-if
1013
+ */
1014
+ "no-lonely-if": 0,
1015
+ /**
1016
+ * @desc 禁止在循环中使用函数声明
1017
+ * @descEN Disallow function declarations inside loops
1018
+ * @see https://eslint.org/docs/latest/rules/no-loop-func
1019
+ */
1020
+ "no-loop-func": 0,
1021
+ /**
1022
+ * @desc 禁止使用魔术数字
1023
+ * @descEN Disallow magic numbers
1024
+ * @see https://eslint.org/docs/latest/rules/no-magic-numbers
1025
+ */
1026
+ "no-magic-numbers": 0,
1027
+ /**
1028
+ * @desc 禁止连续赋值
1029
+ * @descEN Disallow chained assignments
1030
+ * @see https://eslint.org/docs/latest/rules/no-multi-assign
1031
+ */
1032
+ "no-multi-assign": 0,
1033
+ /**
1034
+ * @desc 禁止多行字符串
1035
+ * @descEN Disallow multiline strings
1036
+ * @see https://eslint.org/docs/latest/rules/no-multi-str
1037
+ */
1038
+ "no-multi-str": 2,
1039
+ /**
1040
+ * @desc 禁止否定条件
1041
+ * @descEN Disallow negated conditions
1042
+ * @see https://eslint.org/docs/latest/rules/no-negated-condition
1043
+ */
1044
+ "no-negated-condition": 0,
1045
+ /**
1046
+ * @desc 禁止嵌套三元表达式
1047
+ * @descEN Disallow nested ternary expressions
1048
+ * @see https://eslint.org/docs/latest/rules/no-nested-ternary
1049
+ */
1050
+ "no-nested-ternary": 0,
1051
+ /**
1052
+ * @desc 禁止使用 new 而不赋值
1053
+ * @descEN Disallow `new` operators outside of assignments or comparisons
1054
+ * @see https://eslint.org/docs/latest/rules/no-new
1055
+ */
1056
+ "no-new": 2,
1057
+ /**
1058
+ * @desc 禁止使用 new Function
1059
+ * @descEN Disallow `new Function()` expressions
1060
+ * @see https://eslint.org/docs/latest/rules/no-new-func
1061
+ */
1062
+ "no-new-func": 2,
1063
+ /**
1064
+ * @desc 禁止使用原始包装类型
1065
+ * @descEN Disallow `new` operators with the `String`, `Number`, and `Boolean` objects
1066
+ * @see https://eslint.org/docs/latest/rules/no-new-wrappers
1067
+ */
1068
+ "no-new-wrappers": 2,
1069
+ /**
1070
+ * @desc 禁止八进制转义符中的无意义数字
1071
+ * @descEN Disallow `\8` and `\9` escape sequences in string literals
1072
+ * @see https://eslint.org/docs/latest/rules/no-nonoctal-decimal-escape
1073
+ */
1074
+ "no-nonoctal-decimal-escape": 2,
1075
+ /**
1076
+ * @desc 禁止使用 Object 构造函数
1077
+ * @descEN Disallow `Object` constructors
1078
+ * @see https://eslint.org/docs/latest/rules/no-object-constructor
1079
+ */
1080
+ "no-object-constructor": 2,
1081
+ /**
1082
+ * @desc 禁止使用八进制字面量
1083
+ * @descEN Disallow octal literals
1084
+ * @see https://eslint.org/docs/latest/rules/no-octal
1085
+ */
1086
+ "no-octal": 2,
1087
+ /**
1088
+ * @desc 禁止八进制转义序列
1089
+ * @descEN Disallow octal escape sequences in string literals
1090
+ * @see https://eslint.org/docs/latest/rules/no-octal-escape
1091
+ */
1092
+ "no-octal-escape": 0,
1093
+ /**
1094
+ * @desc 禁止重新分配函数参数
1095
+ * @descEN Disallow reassigning function parameters
1096
+ * @see https://eslint.org/docs/latest/rules/no-param-reassign
1097
+ */
1098
+ "no-param-reassign": 2,
1099
+ /**
1100
+ * @desc 禁止使用 ++ 和 --
1101
+ * @descEN Disallow the unary operators `++` and `--`
1102
+ * @see https://eslint.org/docs/latest/rules/no-plusplus
1103
+ */
1104
+ "no-plusplus": 0,
1105
+ /**
1106
+ * @desc 禁止使用 __proto__
1107
+ * @descEN Disallow the use of the `__proto__` property
1108
+ * @see https://eslint.org/docs/latest/rules/no-proto
1109
+ */
1110
+ "no-proto": 2,
1111
+ /**
1112
+ * @desc 禁止重复声明变量
1113
+ * @descEN Disallow variable redeclaration
1114
+ * @see https://eslint.org/docs/latest/rules/no-redeclare
1115
+ */
1116
+ "no-redeclare": 2,
1117
+ /**
1118
+ * @desc 禁止正则表达式中的空格
1119
+ * @descEN Disallow multiple spaces in regular expression literals
1120
+ * @see https://eslint.org/docs/latest/rules/no-regex-spaces
1121
+ */
1122
+ "no-regex-spaces": 2,
1123
+ /**
1124
+ * @desc 禁止受限的导出名称
1125
+ * @descEN Disallow specified names in exports
1126
+ * @see https://eslint.org/docs/latest/rules/no-restricted-exports
1127
+ */
1128
+ "no-restricted-exports": 0,
1129
+ /**
1130
+ * @desc 禁止受限的全局变量
1131
+ * @descEN Disallow specified global variables
1132
+ * @see https://eslint.org/docs/latest/rules/no-restricted-globals
1133
+ */
1134
+ "no-restricted-globals": 0,
1135
+ /**
1136
+ * @desc 禁止受限的导入
1137
+ * @descEN Disallow specified modules when loaded by `import`
1138
+ * @see https://eslint.org/docs/latest/rules/no-restricted-imports
1139
+ */
1140
+ "no-restricted-imports": 0,
1141
+ /**
1142
+ * @desc 禁止受限的属性
1143
+ * @descEN Disallow certain properties on certain objects
1144
+ * @see https://eslint.org/docs/latest/rules/no-restricted-properties
1145
+ */
1146
+ "no-restricted-properties": 0,
1147
+ /**
1148
+ * @desc 禁止受限的语法
1149
+ * @descEN Disallow specified syntax
1150
+ * @see https://eslint.org/docs/latest/rules/no-restricted-syntax
1151
+ */
1152
+ "no-restricted-syntax": 0,
1153
+ /**
1154
+ * @desc 强制 return 赋值
1155
+ * @descEN Disallow assignment in `return` statements
1156
+ * @see https://eslint.org/docs/latest/rules/no-return-assign
1157
+ */
1158
+ "no-return-assign": [2, "always"],
1159
+ /**
1160
+ * @desc 禁止使用 javascript: URL
1161
+ * @descEN Disallow `javascript:` URLs
1162
+ * @see https://eslint.org/docs/latest/rules/no-script-url
1163
+ */
1164
+ "no-script-url": 0,
1165
+ /**
1166
+ * @desc 禁止使用逗号表达式
1167
+ * @descEN Disallow comma operators
1168
+ * @see https://eslint.org/docs/latest/rules/no-sequences
1169
+ */
1170
+ "no-sequences": 2,
1171
+ /**
1172
+ * @desc 禁止变量声明覆盖外层作用域
1173
+ * @descEN Disallow variable declarations from shadowing outer scope variables
1174
+ * @see https://eslint.org/docs/latest/rules/no-shadow
1175
+ */
1176
+ "no-shadow": 0,
1177
+ /**
1178
+ * @desc 禁止遮蔽受限的标识符
1179
+ * @descEN Disallow identifiers from shadowing restricted names
1180
+ * @see https://eslint.org/docs/latest/rules/no-shadow-restricted-names
1181
+ */
1182
+ "no-shadow-restricted-names": 2,
1183
+ /**
1184
+ * @desc 禁止使用三元表达式
1185
+ * @descEN Disallow ternary operators
1186
+ * @see https://eslint.org/docs/latest/rules/no-ternary
1187
+ */
1188
+ "no-ternary": 0,
1189
+ /**
1190
+ * @desc 禁止抛出字面量
1191
+ * @descEN Disallow throwing literals as exceptions
1192
+ * @see https://eslint.org/docs/latest/rules/no-throw-literal
1193
+ */
1194
+ "no-throw-literal": 0,
1195
+ /**
1196
+ * @desc 禁止将 undefined 赋值给变量
1197
+ * @descEN Disallow initializing variables to `undefined`
1198
+ * @see https://eslint.org/docs/latest/rules/no-undef-init
1199
+ */
1200
+ "no-undef-init": 2,
1201
+ /**
1202
+ * @desc 禁止使用 undefined
1203
+ * @descEN Disallow the use of `undefined` as an identifier
1204
+ * @see https://eslint.org/docs/latest/rules/no-undefined
1205
+ */
1206
+ "no-undefined": 0,
1207
+ /**
1208
+ * @desc 禁止标识符有前导或尾随下划线
1209
+ * @descEN Disallow dangling underscores in identifiers
1210
+ * @see https://eslint.org/docs/latest/rules/no-underscore-dangle
1211
+ */
1212
+ "no-underscore-dangle": 0,
1213
+ /**
1214
+ * @desc 禁止不必要的三元表达式
1215
+ * @descEN Disallow ternary operators when simpler alternatives exist
1216
+ * @see https://eslint.org/docs/latest/rules/no-unneeded-ternary
1217
+ */
1218
+ "no-unneeded-ternary": 2,
1219
+ /**
1220
+ * @desc 禁止未使用的表达式
1221
+ * @descEN Disallow unused expressions
1222
+ * @see https://eslint.org/docs/latest/rules/no-unused-expressions
1223
+ */
1224
+ "no-unused-expressions": [1, {
1225
+ ignoreDirectives: true,
1226
+ allowShortCircuit: true
1227
+ }],
1228
+ /**
1229
+ * @desc 禁止未使用的标签
1230
+ * @descEN Disallow unused labels
1231
+ * @see https://eslint.org/docs/latest/rules/no-unused-labels
1232
+ */
1233
+ "no-unused-labels": 1,
1234
+ /**
1235
+ * @desc 禁止不必要的函数调用
1236
+ * @descEN Disallow unnecessary calls to `.call()` and `.apply()`
1237
+ * @see https://eslint.org/docs/latest/rules/no-useless-call
1238
+ */
1239
+ "no-useless-call": 2,
1240
+ /**
1241
+ * @desc 禁止不必要的 catch 语句
1242
+ * @descEN Disallow unnecessary `catch` clauses
1243
+ * @see https://eslint.org/docs/latest/rules/no-useless-catch
1244
+ */
1245
+ "no-useless-catch": 2,
1246
+ /**
1247
+ * @desc 禁止不必要的计算属性键
1248
+ * @descEN Disallow unnecessary computed property keys
1249
+ * @see https://eslint.org/docs/latest/rules/no-useless-computed-key
1250
+ */
1251
+ "no-useless-computed-key": 2,
1252
+ /**
1253
+ * @desc 禁止无用的字符串拼接
1254
+ * @descEN Disallow unnecessary concatenation of literals or template literals
1255
+ * @see https://eslint.org/docs/latest/rules/no-useless-concat
1256
+ */
1257
+ "no-useless-concat": 0,
1258
+ /**
1259
+ * @desc 禁止无用的构造函数
1260
+ * @descEN Disallow unnecessary constructors
1261
+ * @see https://eslint.org/docs/latest/rules/no-useless-constructor
1262
+ */
1263
+ "no-useless-constructor": 0,
1264
+ /**
1265
+ * @desc 禁止不必要的转义
1266
+ * @descEN Disallow unnecessary escape characters
1267
+ * @see https://eslint.org/docs/latest/rules/no-useless-escape
1268
+ */
1269
+ "no-useless-escape": 2,
1270
+ /**
1271
+ * @desc 禁止不必要的重命名
1272
+ * @descEN Disallow renaming import/export/destructured assignments
1273
+ * @see https://eslint.org/docs/latest/rules/no-useless-rename
1274
+ */
1275
+ "no-useless-rename": 2,
1276
+ /**
1277
+ * @desc 禁止多余的 return
1278
+ * @descEN Disallow redundant return statements
1279
+ * @see https://eslint.org/docs/latest/rules/no-useless-return
1280
+ */
1281
+ "no-useless-return": 2,
1282
+ /**
1283
+ * @desc 禁止使用 var
1284
+ * @descEN Require `let` or `const` instead of `var`
1285
+ * @see https://eslint.org/docs/latest/rules/no-var
1286
+ */
1287
+ "no-var": 2,
1288
+ /**
1289
+ * @desc 禁止使用 void
1290
+ * @descEN Disallow the use of `void` operators
1291
+ * @see https://eslint.org/docs/latest/rules/no-void
1292
+ */
1293
+ "no-void": 0,
1294
+ /**
1295
+ * @desc 禁止警告注释
1296
+ * @descEN Disallow specified warning terms in comments
1297
+ * @see https://eslint.org/docs/latest/rules/no-warning-comments
1298
+ */
1299
+ "no-warning-comments": 0,
1300
+ /**
1301
+ * @desc 禁止使用 with
1302
+ * @descEN Disallow `with` statements
1303
+ * @see https://eslint.org/docs/latest/rules/no-with
1304
+ */
1305
+ "no-with": 2,
1306
+ /**
1307
+ * @desc 强制对象字面量简写语法
1308
+ * @descEN Require or disallow object literal shorthand syntax
1309
+ * @see https://eslint.org/docs/latest/rules/object-shorthand
1310
+ */
1311
+ "object-shorthand": 0,
1312
+ /**
1313
+ * @desc 强制变量声明风格
1314
+ * @descEN Enforce the use of `let` or `const` or `var` per declaration
1315
+ * @see https://eslint.org/docs/latest/rules/one-var
1316
+ */
1317
+ "one-var": [2, "never"],
1318
+ /**
1319
+ * @desc 强制使用复合赋值运算符
1320
+ * @descEN Require or disallow assignment operator shorthand
1321
+ * @see https://eslint.org/docs/latest/rules/operator-assignment
1322
+ */
1323
+ "operator-assignment": 0,
1324
+ /**
1325
+ * @desc 强制使用箭头函数作为回调
1326
+ * @descEN Require using arrow functions for callbacks
1327
+ * @see https://eslint.org/docs/latest/rules/prefer-arrow-callback
1328
+ */
1329
+ "prefer-arrow-callback": 2,
1330
+ /**
1331
+ * @desc 优先使用 const
1332
+ * @descEN Require `const` declarations for variables that are never reassigned
1333
+ * @see https://eslint.org/docs/latest/rules/prefer-const
1334
+ */
1335
+ "prefer-const": 2,
1336
+ /**
1337
+ * @desc 优先使用解构赋值
1338
+ * @descEN Require destructuring from arrays and/or objects
1339
+ * @see https://eslint.org/docs/latest/rules/prefer-destructuring
1340
+ */
1341
+ "prefer-destructuring": 0,
1342
+ /**
1343
+ * @desc 优先使用指数运算符
1344
+ * @descEN Disallow the use of `Math.pow()` in favor of `**`
1345
+ * @see https://eslint.org/docs/latest/rules/prefer-exponentiation-operator
1346
+ */
1347
+ "prefer-exponentiation-operator": 0,
1348
+ /**
1349
+ * @desc 优先使用命名捕获组
1350
+ * @descEN Require named capture groups in regular expressions
1351
+ * @see https://eslint.org/docs/latest/rules/prefer-named-capture-group
1352
+ */
1353
+ "prefer-named-capture-group": 0,
1354
+ /**
1355
+ * @desc 优先使用数字字面量
1356
+ * @descEN Disallow `parseInt()` and `Number.parseInt()` in favor of binary, octal, and hexadecimal literals
1357
+ * @see https://eslint.org/docs/latest/rules/prefer-numeric-literals
1358
+ */
1359
+ "prefer-numeric-literals": 2,
1360
+ /**
1361
+ * @desc 优先使用 Object.hasOwn
1362
+ * @descEN Disallow `Object.prototype.hasOwnProperty.call()` in favor of `Object.hasOwn()`
1363
+ * @see https://eslint.org/docs/latest/rules/prefer-object-has-own
1364
+ */
1365
+ "prefer-object-has-own": 0,
1366
+ /**
1367
+ * @desc 优先使用对象展开运算符
1368
+ * @descEN Disallow using `Object.assign()` with an object literal as the first argument
1369
+ * @see https://eslint.org/docs/latest/rules/prefer-object-spread
1370
+ */
1371
+ "prefer-object-spread": 2,
1372
+ /**
1373
+ * @desc 优先使用 Promise.reject() 抛出错误
1374
+ * @descEN Require using Error objects as Promise rejection reasons
1375
+ * @see https://eslint.org/docs/latest/rules/prefer-promise-reject-errors
1376
+ */
1377
+ "prefer-promise-reject-errors": 0,
1378
+ /**
1379
+ * @desc 优先使用正则字面量
1380
+ * @descEN Disallow use of the `RegExp` constructor in favor of regular expression literals
1381
+ * @see https://eslint.org/docs/latest/rules/prefer-regex-literals
1382
+ */
1383
+ "prefer-regex-literals": 0,
1384
+ /**
1385
+ * @desc 优先使用剩余参数
1386
+ * @descEN Require rest parameters instead of `arguments`
1387
+ * @see https://eslint.org/docs/latest/rules/prefer-rest-params
1388
+ */
1389
+ "prefer-rest-params": 0,
1390
+ /**
1391
+ * @desc 优先使用展开语法
1392
+ * @descEN Require spread operators instead of `.apply()`
1393
+ * @see https://eslint.org/docs/latest/rules/prefer-spread
1394
+ */
1395
+ "prefer-spread": 0,
1396
+ /**
1397
+ * @desc 优先使用模板字符串
1398
+ * @descEN Require template literals instead of string concatenation
1399
+ * @see https://eslint.org/docs/latest/rules/prefer-template
1400
+ */
1401
+ "prefer-template": 0,
1402
+ /**
1403
+ * @desc 禁止重抛自定义错误时丢失原始错误
1404
+ * @descEN Disallow losing originally caught error when re-throwing custom errors
1405
+ * @see https://eslint.org/docs/latest/rules/preserve-caught-error
1406
+ */
1407
+ "preserve-caught-error": 1,
1408
+ /**
1409
+ * @desc 强制使用 parseInt 时指定基数
1410
+ * @descEN Require the use of the second argument in `parseInt()`
1411
+ * @see https://eslint.org/docs/latest/rules/radix
1412
+ */
1413
+ "radix": 2,
1414
+ /**
1415
+ * @desc 禁用不必要的 await
1416
+ * @descEN Disallow `await` inside of `async` functions when there is no useful work
1417
+ * @see https://eslint.org/docs/latest/rules/require-await
1418
+ */
1419
+ "require-await": 0,
1420
+ /**
1421
+ * @desc 强制在正则表达式中使用 u 或 v 标志
1422
+ * @descEN Require the use of the `u` or `v` flag in regular expressions
1423
+ * @see https://eslint.org/docs/latest/rules/require-unicode-regexp
1424
+ */
1425
+ "require-unicode-regexp": 0,
1426
+ /**
1427
+ * @desc 要求 generator 函数中有 yield
1428
+ * @descEN Require `yield` statements in generator functions
1429
+ * @see https://eslint.org/docs/latest/rules/require-yield
1430
+ */
1431
+ "require-yield": 2,
1432
+ /**
1433
+ * @desc 强制 import 排序
1434
+ * @descEN Enforce sorted import declarations
1435
+ * @see https://eslint.org/docs/latest/rules/sort-imports
1436
+ */
1437
+ "sort-imports": 0,
1438
+ /**
1439
+ * @desc 强制对象键排序
1440
+ * @descEN Require object keys to be sorted
1441
+ * @see https://eslint.org/docs/latest/rules/sort-keys
1442
+ */
1443
+ "sort-keys": 0,
1444
+ /**
1445
+ * @desc 强制变量排序
1446
+ * @descEN Require variables within the same declaration block to be sorted
1447
+ * @see https://eslint.org/docs/latest/rules/sort-vars
1448
+ */
1449
+ "sort-vars": 0,
1450
+ /**
1451
+ * @desc 强制严格模式
1452
+ * @descEN Require or disallow strict mode directives
1453
+ * @see https://eslint.org/docs/latest/rules/strict
1454
+ */
1455
+ "strict": 2,
1456
+ /**
1457
+ * @desc 要求 Symbol 描述
1458
+ * @descEN Require symbol descriptions
1459
+ * @see https://eslint.org/docs/latest/rules/symbol-description
1460
+ */
1461
+ "symbol-description": 2,
1462
+ /**
1463
+ * @desc 要求或禁止 Unicode BOM
1464
+ * @descEN Require or disallow Unicode byte order mark (BOM)
1465
+ * @see https://eslint.org/docs/latest/rules/unicode-bom
1466
+ */
1467
+ "unicode-bom": 0,
1468
+ /**
1469
+ * @desc 要求 var 声明在作用域顶部
1470
+ * @descEN Require `var` declarations to be placed at the top of their containing scope
1471
+ * @see https://eslint.org/docs/latest/rules/vars-on-top
1472
+ */
1473
+ "vars-on-top": 0,
1474
+ /**
1475
+ * @desc 强制比较运算符风格
1476
+ * @descEN Require or disallow "yoda" conditions
1477
+ * @see https://eslint.org/docs/latest/rules/yoda
1478
+ */
1479
+ "yoda": [
1480
+ 2,
1481
+ "never",
1482
+ { onlyEquality: true }
1483
+ ]
1484
+ };
1485
+ //#endregion
1486
+ //#region src/core.react.ts
1487
+ /**
1488
+ * `react` 规则组配置
1489
+ *
1490
+ * 规则名 → 严重级别/配置的映射:`react` 组经预设工厂(`src/config.ts`)装配进 flat config,注册名 `react`。
1491
+ */
1492
+ const rules$4 = {
1493
+ /**
1494
+ * @desc 验证子组件错误是否使用 Error Boundaries 而非 try/catch
1495
+ * @descEN Validates usage of Error Boundaries instead of try/catch for errors in child components
1496
+ * @see https://www.eslint-react.xyz/docs/rules/error-boundaries
1497
+ */
1498
+ "react/error-boundaries": 2,
1499
+ /**
1500
+ * @desc 验证 useEffect 等 Hooks 的依赖列表完整性
1501
+ * @descEN Verifies the list of dependencies for Hooks like useEffect and similar
1502
+ * @see https://www.eslint-react.xyz/docs/rules/exhaustive-deps
1503
+ */
1504
+ "react/exhaustive-deps": 1,
1505
+ /**
1506
+ * @desc 禁止在 render 期间对全局变量赋值/修改
1507
+ * @descEN Validates against assignment/mutation of globals during render
1508
+ * @see https://www.eslint-react.xyz/docs/rules/globals
1509
+ */
1510
+ "react/globals": 0,
1511
+ /**
1512
+ * @desc 禁止修改 props、state 等不可变值
1513
+ * @descEN Validates against mutating props, state, and other values that are immutable
1514
+ * @see https://www.eslint-react.xyz/docs/rules/immutability
1515
+ */
1516
+ "react/immutability": 2,
1517
+ /**
1518
+ * @desc 禁止在 setState 回调中访问 this.state
1519
+ * @descEN Disallows accessing this.state inside setState calls
1520
+ * @see https://www.eslint-react.xyz/docs/rules/no-access-state-in-setstate
1521
+ */
1522
+ "react/no-access-state-in-setstate": 2,
1523
+ /**
1524
+ * @desc 禁止使用数组索引作为 key
1525
+ * @descEN Disallows using an item's index in the array as its key
1526
+ * @see https://www.eslint-react.xyz/docs/rules/no-array-index-key
1527
+ */
1528
+ "react/no-array-index-key": 1,
1529
+ /**
1530
+ * @desc 禁止使用 Children.count
1531
+ * @descEN Disallows the use of Children.count from the react package
1532
+ * @see https://www.eslint-react.xyz/docs/rules/no-children-count
1533
+ */
1534
+ "react/no-children-count": 1,
1535
+ /**
1536
+ * @desc 禁止使用 Children.forEach
1537
+ * @descEN Disallows the use of Children.forEach from the react package
1538
+ * @see https://www.eslint-react.xyz/docs/rules/no-children-for-each
1539
+ */
1540
+ "react/no-children-for-each": 1,
1541
+ /**
1542
+ * @desc 禁止使用 Children.map
1543
+ * @descEN Disallows the use of Children.map from the react package
1544
+ * @see https://www.eslint-react.xyz/docs/rules/no-children-map
1545
+ */
1546
+ "react/no-children-map": 1,
1547
+ /**
1548
+ * @desc 禁止使用 Children.only
1549
+ * @descEN Disallows the use of Children.only from the react package
1550
+ * @see https://www.eslint-react.xyz/docs/rules/no-children-only
1551
+ */
1552
+ "react/no-children-only": 1,
1553
+ /**
1554
+ * @desc 禁止使用 Children.toArray
1555
+ * @descEN Disallows the use of Children.toArray from the react package
1556
+ * @see https://www.eslint-react.xyz/docs/rules/no-children-to-array
1557
+ */
1558
+ "react/no-children-to-array": 1,
1559
+ /**
1560
+ * @desc 禁止使用类组件(错误边界除外)
1561
+ * @descEN Disallows class components except for error boundaries
1562
+ * @see https://www.eslint-react.xyz/docs/rules/no-class-component
1563
+ */
1564
+ "react/no-class-component": 2,
1565
+ /**
1566
+ * @desc 禁止使用 cloneElement
1567
+ * @descEN Disallows cloneElement
1568
+ * @see https://www.eslint-react.xyz/docs/rules/no-clone-element
1569
+ */
1570
+ "react/no-clone-element": 1,
1571
+ /**
1572
+ * @desc 禁止使用 componentWillMount,替换为 UNSAFE_componentWillMount
1573
+ * @descEN Replaces usage of componentWillMount with UNSAFE_componentWillMount
1574
+ * @see https://www.eslint-react.xyz/docs/rules/no-component-will-mount
1575
+ */
1576
+ "react/no-component-will-mount": 2,
1577
+ /**
1578
+ * @desc 禁止使用 componentWillReceiveProps,替换为 UNSAFE_componentWillReceiveProps
1579
+ * @descEN Replaces usage of componentWillReceiveProps with UNSAFE_componentWillReceiveProps
1580
+ * @see https://www.eslint-react.xyz/docs/rules/no-component-will-receive-props
1581
+ */
1582
+ "react/no-component-will-receive-props": 2,
1583
+ /**
1584
+ * @desc 禁止使用 componentWillUpdate,替换为 UNSAFE_componentWillUpdate
1585
+ * @descEN Replaces usage of componentWillUpdate with UNSAFE_componentWillUpdate
1586
+ * @see https://www.eslint-react.xyz/docs/rules/no-component-will-update
1587
+ */
1588
+ "react/no-component-will-update": 2,
1589
+ /**
1590
+ * @desc 禁止使用 Context.Provider,替换为 Context
1591
+ * @descEN Replaces usage of Context.Provider with Context
1592
+ * @see https://www.eslint-react.xyz/docs/rules/no-context-provider
1593
+ */
1594
+ "react/no-context-provider": 2,
1595
+ /**
1596
+ * @desc 禁止在函数组件中使用 createRef
1597
+ * @descEN Disallows createRef in function components
1598
+ * @see https://www.eslint-react.xyz/docs/rules/no-create-ref
1599
+ */
1600
+ "react/no-create-ref": 2,
1601
+ /**
1602
+ * @desc 禁止直接修改 this.state
1603
+ * @descEN Disallows direct mutation of this.state
1604
+ * @see https://www.eslint-react.xyz/docs/rules/no-direct-mutation-state
1605
+ */
1606
+ "react/no-direct-mutation-state": 2,
1607
+ /**
1608
+ * @desc 防止渲染列表时兄弟元素存在重复 key
1609
+ * @descEN Prevents duplicate key props on sibling elements when rendering lists
1610
+ * @see https://www.eslint-react.xyz/docs/rules/no-duplicate-key
1611
+ */
1612
+ "react/no-duplicate-key": 1,
1613
+ /**
1614
+ * @desc 禁止使用 forwardRef,改为将 ref 作为 prop 传递
1615
+ * @descEN Replaces usage of forwardRef with passing ref as a prop
1616
+ * @see https://www.eslint-react.xyz/docs/rules/no-forward-ref
1617
+ */
1618
+ "react/no-forward-ref": 2,
1619
+ /**
1620
+ * @desc 防止隐式传递 children prop
1621
+ * @descEN Prevents implicitly passing the children prop to components
1622
+ * @see https://www.eslint-react.xyz/docs/rules/no-implicit-children
1623
+ */
1624
+ "react/no-implicit-children": 0,
1625
+ /**
1626
+ * @desc 防止隐式传递 key prop
1627
+ * @descEN Prevents implicitly passing the key prop to components
1628
+ * @see https://www.eslint-react.xyz/docs/rules/no-implicit-key
1629
+ */
1630
+ "react/no-implicit-key": 1,
1631
+ /**
1632
+ * @desc 防止隐式传递 ref prop
1633
+ * @descEN Prevents implicitly passing the ref prop to components
1634
+ * @see https://www.eslint-react.xyz/docs/rules/no-implicit-ref
1635
+ */
1636
+ "react/no-implicit-ref": 1,
1637
+ /**
1638
+ * @desc 防止有问题的泄漏值被渲染
1639
+ * @descEN Prevents problematic leaked values from being rendered
1640
+ * @see https://www.eslint-react.xyz/docs/rules/no-leaked-conditional-rendering
1641
+ */
1642
+ "react/no-leaked-conditional-rendering": 2,
1643
+ /**
1644
+ * @desc 要求所有组件都有 displayName
1645
+ * @descEN Enforces that all components have a displayName that can be used in DevTools
1646
+ * @see https://www.eslint-react.xyz/docs/rules/no-missing-component-display-name
1647
+ */
1648
+ "react/no-missing-component-display-name": 1,
1649
+ /**
1650
+ * @desc 要求所有 context 都有 displayName
1651
+ * @descEN Enforces that all contexts have a displayName that can be used in DevTools
1652
+ * @see https://www.eslint-react.xyz/docs/rules/no-missing-context-display-name
1653
+ */
1654
+ "react/no-missing-context-display-name": 1,
1655
+ /**
1656
+ * @desc 禁止列表渲染中缺少 key
1657
+ * @descEN Disallows missing key on items in list rendering
1658
+ * @see https://www.eslint-react.xyz/docs/rules/no-missing-key
1659
+ */
1660
+ "react/no-missing-key": 2,
1661
+ /**
1662
+ * @desc 防止错误使用 captureOwnerStack
1663
+ * @descEN Prevents incorrect usage of captureOwnerStack
1664
+ * @see https://www.eslint-react.xyz/docs/rules/no-misused-capture-owner-stack
1665
+ */
1666
+ "react/no-misused-capture-owner-stack": 2,
1667
+ /**
1668
+ * @desc 禁止在其他组件内部嵌套定义组件
1669
+ * @descEN Disallows nesting component definitions inside other components
1670
+ * @see https://www.eslint-react.xyz/docs/rules/no-nested-component-definitions
1671
+ */
1672
+ "react/no-nested-component-definitions": 2,
1673
+ /**
1674
+ * @desc 禁止在其他组件或 hooks 内嵌套 lazy 组件声明
1675
+ * @descEN Disallows nesting lazy component declarations inside other components or hooks
1676
+ * @see https://www.eslint-react.xyz/docs/rules/no-nested-lazy-component-declarations
1677
+ */
1678
+ "react/no-nested-lazy-component-declarations": 2,
1679
+ /**
1680
+ * @desc 禁止在 componentDidMount 中调用 setState
1681
+ * @descEN Disallows calling this.setState in componentDidMount outside functions such as callbacks
1682
+ * @see https://www.eslint-react.xyz/docs/rules/no-set-state-in-component-did-mount
1683
+ */
1684
+ "react/no-set-state-in-component-did-mount": 2,
1685
+ /**
1686
+ * @desc 禁止在 componentDidUpdate 中调用 setState
1687
+ * @descEN Disallows calling this.setState in componentDidUpdate outside functions such as callbacks
1688
+ * @see https://www.eslint-react.xyz/docs/rules/no-set-state-in-component-did-update
1689
+ */
1690
+ "react/no-set-state-in-component-did-update": 2,
1691
+ /**
1692
+ * @desc 禁止在 componentWillUpdate 中调用 setState
1693
+ * @descEN Disallows calling this.setState in componentWillUpdate outside functions such as callbacks
1694
+ * @see https://www.eslint-react.xyz/docs/rules/no-set-state-in-component-will-update
1695
+ */
1696
+ "react/no-set-state-in-component-will-update": 2,
1697
+ /**
1698
+ * @desc 要求以 use 为前缀的函数体内至少使用一个 Hook
1699
+ * @descEN Enforces that a function with the use prefix uses at least one Hook inside it
1700
+ * @see https://www.eslint-react.xyz/docs/rules/no-unnecessary-use-prefix
1701
+ */
1702
+ "react/no-unnecessary-use-prefix": 2,
1703
+ /**
1704
+ * @desc 警告使用 UNSAFE_componentWillMount
1705
+ * @descEN Warns about the use of UNSAFE_componentWillMount in class components
1706
+ * @see https://www.eslint-react.xyz/docs/rules/no-unsafe-component-will-mount
1707
+ */
1708
+ "react/no-unsafe-component-will-mount": 2,
1709
+ /**
1710
+ * @desc 警告使用 UNSAFE_componentWillReceiveProps
1711
+ * @descEN Warns about the use of UNSAFE_componentWillReceiveProps in class components
1712
+ * @see https://www.eslint-react.xyz/docs/rules/no-unsafe-component-will-receive-props
1713
+ */
1714
+ "react/no-unsafe-component-will-receive-props": 2,
1715
+ /**
1716
+ * @desc 警告使用 UNSAFE_componentWillUpdate
1717
+ * @descEN Warns about the use of UNSAFE_componentWillUpdate in class components
1718
+ * @see https://www.eslint-react.xyz/docs/rules/no-unsafe-component-will-update
1719
+ */
1720
+ "react/no-unsafe-component-will-update": 2,
1721
+ /**
1722
+ * @desc 防止非稳定值作为 Context.Provider 的 value
1723
+ * @descEN Prevents non-stable values from being used as a value for Context.Provider
1724
+ * @see https://www.eslint-react.xyz/docs/rules/no-unstable-context-value
1725
+ */
1726
+ "react/no-unstable-context-value": 2,
1727
+ /**
1728
+ * @desc 防止引用类型值用作对象解构的默认 props
1729
+ * @descEN Prevents using referential-type values as default props in object destructuring
1730
+ * @see https://www.eslint-react.xyz/docs/rules/no-unstable-default-props
1731
+ */
1732
+ "react/no-unstable-default-props": 2,
1733
+ /**
1734
+ * @desc 警告未使用的类组件方法和属性
1735
+ * @descEN Warns about unused class component methods and properties
1736
+ * @see https://www.eslint-react.xyz/docs/rules/no-unused-class-component-members
1737
+ */
1738
+ "react/no-unused-class-component-members": 1,
1739
+ /**
1740
+ * @desc 警告已定义但从未使用的组件 props
1741
+ * @descEN Warns about component props that are defined but never used
1742
+ * @see https://www.eslint-react.xyz/docs/rules/no-unused-props
1743
+ */
1744
+ "react/no-unused-props": 1,
1745
+ /**
1746
+ * @desc 警告已定义但从未使用的 state 变量
1747
+ * @descEN Warns about state variables that are defined but never used
1748
+ * @see https://www.eslint-react.xyz/docs/rules/no-unused-state
1749
+ */
1750
+ "react/no-unused-state": 0,
1751
+ /**
1752
+ * @desc 将 useContext 替换为 use
1753
+ * @descEN Replaces usage of useContext with use
1754
+ * @see https://www.eslint-react.xyz/docs/rules/no-use-context
1755
+ */
1756
+ "react/no-use-context": 2,
1757
+ /**
1758
+ * @desc 验证组件和 hooks 在 render 期间不调用已知的不纯函数
1759
+ * @descEN Validates that components and hooks are pure by checking that they do not call known-impure functions during render
1760
+ * @see https://www.eslint-react.xyz/docs/rules/purity
1761
+ */
1762
+ "react/purity": 2,
1763
+ /**
1764
+ * @desc 验证 ref 的正确使用,禁止在 render 期间读写 ref.current
1765
+ * @descEN Validates correct usage of refs by checking that ref.current is not read or written during render
1766
+ * @see https://www.eslint-react.xyz/docs/rules/refs
1767
+ */
1768
+ "react/refs": 2,
1769
+ /**
1770
+ * @desc 强制 Hooks 规则
1771
+ * @descEN Enforces the Rules of Hooks
1772
+ * @see https://www.eslint-react.xyz/docs/rules/rules-of-hooks
1773
+ */
1774
+ "react/rules-of-hooks": 2,
1775
+ /**
1776
+ * @desc 禁止在 effect 中同步设置状态
1777
+ * @descEN Validates against setting state synchronously in an effect
1778
+ * @see https://www.eslint-react.xyz/docs/rules/set-state-in-effect
1779
+ */
1780
+ "react/set-state-in-effect": 2,
1781
+ /**
1782
+ * @desc 禁止在 render 期间无条件设置状态
1783
+ * @descEN Validates against unconditionally setting state during render
1784
+ * @see https://www.eslint-react.xyz/docs/rules/set-state-in-render
1785
+ */
1786
+ "react/set-state-in-render": 2,
1787
+ /**
1788
+ * @desc 验证组件是静态的,不会在每次 render 时重建
1789
+ * @descEN Validates that components are static, not recreated every render
1790
+ * @see https://www.eslint-react.xyz/docs/rules/static-components
1791
+ */
1792
+ "react/static-components": 2,
1793
+ /**
1794
+ * @desc 验证 React Compiler 不支持的语法
1795
+ * @descEN Validates against syntax that React Compiler does not support
1796
+ * @see https://www.eslint-react.xyz/docs/rules/unsupported-syntax
1797
+ */
1798
+ "react/unsupported-syntax": 2,
1799
+ /**
1800
+ * @desc 验证 useMemo 的回调返回一个值
1801
+ * @descEN Validates that useMemo is called with a callback that returns a value
1802
+ * @see https://www.eslint-react.xyz/docs/rules/use-memo
1803
+ */
1804
+ "react/use-memo": 2,
1805
+ /**
1806
+ * @desc 强制正确使用 useState,包括解构和对称命名
1807
+ * @descEN Enforces correct usage of useState, including destructuring, symmetric naming of the value and setter
1808
+ * @see https://www.eslint-react.xyz/docs/rules/use-state
1809
+ */
1810
+ "react/use-state": 2,
1811
+ /**
1812
+ * @desc 禁止将 children 作为 prop 传递
1813
+ * @descEN Disallows passing children as a prop
1814
+ * @see https://www.eslint-react.xyz/docs/rules/jsx-no-children-prop
1815
+ */
1816
+ "react/jsx-no-children-prop": 0,
1817
+ /**
1818
+ * @desc 禁止同时将 children 作为 prop 与嵌套内容传递
1819
+ * @descEN Disallows passing children as a prop when children are also passed as nested content
1820
+ * @see https://www.eslint-react.xyz/docs/rules/jsx-no-children-prop-with-children
1821
+ */
1822
+ "react/jsx-no-children-prop-with-children": 2,
1823
+ /**
1824
+ * @desc 防止注释字符串被意外插入 JSX 文本节点
1825
+ * @descEN Prevents comment strings from being accidentally inserted into a JSX element's text nodes
1826
+ * @see https://www.eslint-react.xyz/docs/rules/jsx-no-comment-textnodes
1827
+ */
1828
+ "react/jsx-no-comment-textnodes": 1,
1829
+ /**
1830
+ * @desc 防止展开操作符后使用 key 导致自动 JSX 运行时去优化
1831
+ * @descEN Prevent patterns that cause deoptimization when using the automatic JSX runtime
1832
+ * @see https://www.eslint-react.xyz/docs/rules/jsx-no-key-after-spread
1833
+ */
1834
+ "react/jsx-no-key-after-spread": 2,
1835
+ /**
1836
+ * @desc 捕获 JSX 中从模板字符串复制遗留的 $ 符号
1837
+ * @descEN Catches $ before {expr} in JSX — typically from template literal ${expr} being copy-pasted into JSX
1838
+ * @see https://www.eslint-react.xyz/docs/rules/jsx-no-leaked-dollar
1839
+ */
1840
+ "react/jsx-no-leaked-dollar": 2,
1841
+ /**
1842
+ * @desc 捕获 JSX 文本节点开头的分号
1843
+ * @descEN Catches ; at the start of JSX text nodes — typically from accidentally placing a statement-ending ; inside JSX
1844
+ * @see https://www.eslint-react.xyz/docs/rules/jsx-no-leaked-semicolon
1845
+ */
1846
+ "react/jsx-no-leaked-semicolon": 2,
1847
+ /**
1848
+ * @desc 禁止 JSX 命名空间语法
1849
+ * @descEN Disallow JSX namespace syntax, as React does not support them
1850
+ * @see https://www.eslint-react.xyz/docs/rules/jsx-no-namespace
1851
+ */
1852
+ "react/jsx-no-namespace": 2,
1853
+ /**
1854
+ * @desc 禁止无用的 Fragment 元素
1855
+ * @descEN Disallows useless fragment elements
1856
+ * @see https://www.eslint-react.xyz/docs/rules/jsx-no-useless-fragment
1857
+ */
1858
+ "react/jsx-no-useless-fragment": 2,
1859
+ /**
1860
+ * @desc 验证和转换 React Client/Server 函数定义
1861
+ * @descEN Validates and transforms React Client/Server Function definitions
1862
+ * @see https://www.eslint-react.xyz/docs/rules/rsc-function-definition
1863
+ */
1864
+ "react/rsc-function-definition": 0,
1865
+ /**
1866
+ * @desc 禁止 DOM 元素使用 dangerouslySetInnerHTML
1867
+ * @descEN Disallows DOM elements from using dangerouslySetInnerHTML
1868
+ * @see https://www.eslint-react.xyz/docs/rules/dom-no-dangerously-set-innerhtml
1869
+ */
1870
+ "react/dom-no-dangerously-set-innerhtml": 1,
1871
+ /**
1872
+ * @desc 禁止同时使用 dangerouslySetInnerHTML 和 children
1873
+ * @descEN Disallows DOM elements from using dangerouslySetInnerHTML and children at the same time
1874
+ * @see https://www.eslint-react.xyz/docs/rules/dom-no-dangerously-set-innerhtml-with-children
1875
+ */
1876
+ "react/dom-no-dangerously-set-innerhtml-with-children": 2,
1877
+ /**
1878
+ * @desc 禁止使用 findDOMNode
1879
+ * @descEN Disallows findDOMNode
1880
+ * @see https://www.eslint-react.xyz/docs/rules/dom-no-find-dom-node
1881
+ */
1882
+ "react/dom-no-find-dom-node": 2,
1883
+ /**
1884
+ * @desc 禁止使用 flushSync
1885
+ * @descEN Disallows flushSync
1886
+ * @see https://www.eslint-react.xyz/docs/rules/dom-no-flush-sync
1887
+ */
1888
+ "react/dom-no-flush-sync": 2,
1889
+ /**
1890
+ * @desc 禁止使用 ReactDOM.hydrate,替换为 hydrateRoot
1891
+ * @descEN Replaces usage of ReactDOM.hydrate with hydrateRoot
1892
+ * @see https://www.eslint-react.xyz/docs/rules/dom-no-hydrate
1893
+ */
1894
+ "react/dom-no-hydrate": 2,
1895
+ /**
1896
+ * @desc 要求 button 元素使用显式 type 属性
1897
+ * @descEN Enforces an explicit type attribute for button elements
1898
+ * @see https://www.eslint-react.xyz/docs/rules/dom-no-missing-button-type
1899
+ */
1900
+ "react/dom-no-missing-button-type": 1,
1901
+ /**
1902
+ * @desc 要求 iframe 元素使用显式 sandbox 属性
1903
+ * @descEN Enforces an explicit sandbox attribute for iframe elements
1904
+ * @see https://www.eslint-react.xyz/docs/rules/dom-no-missing-iframe-sandbox
1905
+ */
1906
+ "react/dom-no-missing-iframe-sandbox": 1,
1907
+ /**
1908
+ * @desc 禁止使用 ReactDOM.render,替换为 createRoot
1909
+ * @descEN Replaces usage of ReactDOM.render with createRoot(node).render
1910
+ * @see https://www.eslint-react.xyz/docs/rules/dom-no-render
1911
+ */
1912
+ "react/dom-no-render": 2,
1913
+ /**
1914
+ * @desc 禁止使用 ReactDOM.render 的返回值
1915
+ * @descEN Disallows the return value of ReactDOM.render
1916
+ * @see https://www.eslint-react.xyz/docs/rules/dom-no-render-return-value
1917
+ */
1918
+ "react/dom-no-render-return-value": 2,
1919
+ /**
1920
+ * @desc 禁止使用 javascript: URL 作为属性值
1921
+ * @descEN Disallows javascript: URLs as attribute values
1922
+ * @see https://www.eslint-react.xyz/docs/rules/dom-no-script-url
1923
+ */
1924
+ "react/dom-no-script-url": 1,
1925
+ /**
1926
+ * @desc 禁止使用字符串 style prop,应使用对象
1927
+ * @descEN Disallows the use of string style prop in JSX. Use an object instead
1928
+ * @see https://www.eslint-react.xyz/docs/rules/dom-no-string-style-prop
1929
+ */
1930
+ "react/dom-no-string-style-prop": 2,
1931
+ /**
1932
+ * @desc 禁止未知的 DOM 属性
1933
+ * @descEN Disallows unknown DOM properties
1934
+ * @see https://www.eslint-react.xyz/docs/rules/dom-no-unknown-property
1935
+ */
1936
+ "react/dom-no-unknown-property": 2,
1937
+ /**
1938
+ * @desc 强制 iframe 的 sandbox 属性不能设置为不安全组合
1939
+ * @descEN Enforces that the sandbox attribute for iframe elements is not set to unsafe combinations
1940
+ * @see https://www.eslint-react.xyz/docs/rules/dom-no-unsafe-iframe-sandbox
1941
+ */
1942
+ "react/dom-no-unsafe-iframe-sandbox": 1,
1943
+ /**
1944
+ * @desc 禁止 target=_blank 缺少 rel=noreferrer noopener
1945
+ * @descEN Disallows target=_blank without rel=noreferrer noopener
1946
+ * @see https://www.eslint-react.xyz/docs/rules/dom-no-unsafe-target-blank
1947
+ */
1948
+ "react/dom-no-unsafe-target-blank": 1,
1949
+ /**
1950
+ * @desc 禁止使用 useFormState,替换为 useActionState
1951
+ * @descEN Replaces usage of useFormState with useActionState
1952
+ * @see https://www.eslint-react.xyz/docs/rules/dom-no-use-form-state
1953
+ */
1954
+ "react/dom-no-use-form-state": 2,
1955
+ /**
1956
+ * @desc 禁止在 void DOM 元素中使用 children
1957
+ * @descEN Disallows children in void DOM elements
1958
+ * @see https://www.eslint-react.xyz/docs/rules/dom-no-void-elements-with-children
1959
+ */
1960
+ "react/dom-no-void-elements-with-children": 2,
1961
+ /**
1962
+ * @desc 要求 addEventListener 有对应的 removeEventListener
1963
+ * @descEN Enforces that every addEventListener has a corresponding removeEventListener
1964
+ * @see https://www.eslint-react.xyz/docs/rules/web-api-no-leaked-event-listener
1965
+ */
1966
+ "react/web-api-no-leaked-event-listener": 2,
1967
+ /**
1968
+ * @desc 要求 fetch 有对应的 AbortController 中止
1969
+ * @descEN Enforces that every fetch has a corresponding AbortController abort in the cleanup function
1970
+ * @see https://www.eslint-react.xyz/docs/rules/web-api-no-leaked-fetch
1971
+ */
1972
+ "react/web-api-no-leaked-fetch": 2,
1973
+ /**
1974
+ * @desc 要求 setInterval 有对应的 clearInterval
1975
+ * @descEN Enforces that every setInterval has a corresponding clearInterval
1976
+ * @see https://www.eslint-react.xyz/docs/rules/web-api-no-leaked-interval
1977
+ */
1978
+ "react/web-api-no-leaked-interval": 2,
1979
+ /**
1980
+ * @desc 要求 ResizeObserver 有对应的 disconnect
1981
+ * @descEN Enforces that every ResizeObserver created has a corresponding disconnect
1982
+ * @see https://www.eslint-react.xyz/docs/rules/web-api-no-leaked-resize-observer
1983
+ */
1984
+ "react/web-api-no-leaked-resize-observer": 2,
1985
+ /**
1986
+ * @desc 要求 setTimeout 有对应的 clearTimeout
1987
+ * @descEN Enforces that every setTimeout has a corresponding clearTimeout
1988
+ * @see https://www.eslint-react.xyz/docs/rules/web-api-no-leaked-timeout
1989
+ */
1990
+ "react/web-api-no-leaked-timeout": 2,
1991
+ /**
1992
+ * @desc 要求 IntersectionObserver 有对应的 disconnect
1993
+ * @descEN Enforces that every IntersectionObserver created has a corresponding disconnect
1994
+ * @see https://www.eslint-react.xyz/docs/rules/web-api-no-leaked-intersection-observer
1995
+ */
1996
+ "react/web-api-no-leaked-intersection-observer": 2,
1997
+ /**
1998
+ * @desc 强制 context 名称为有效组件名并以 Context 结尾
1999
+ * @descEN Enforces the context name to be a valid component name with the suffix Context
2000
+ * @see https://www.eslint-react.xyz/docs/rules/naming-convention-context-name
2001
+ */
2002
+ "react/naming-convention-context-name": 2,
2003
+ /**
2004
+ * @desc 强制 useId 赋值的标识符命名为 id 或以 Id 结尾
2005
+ * @descEN Enforces identifier names assigned from useId calls to be either id or end with Id
2006
+ * @see https://www.eslint-react.xyz/docs/rules/naming-convention-id-name
2007
+ */
2008
+ "react/naming-convention-id-name": 2,
2009
+ /**
2010
+ * @desc 强制 useRef 赋值的标识符命名为 ref 或以 Ref 结尾
2011
+ * @descEN Enforces identifier names assigned from useRef calls to be either ref or end with Ref
2012
+ * @see https://www.eslint-react.xyz/docs/rules/naming-convention-ref-name
2013
+ */
2014
+ "react/naming-convention-ref-name": 2
2015
+ };
2016
+ //#endregion
2017
+ //#region src/core.reactHooks.ts
2018
+ /**
2019
+ * `reactHooks` 规则组配置
2020
+ *
2021
+ * 规则名 → 严重级别/配置的映射:`reactHooks` 组经预设工厂(`src/config.ts`)装配进 flat config,注册名 `react-hooks`。
2022
+ */
2023
+ const rules$3 = {
2024
+ /**
2025
+ * @desc 验证 Hooks 依赖数组包含所有必要的依赖
2026
+ * @descEN Validates that dependency arrays for React hooks contain all necessary dependencies
2027
+ * @see https://react.dev/reference/eslint-plugin-react-hooks/lints/exhaustive-deps
2028
+ */
2029
+ "react-hooks/exhaustive-deps": 0,
2030
+ /**
2031
+ * @desc 验证组件和 hooks 遵循 Hooks 规则
2032
+ * @descEN Validates that components and hooks follow the Rules of Hooks
2033
+ * @see https://react.dev/reference/eslint-plugin-react-hooks/lints/rules-of-hooks
2034
+ */
2035
+ "react-hooks/rules-of-hooks": 0,
2036
+ /**
2037
+ * @desc 验证定义嵌套组件或 hooks 的高阶函数
2038
+ * @descEN Validates higher order functions defining nested components or hooks
2039
+ * @see https://react.dev/reference/eslint-plugin-react-hooks/lints/component-hook-factories
2040
+ */
2041
+ "react-hooks/component-hook-factories": 0,
2042
+ /**
2043
+ * @desc 验证编译器配置选项
2044
+ * @descEN Validates the compiler configuration options
2045
+ * @see https://react.dev/reference/eslint-plugin-react-hooks/lints/config
2046
+ */
2047
+ "react-hooks/config": 2,
2048
+ /**
2049
+ * @desc 验证子组件错误是否使用 Error Boundaries
2050
+ * @descEN Validates usage of Error Boundaries instead of try/catch for child errors
2051
+ * @see https://react.dev/reference/eslint-plugin-react-hooks/lints/error-boundaries
2052
+ */
2053
+ "react-hooks/error-boundaries": 0,
2054
+ /**
2055
+ * @desc 验证 gating 模式的配置
2056
+ * @descEN Validates configuration of gating mode
2057
+ * @see https://react.dev/reference/eslint-plugin-react-hooks/lints/gating
2058
+ */
2059
+ "react-hooks/gating": 2,
2060
+ /**
2061
+ * @desc 禁止在 render 期间对全局变量赋值/修改
2062
+ * @descEN Validates against assignment/mutation of globals during render
2063
+ * @see https://react.dev/reference/eslint-plugin-react-hooks/lints/globals
2064
+ */
2065
+ "react-hooks/globals": 2,
2066
+ /**
2067
+ * @desc 禁止修改 props、state 等不可变值
2068
+ * @descEN Validates against mutating props, state, and other immutable values
2069
+ * @see https://react.dev/reference/eslint-plugin-react-hooks/lints/immutability
2070
+ */
2071
+ "react-hooks/immutability": 0,
2072
+ /**
2073
+ * @desc 禁止使用与记忆化不兼容的库
2074
+ * @descEN Validates against usage of libraries which are incompatible with memoization
2075
+ * @see https://react.dev/reference/eslint-plugin-react-hooks/lints/incompatible-library
2076
+ */
2077
+ "react-hooks/incompatible-library": 2,
2078
+ /**
2079
+ * @desc 验证现有手动的记忆化被编译器保留
2080
+ * @descEN Validates that existing manual memoization is preserved by the compiler
2081
+ * @see https://react.dev/reference/eslint-plugin-react-hooks/lints/preserve-manual-memoization
2082
+ */
2083
+ "react-hooks/preserve-manual-memoization": 2,
2084
+ /**
2085
+ * @desc 验证组件和 hooks 不调用已知的不纯函数
2086
+ * @descEN Validates that components/hooks are pure by checking known-impure functions
2087
+ * @see https://react.dev/reference/eslint-plugin-react-hooks/lints/purity
2088
+ */
2089
+ "react-hooks/purity": 0,
2090
+ /**
2091
+ * @desc 验证 ref 的正确使用,禁止在 render 期间读写 ref.current
2092
+ * @descEN Validates correct usage of refs, not reading/writing during render
2093
+ * @see https://react.dev/reference/eslint-plugin-react-hooks/lints/refs
2094
+ */
2095
+ "react-hooks/refs": 0,
2096
+ /**
2097
+ * @desc 禁止在 effect 中同步调用 setState
2098
+ * @descEN Validates against calling setState synchronously in an effect
2099
+ * @see https://react.dev/reference/eslint-plugin-react-hooks/lints/set-state-in-effect
2100
+ */
2101
+ "react-hooks/set-state-in-effect": 0,
2102
+ /**
2103
+ * @desc 禁止在 render 期间设置状态
2104
+ * @descEN Validates against setting state during render
2105
+ * @see https://react.dev/reference/eslint-plugin-react-hooks/lints/set-state-in-render
2106
+ */
2107
+ "react-hooks/set-state-in-render": 0,
2108
+ /**
2109
+ * @desc 验证组件是静态的,不会在每次 render 时重建
2110
+ * @descEN Validates that components are static, not recreated every render
2111
+ * @see https://react.dev/reference/eslint-plugin-react-hooks/lints/static-components
2112
+ */
2113
+ "react-hooks/static-components": 0,
2114
+ /**
2115
+ * @desc 验证 React Compiler 不支持的语法
2116
+ * @descEN Validates against syntax that React Compiler does not support
2117
+ * @see https://react.dev/reference/eslint-plugin-react-hooks/lints/unsupported-syntax
2118
+ */
2119
+ "react-hooks/unsupported-syntax": 0,
2120
+ /**
2121
+ * @desc 验证 useMemo 回调的使用是否没有返回值
2122
+ * @descEN Validates usage of the useMemo hook without a return value
2123
+ * @see https://react.dev/reference/eslint-plugin-react-hooks/lints/use-memo
2124
+ */
2125
+ "react-hooks/use-memo": 0
2126
+ };
2127
+ //#endregion
2128
+ //#region src/core.stylistic.ts
2129
+ /**
2130
+ * `stylistic` 规则组配置
2131
+ *
2132
+ * 规则名 → 严重级别/配置的映射:`stylistic` 组经预设工厂(`src/config.ts`)装配进 flat config,注册名 `stylistic`。
2133
+ */
2134
+ const rules$2 = {
2135
+ /**
2136
+ * @desc 统一强制数组/对象/函数参数等列表结构的括号间距与换行风格(取代原分散的 7 条规则)
2137
+ * @descEN Enforce consistent spacing and line break styles inside brackets (arrays, objects, function arguments)
2138
+ * @see https://eslint.style/rules/list-style
2139
+ */
2140
+ "stylistic/list-style": [2, {
2141
+ empty: "never",
2142
+ singleLine: {
2143
+ spacing: "never",
2144
+ maxItems: Number.POSITIVE_INFINITY
2145
+ },
2146
+ multiLine: { minItems: 0 },
2147
+ overrides: { "{}": { singleLine: { spacing: "always" } } }
2148
+ }],
2149
+ /**
2150
+ * @desc 要求箭头函数参数使用圆括号
2151
+ * @descEN Require parentheses around arrow function arguments
2152
+ * @see https://eslint.style/rules/arrow-parens
2153
+ */
2154
+ "stylistic/arrow-parens": 2,
2155
+ /**
2156
+ * @desc 强制箭头函数箭头前后间距一致
2157
+ * @descEN Enforce consistent spacing before and after the arrow in arrow functions
2158
+ * @see https://eslint.style/rules/arrow-spacing
2159
+ */
2160
+ "stylistic/arrow-spacing": 2,
2161
+ /**
2162
+ * @desc 强制代码块内单行或多行空格风格
2163
+ * @descEN Disallow or enforce spaces inside of blocks after opening block and before closing block
2164
+ * @see https://eslint.style/rules/block-spacing
2165
+ */
2166
+ "stylistic/block-spacing": 2,
2167
+ /**
2168
+ * @desc 强制大括号风格一致
2169
+ * @descEN Enforce consistent brace style for blocks
2170
+ * @see https://eslint.style/rules/brace-style
2171
+ */
2172
+ "stylistic/brace-style": 2,
2173
+ /**
2174
+ * @desc 要求或禁止尾逗号
2175
+ * @descEN Require or disallow trailing commas
2176
+ * @see https://eslint.style/rules/comma-dangle
2177
+ */
2178
+ "stylistic/comma-dangle": [2, "always-multiline"],
2179
+ /**
2180
+ * @desc 强制逗号前后间距一致
2181
+ * @descEN Enforce consistent spacing before and after commas
2182
+ * @see https://eslint.style/rules/comma-spacing
2183
+ */
2184
+ "stylistic/comma-spacing": 2,
2185
+ /**
2186
+ * @desc 强制逗号风格(行首/行尾)
2187
+ * @descEN Enforce consistent comma style
2188
+ * @see https://eslint.style/rules/comma-style
2189
+ */
2190
+ "stylistic/comma-style": 0,
2191
+ /**
2192
+ * @desc 强制计算属性括号内间距一致
2193
+ * @descEN Enforce consistent spacing inside computed property brackets
2194
+ * @see https://eslint.style/rules/computed-property-spacing
2195
+ */
2196
+ "stylistic/computed-property-spacing": 2,
2197
+ /**
2198
+ * @desc 强制花括号前后换行风格
2199
+ * @descEN Enforce consistent line breaks after opening and before closing braces
2200
+ * @see https://eslint.style/rules/curly-newline
2201
+ */
2202
+ "stylistic/curly-newline": 2,
2203
+ /**
2204
+ * @desc 强制点操作符前后换行风格
2205
+ * @descEN Enforce consistent newlines before and after dots
2206
+ * @see https://eslint.style/rules/dot-location
2207
+ */
2208
+ "stylistic/dot-location": 0,
2209
+ /**
2210
+ * @desc 要求或禁止文件末尾空行
2211
+ * @descEN Require or disallow newline at the end of files
2212
+ * @see https://eslint.style/rules/eol-last
2213
+ */
2214
+ "stylistic/eol-last": 0,
2215
+ /**
2216
+ * @desc 强制 JSX 属性的换行风格一致(实验性规则)
2217
+ * @descEN Enforce consistent line break styles for JSX props
2218
+ * @see https://eslint.style/rules/jsx-props-style
2219
+ */
2220
+ "stylistic/exp-jsx-props-style": 0,
2221
+ /**
2222
+ * @desc 要求或禁止函数标识符及其调用间的空格
2223
+ * @descEN Require or disallow spacing between function identifiers and their invocations
2224
+ * @see https://eslint.style/rules/function-call-spacing
2225
+ */
2226
+ "stylistic/function-call-spacing": 2,
2227
+ /**
2228
+ * @desc 强制 generator 函数中 * 周边间距一致
2229
+ * @descEN Enforce consistent spacing around `*` operators in generator functions
2230
+ * @see https://eslint.style/rules/generator-star-spacing
2231
+ */
2232
+ "stylistic/generator-star-spacing": 2,
2233
+ /**
2234
+ * @desc 强制箭头函数体的换行位置
2235
+ * @descEN Enforce the location of arrow function bodies
2236
+ * @see https://eslint.style/rules/implicit-arrow-linebreak
2237
+ */
2238
+ "stylistic/implicit-arrow-linebreak": 2,
2239
+ /**
2240
+ * @desc 强制一致的缩进
2241
+ * @descEN Enforce consistent indentation
2242
+ * @see https://eslint.style/rules/indent
2243
+ */
2244
+ "stylistic/indent": [2, preset_default.indent],
2245
+ /**
2246
+ * @desc 二元运算符的缩进
2247
+ * @descEN Indentation for binary operators
2248
+ * @see https://eslint.style/rules/indent-binary-ops
2249
+ */
2250
+ "stylistic/indent-binary-ops": [2, preset_default.indent],
2251
+ /**
2252
+ * @desc 强制或禁止 JSX 属性/表达式花括号内空格
2253
+ * @descEN Enforce or disallow spaces inside of curly braces in JSX attributes and expressions
2254
+ * @see https://eslint.style/rules/jsx-child-element-spacing
2255
+ */
2256
+ "stylistic/jsx-child-element-spacing": 0,
2257
+ /**
2258
+ * @desc 强制 JSX 闭合括号位置
2259
+ * @descEN Enforce closing bracket location in JSX
2260
+ * @see https://eslint.style/rules/jsx-closing-bracket-location
2261
+ */
2262
+ "stylistic/jsx-closing-bracket-location": 2,
2263
+ /**
2264
+ * @desc 强制多行 JSX 闭合标签位置
2265
+ * @descEN Enforce closing tag location for multiline JSX
2266
+ * @see https://eslint.style/rules/jsx-closing-tag-location
2267
+ */
2268
+ "stylistic/jsx-closing-tag-location": 2,
2269
+ /**
2270
+ * @desc 禁止不必要的 JSX 花括号表达式
2271
+ * @descEN Disallow unnecessary JSX expressions when literals alone are sufficient or enforce JSX expressions on literals in JSX children or attributes
2272
+ * @see https://eslint.style/rules/jsx-curly-brace-presence
2273
+ */
2274
+ "stylistic/jsx-curly-brace-presence": 0,
2275
+ /**
2276
+ * @desc 强制 JSX 花括号内换行风格一致
2277
+ * @descEN Enforce consistent linebreaks in curly braces in JSX attributes and expressions
2278
+ * @see https://eslint.style/rules/jsx-curly-newline
2279
+ */
2280
+ "stylistic/jsx-curly-newline": 2,
2281
+ /**
2282
+ * @desc 强制或禁止 JSX 花括号内空格
2283
+ * @descEN Enforce or disallow spaces inside of curly braces in JSX attributes and expressions
2284
+ * @see https://eslint.style/rules/jsx-curly-spacing
2285
+ */
2286
+ "stylistic/jsx-curly-spacing": 2,
2287
+ /**
2288
+ * @desc 强制或禁止 JSX 等号周围空格
2289
+ * @descEN Enforce or disallow spaces around equal signs in JSX attributes
2290
+ * @see https://eslint.style/rules/jsx-equals-spacing
2291
+ */
2292
+ "stylistic/jsx-equals-spacing": 2,
2293
+ /**
2294
+ * @desc 强制 JSX 第一个属性的位置
2295
+ * @descEN Enforce proper position of the first property in JSX
2296
+ * @see https://eslint.style/rules/jsx-first-prop-new-line
2297
+ */
2298
+ "stylistic/jsx-first-prop-new-line": [2, "multiprop"],
2299
+ /**
2300
+ * @desc 强制 JSX 作为函数参数时前后换行
2301
+ * @descEN Enforce line breaks before and after JSX elements when they are used as arguments to a function
2302
+ * @see https://eslint.style/rules/jsx-function-call-newline
2303
+ */
2304
+ "stylistic/jsx-function-call-newline": 2,
2305
+ /**
2306
+ * @desc 强制 JSX props 缩进
2307
+ * @descEN Enforce props indentation in JSX
2308
+ * @see https://eslint.style/rules/jsx-indent-props
2309
+ */
2310
+ "stylistic/jsx-indent-props": [2, preset_default.indent],
2311
+ /**
2312
+ * @desc 强制单行 JSX props 最大数量
2313
+ * @descEN Enforce maximum of props on a single line in JSX
2314
+ * @see https://eslint.style/rules/jsx-max-props-per-line
2315
+ */
2316
+ "stylistic/jsx-max-props-per-line": 2,
2317
+ /**
2318
+ * @desc 要求或禁止 JSX 元素后换行
2319
+ * @descEN Require or prevent a new line after jsx elements and expressions
2320
+ * @see https://eslint.style/rules/jsx-newline
2321
+ */
2322
+ "stylistic/jsx-newline": 0,
2323
+ /**
2324
+ * @desc 要求每行一个 JSX 表达式
2325
+ * @descEN Require one JSX element per line
2326
+ * @see https://eslint.style/rules/jsx-one-expression-per-line
2327
+ */
2328
+ "stylistic/jsx-one-expression-per-line": [2, { allow: "single-child" }],
2329
+ /**
2330
+ * @desc 强制用户自定义 JSX 组件使用 PascalCase
2331
+ * @descEN Enforce PascalCase for user-defined JSX components
2332
+ * @see https://eslint.style/rules/jsx-pascal-case
2333
+ */
2334
+ "stylistic/jsx-pascal-case": [2, {
2335
+ allowNamespace: true,
2336
+ allowAllCaps: true
2337
+ }],
2338
+ /**
2339
+ * @desc 强制 JSX 属性中一致使用双引号或单引号
2340
+ * @descEN Enforce the consistent use of either double or single quotes in JSX attributes
2341
+ * @see https://eslint.style/rules/jsx-quotes
2342
+ */
2343
+ "stylistic/jsx-quotes": 2,
2344
+ /**
2345
+ * @desc 禁止无子组件的额外闭合标签
2346
+ * @descEN Disallow extra closing tags for components without children
2347
+ * @see https://eslint.style/rules/jsx-self-closing-comp
2348
+ */
2349
+ "stylistic/jsx-self-closing-comp": 2,
2350
+ /**
2351
+ * @desc 强制 JSX 布尔属性简写
2352
+ * @descEN Enforce shorthand for boolean JSX attributes
2353
+ * @see https://eslint.style/rules/jsx-shorthand-boolean
2354
+ */
2355
+ "stylistic/jsx-shorthand-boolean": 0,
2356
+ /**
2357
+ * @desc 强制 JSX 片段简写语法
2358
+ * @descEN Enforce shorthand fragment syntax
2359
+ * @see https://eslint.style/rules/jsx-shorthand-fragment
2360
+ */
2361
+ "stylistic/jsx-shorthand-fragment": 2,
2362
+ /**
2363
+ * @desc 强制 JSX 标签内和标签周围空格
2364
+ * @descEN Enforce whitespace in and around the JSX opening and closing brackets
2365
+ * @see https://eslint.style/rules/jsx-tag-spacing
2366
+ */
2367
+ "stylistic/jsx-tag-spacing": [2, { beforeClosing: "never" }],
2368
+ /**
2369
+ * @desc 禁止多行 JSX 缺少括号
2370
+ * @descEN Disallow missing parentheses around multiline JSX
2371
+ * @see https://eslint.style/rules/jsx-wrap-multilines
2372
+ */
2373
+ "stylistic/jsx-wrap-multilines": [2, {
2374
+ declaration: "parens-new-line",
2375
+ assignment: "parens-new-line",
2376
+ return: "parens-new-line",
2377
+ arrow: "parens-new-line",
2378
+ condition: "parens-new-line",
2379
+ logical: "parens-new-line",
2380
+ prop: "ignore",
2381
+ propertyValue: "parens-new-line"
2382
+ }],
2383
+ /**
2384
+ * @desc 强制对象字面量属性键值间间距
2385
+ * @descEN Enforce consistent spacing between keys and values in object literal properties
2386
+ * @see https://eslint.style/rules/key-spacing
2387
+ */
2388
+ "stylistic/key-spacing": 2,
2389
+ /**
2390
+ * @desc 强制关键字前后间距一致
2391
+ * @descEN Enforce consistent spacing before and after keywords
2392
+ * @see https://eslint.style/rules/keyword-spacing
2393
+ */
2394
+ "stylistic/keyword-spacing": 2,
2395
+ /**
2396
+ * @desc 强制行注释位置
2397
+ * @descEN Enforce position of line comments
2398
+ * @see https://eslint.style/rules/line-comment-position
2399
+ */
2400
+ "stylistic/line-comment-position": 0,
2401
+ /**
2402
+ * @desc 强制一致的换行符风格
2403
+ * @descEN Enforce consistent linebreak style
2404
+ * @see https://eslint.style/rules/linebreak-style
2405
+ */
2406
+ "stylistic/linebreak-style": 0,
2407
+ /**
2408
+ * @desc 要求注释周围有空行
2409
+ * @descEN Require empty lines around comments
2410
+ * @see https://eslint.style/rules/lines-around-comment
2411
+ */
2412
+ "stylistic/lines-around-comment": 0,
2413
+ /**
2414
+ * @desc 要求或禁止类成员间空行
2415
+ * @descEN Require or disallow an empty line between class members
2416
+ * @see https://eslint.style/rules/lines-between-class-members
2417
+ */
2418
+ "stylistic/lines-between-class-members": 0,
2419
+ /**
2420
+ * @desc 强制最大行长度
2421
+ * @descEN Enforce a maximum line length
2422
+ * @see https://eslint.style/rules/max-len
2423
+ */
2424
+ "stylistic/max-len": 0,
2425
+ /**
2426
+ * @desc 强制每行最大语句数
2427
+ * @descEN Enforce a maximum number of statements allowed per line
2428
+ * @see https://eslint.style/rules/max-statements-per-line
2429
+ */
2430
+ "stylistic/max-statements-per-line": 0,
2431
+ /**
2432
+ * @desc 要求接口和类型字面量使用特定的成员分隔符风格
2433
+ * @descEN Require a specific member delimiter style for interfaces and type literals
2434
+ * @see https://eslint.style/rules/member-delimiter-style
2435
+ */
2436
+ "stylistic/member-delimiter-style": 2,
2437
+ /**
2438
+ * @desc 强制多行注释风格
2439
+ * @descEN Enforce a particular style for multiline comments
2440
+ * @see https://eslint.style/rules/multiline-comment-style
2441
+ */
2442
+ "stylistic/multiline-comment-style": 0,
2443
+ /**
2444
+ * @desc 强制三元表达式操作数间换行
2445
+ * @descEN Enforce newlines between operands of ternary expressions
2446
+ * @see https://eslint.style/rules/multiline-ternary
2447
+ */
2448
+ "stylistic/multiline-ternary": [2, "always-multiline"],
2449
+ /**
2450
+ * @desc 要求或禁止无参构造函数调用时使用括号
2451
+ * @descEN Enforce or disallow parentheses when invoking a constructor with no arguments
2452
+ * @see https://eslint.style/rules/new-parens
2453
+ */
2454
+ "stylistic/new-parens": 2,
2455
+ /**
2456
+ * @desc 要求链式调用每行一个
2457
+ * @descEN Require a newline after each call in a method chain
2458
+ * @see https://eslint.style/rules/newline-per-chained-call
2459
+ */
2460
+ "stylistic/newline-per-chained-call": 0,
2461
+ /**
2462
+ * @desc 禁止可能与比较混淆的箭头函数
2463
+ * @descEN Disallow arrow functions where they could be confused with comparisons
2464
+ * @see https://eslint.style/rules/no-confusing-arrow
2465
+ */
2466
+ "stylistic/no-confusing-arrow": 0,
2467
+ /**
2468
+ * @desc 禁止不必要的括号
2469
+ * @descEN Disallow unnecessary parentheses
2470
+ * @see https://eslint.style/rules/no-extra-parens
2471
+ */
2472
+ "stylistic/no-extra-parens": 0,
2473
+ /**
2474
+ * @desc 禁止不必要的分号
2475
+ * @descEN Disallow unnecessary semicolons
2476
+ * @see https://eslint.style/rules/no-extra-semi
2477
+ */
2478
+ "stylistic/no-extra-semi": 2,
2479
+ /**
2480
+ * @desc 禁止数字字面量中前导或尾随小数点
2481
+ * @descEN Disallow leading or trailing decimal points in numeric literals
2482
+ * @see https://eslint.style/rules/no-floating-decimal
2483
+ */
2484
+ "stylistic/no-floating-decimal": 2,
2485
+ /**
2486
+ * @desc 禁止混用的二元运算符
2487
+ * @descEN Disallow mixed binary operators
2488
+ * @see https://eslint.style/rules/no-mixed-operators
2489
+ */
2490
+ "stylistic/no-mixed-operators": 0,
2491
+ /**
2492
+ * @desc 禁止混用空格和制表符
2493
+ * @descEN Disallow mixed spaces and tabs for indentation
2494
+ * @see https://eslint.style/rules/no-mixed-spaces-and-tabs
2495
+ */
2496
+ "stylistic/no-mixed-spaces-and-tabs": 2,
2497
+ /**
2498
+ * @desc 禁止多个空格
2499
+ * @descEN Disallow multiple spaces
2500
+ * @see https://eslint.style/rules/no-multi-spaces
2501
+ */
2502
+ "stylistic/no-multi-spaces": [2, { exceptions: {
2503
+ Property: false,
2504
+ ImportAttribute: false
2505
+ } }],
2506
+ /**
2507
+ * @desc 禁止多个空行
2508
+ * @descEN Disallow multiple empty lines
2509
+ * @see https://eslint.style/rules/no-multiple-empty-lines
2510
+ */
2511
+ "stylistic/no-multiple-empty-lines": [2, {
2512
+ max: 2,
2513
+ maxEOF: 1,
2514
+ maxBOF: 0
2515
+ }],
2516
+ /**
2517
+ * @desc 禁止使用制表符
2518
+ * @descEN Disallow all tabs
2519
+ * @see https://eslint.style/rules/no-tabs
2520
+ */
2521
+ "stylistic/no-tabs": 0,
2522
+ /**
2523
+ * @desc 禁止行尾尾随空格
2524
+ * @descEN Disallow trailing whitespace at the end of lines
2525
+ * @see https://eslint.style/rules/no-trailing-spaces
2526
+ */
2527
+ "stylistic/no-trailing-spaces": 2,
2528
+ /**
2529
+ * @desc 禁止属性前有空格
2530
+ * @descEN Disallow whitespace before properties
2531
+ * @see https://eslint.style/rules/no-whitespace-before-property
2532
+ */
2533
+ "stylistic/no-whitespace-before-property": 2,
2534
+ /**
2535
+ * @desc 强制单行语句体的位置
2536
+ * @descEN Enforce the location of single-line statements
2537
+ * @see https://eslint.style/rules/nonblock-statement-body-position
2538
+ */
2539
+ "stylistic/nonblock-statement-body-position": 0,
2540
+ /**
2541
+ * @desc 强制对象属性分行放置
2542
+ * @descEN Enforce placing object properties on separate lines
2543
+ * @see https://eslint.style/rules/object-property-newline
2544
+ */
2545
+ "stylistic/object-property-newline": 0,
2546
+ /**
2547
+ * @desc 要求或禁止变量声明间换行
2548
+ * @descEN Require or disallow newlines around variable declarations
2549
+ * @see https://eslint.style/rules/one-var-declaration-per-line
2550
+ */
2551
+ "stylistic/one-var-declaration-per-line": 0,
2552
+ /**
2553
+ * @desc 强制运算符换行风格
2554
+ * @descEN Enforce consistent linebreak style for operators
2555
+ * @see https://eslint.style/rules/operator-linebreak
2556
+ */
2557
+ "stylistic/operator-linebreak": [2, "before"],
2558
+ /**
2559
+ * @desc 要求或禁止代码块内填充空行
2560
+ * @descEN Require or disallow padding within blocks
2561
+ * @see https://eslint.style/rules/padded-blocks
2562
+ */
2563
+ "stylistic/padded-blocks": 0,
2564
+ /**
2565
+ * @desc 要求或禁止语句间填充空行
2566
+ * @descEN Require or disallow padding lines between statements
2567
+ * @see https://eslint.style/rules/padding-line-between-statements
2568
+ */
2569
+ "stylistic/padding-line-between-statements": [
2570
+ 2,
2571
+ {
2572
+ blankLine: "always",
2573
+ prev: "*",
2574
+ next: "return"
2575
+ },
2576
+ {
2577
+ blankLine: "always",
2578
+ prev: "*",
2579
+ next: "default"
2580
+ },
2581
+ {
2582
+ blankLine: "always",
2583
+ prev: "directive",
2584
+ next: "*"
2585
+ },
2586
+ {
2587
+ blankLine: "any",
2588
+ prev: "directive",
2589
+ next: "directive"
2590
+ }
2591
+ ],
2592
+ /**
2593
+ * @desc 要求对象字面量属性名使用引号
2594
+ * @descEN Require quotes around object literal, type literal, interfaces and enums property names
2595
+ * @see https://eslint.style/rules/quote-props
2596
+ */
2597
+ "stylistic/quote-props": [2, "consistent-as-needed"],
2598
+ /**
2599
+ * @desc 强制一致使用反引号/双引号/单引号
2600
+ * @descEN Enforce the consistent use of either backticks, double, or single quotes
2601
+ * @see https://eslint.style/rules/quotes
2602
+ */
2603
+ "stylistic/quotes": 2,
2604
+ /**
2605
+ * @desc 强制剩余/展开运算符与其表达式间距
2606
+ * @descEN Enforce spacing between rest and spread operators and their expressions
2607
+ * @see https://eslint.style/rules/rest-spread-spacing
2608
+ */
2609
+ "stylistic/rest-spread-spacing": 2,
2610
+ /**
2611
+ * @desc 要求或禁止分号
2612
+ * @descEN Require or disallow semicolons instead of ASI
2613
+ * @see https://eslint.style/rules/semi
2614
+ */
2615
+ "stylistic/semi": 2,
2616
+ /**
2617
+ * @desc 强制分号前后间距一致
2618
+ * @descEN Enforce consistent spacing before and after semicolons
2619
+ * @see https://eslint.style/rules/semi-spacing
2620
+ */
2621
+ "stylistic/semi-spacing": 2,
2622
+ /**
2623
+ * @desc 强制分号位置
2624
+ * @descEN Enforce location of semicolons
2625
+ * @see https://eslint.style/rules/semi-style
2626
+ */
2627
+ "stylistic/semi-style": 2,
2628
+ /**
2629
+ * @desc 强制代码块前空格一致
2630
+ * @descEN Enforce consistent spacing before blocks
2631
+ * @see https://eslint.style/rules/space-before-blocks
2632
+ */
2633
+ "stylistic/space-before-blocks": 2,
2634
+ /**
2635
+ * @desc 强制函数括号前空格一致
2636
+ * @descEN Enforce consistent spacing before function parenthesis
2637
+ * @see https://eslint.style/rules/space-before-function-paren
2638
+ */
2639
+ "stylistic/space-before-function-paren": [2, {
2640
+ anonymous: "always",
2641
+ named: "always",
2642
+ asyncArrow: "always",
2643
+ catch: "always"
2644
+ }],
2645
+ /**
2646
+ * @desc 强制括号内间距一致
2647
+ * @descEN Enforce consistent spacing inside parentheses
2648
+ * @see https://eslint.style/rules/space-in-parens
2649
+ */
2650
+ "stylistic/space-in-parens": 2,
2651
+ /**
2652
+ * @desc 要求中缀运算符周围空格
2653
+ * @descEN Require spacing around infix operators
2654
+ * @see https://eslint.style/rules/space-infix-ops
2655
+ */
2656
+ "stylistic/space-infix-ops": 2,
2657
+ /**
2658
+ * @desc 强制一元运算符前后空格一致
2659
+ * @descEN Enforce consistent spacing before or after unary operators
2660
+ * @see https://eslint.style/rules/space-unary-ops
2661
+ */
2662
+ "stylistic/space-unary-ops": 2,
2663
+ /**
2664
+ * @desc 强制注释中 // 或 /* 后空格一致
2665
+ * @descEN Enforce consistent spacing after the `//` or `/*` in a comment
2666
+ * @see https://eslint.style/rules/spaced-comment
2667
+ */
2668
+ "stylistic/spaced-comment": 2,
2669
+ /**
2670
+ * @desc 强制 switch 语句冒号周围空格
2671
+ * @descEN Enforce spacing around colons of switch statements
2672
+ * @see https://eslint.style/rules/switch-colon-spacing
2673
+ */
2674
+ "stylistic/switch-colon-spacing": 2,
2675
+ /**
2676
+ * @desc 要求或禁止模板字符串中表达式周围空格
2677
+ * @descEN Require or disallow spacing around embedded expressions of template strings
2678
+ * @see https://eslint.style/rules/template-curly-spacing
2679
+ */
2680
+ "stylistic/template-curly-spacing": 2,
2681
+ /**
2682
+ * @desc 要求或禁止模板标签与其字面量间空格
2683
+ * @descEN Require or disallow spacing between template tags and their literals
2684
+ * @see https://eslint.style/rules/template-tag-spacing
2685
+ */
2686
+ "stylistic/template-tag-spacing": 2,
2687
+ /**
2688
+ * @desc 要求类型注解周围间距一致
2689
+ * @descEN Require consistent spacing around type annotations
2690
+ * @see https://eslint.style/rules/type-annotation-spacing
2691
+ */
2692
+ "stylistic/type-annotation-spacing": 2,
2693
+ /**
2694
+ * @desc 强制 TypeScript 泛型内间距一致
2695
+ * @descEN Enforces consistent spacing inside TypeScript type generics
2696
+ * @see https://eslint.style/rules/type-generic-spacing
2697
+ */
2698
+ "stylistic/type-generic-spacing": 2,
2699
+ /**
2700
+ * @desc 要求具名元组中类型声明前有空格
2701
+ * @descEN Expect space before the type declaration in the named tuple
2702
+ * @see https://eslint.style/rules/type-named-tuple-spacing
2703
+ */
2704
+ "stylistic/type-named-tuple-spacing": 2,
2705
+ /**
2706
+ * @desc 要求立即调用的函数表达式周围有括号
2707
+ * @descEN Require parentheses around immediate `function` invocations
2708
+ * @see https://eslint.style/rules/wrap-iife
2709
+ */
2710
+ "stylistic/wrap-iife": 2,
2711
+ /**
2712
+ * @desc 要求正则字面量周围有括号
2713
+ * @descEN Require parenthesis around regex literals
2714
+ * @see https://eslint.style/rules/wrap-regex
2715
+ */
2716
+ "stylistic/wrap-regex": 0,
2717
+ /**
2718
+ * @desc 要求或禁止 yield* 中 * 周围空格
2719
+ * @descEN Require or disallow spacing around the `*` in `yield*` expressions
2720
+ * @see https://eslint.style/rules/yield-star-spacing
2721
+ */
2722
+ "stylistic/yield-star-spacing": 0
2723
+ };
2724
+ //#endregion
2725
+ //#region src/core.typescript.ts
2726
+ /**
2727
+ * `typescript` 规则组配置
2728
+ *
2729
+ * 规则名 → 严重级别/配置的映射:`typescript` 组经预设工厂(`src/config.ts`)装配进 flat config,注册名 `ts`。
2730
+ */
2731
+ const rules$1 = {
2732
+ /**
2733
+ * @desc 强制类方法使用 this
2734
+ * @descEN Enforce that class methods utilize this
2735
+ * @see https://typescript-eslint.io/rules/class-methods-use-this
2736
+ */
2737
+ "class-methods-use-this": 0,
2738
+ /**
2739
+ * @desc 要求函数返回语句要么都指定值要么都不指定
2740
+ * @descEN Require `return` statements to either always or never specify values
2741
+ * @see https://typescript-eslint.io/rules/consistent-return
2742
+ */
2743
+ "consistent-return": 0,
2744
+ /**
2745
+ * @desc 强制默认参数在最后
2746
+ * @descEN Enforce default parameters to be last
2747
+ * @see https://typescript-eslint.io/rules/default-param-last
2748
+ */
2749
+ "default-param-last": 0,
2750
+ /**
2751
+ * @desc 强制尽可能使用点号表示法
2752
+ * @descEN Enforce dot notation whenever possible
2753
+ * @see https://typescript-eslint.io/rules/dot-notation
2754
+ */
2755
+ "dot-notation": 0,
2756
+ /**
2757
+ * @desc 要求或禁止变量声明中初始化
2758
+ * @descEN Require or disallow initialization in variable declarations
2759
+ * @see https://typescript-eslint.io/rules/init-declarations
2760
+ */
2761
+ "init-declarations": 0,
2762
+ /**
2763
+ * @desc 强制函数定义中最大参数数量
2764
+ * @descEN Enforce a maximum number of parameters in function definitions
2765
+ * @see https://typescript-eslint.io/rules/max-params
2766
+ */
2767
+ "max-params": 0,
2768
+ /**
2769
+ * @desc 禁止泛型 Array 构造函数
2770
+ * @descEN Disallow generic Array constructors
2771
+ * @see https://typescript-eslint.io/rules/no-array-constructor
2772
+ */
2773
+ "no-array-constructor": 0,
2774
+ /**
2775
+ * @desc 禁止重复的类成员
2776
+ * @descEN Disallow duplicate class members
2777
+ * @see https://typescript-eslint.io/rules/no-dupe-class-members
2778
+ */
2779
+ "no-dupe-class-members": 0,
2780
+ /**
2781
+ * @desc 禁止空函数
2782
+ * @descEN Disallow empty functions
2783
+ * @see https://typescript-eslint.io/rules/no-empty-function
2784
+ */
2785
+ "no-empty-function": 0,
2786
+ /**
2787
+ * @desc 禁止在类或类式对象之外使用 this
2788
+ * @descEN Disallow `this` keywords outside of classes or class-like objects
2789
+ * @see https://typescript-eslint.io/rules/no-invalid-this
2790
+ */
2791
+ "no-invalid-this": 0,
2792
+ /**
2793
+ * @desc 禁止使用类似 eval 的函数
2794
+ * @descEN Disallow the use of eval()-like functions
2795
+ * @see https://typescript-eslint.io/rules/no-implied-eval
2796
+ */
2797
+ "no-implied-eval": 0,
2798
+ /**
2799
+ * @desc 禁止在循环语句中包含不安全引用的函数声明
2800
+ * @descEN Disallow function declarations that contain unsafe references inside loop statements
2801
+ * @see https://typescript-eslint.io/rules/no-loop-func
2802
+ */
2803
+ "no-loop-func": 0,
2804
+ /**
2805
+ * @desc 禁止魔术数字
2806
+ * @descEN Disallow magic numbers
2807
+ * @see https://typescript-eslint.io/rules/no-magic-numbers
2808
+ */
2809
+ "no-magic-numbers": 0,
2810
+ /**
2811
+ * @desc 禁止变量重复声明
2812
+ * @descEN Disallow variable redeclaration
2813
+ * @see https://typescript-eslint.io/rules/no-redeclare
2814
+ */
2815
+ "no-redeclare": 0,
2816
+ /**
2817
+ * @desc 禁止导入特定模块
2818
+ * @descEN Disallow specified modules when loaded by import
2819
+ * @see https://typescript-eslint.io/rules/no-restricted-imports
2820
+ */
2821
+ "no-restricted-imports": 0,
2822
+ /**
2823
+ * @desc 禁止变量声明遮蔽外层作用域变量
2824
+ * @descEN Disallow variable declarations from shadowing variables declared in the outer scope
2825
+ * @see https://typescript-eslint.io/rules/no-shadow
2826
+ */
2827
+ "no-shadow": 0,
2828
+ /**
2829
+ * @desc 禁止未使用的表达式
2830
+ * @descEN Disallow unused expressions
2831
+ * @see https://typescript-eslint.io/rules/no-unused-expressions
2832
+ */
2833
+ "no-unused-expressions": 0,
2834
+ /**
2835
+ * @desc 禁止未使用的私有类成员
2836
+ * @descEN Disallow unused private class members
2837
+ * @see https://typescript-eslint.io/rules/no-unused-private-class-members
2838
+ */
2839
+ "no-unused-private-class-members": 0,
2840
+ /**
2841
+ * @desc 禁止未使用的变量
2842
+ * @descEN Disallow unused variables
2843
+ * @see https://typescript-eslint.io/rules/no-unused-vars
2844
+ */
2845
+ "no-unused-vars": 0,
2846
+ /**
2847
+ * @desc 禁止在定义之前使用变量
2848
+ * @descEN Disallow the use of variables before they are defined
2849
+ * @see https://typescript-eslint.io/rules/no-use-before-define
2850
+ */
2851
+ "no-use-before-define": 0,
2852
+ /**
2853
+ * @desc 禁止不必要的构造函数
2854
+ * @descEN Disallow unnecessary constructors
2855
+ * @see https://typescript-eslint.io/rules/no-useless-constructor
2856
+ */
2857
+ "no-useless-constructor": 0,
2858
+ /**
2859
+ * @desc 要求从数组和/或对象进行解构
2860
+ * @descEN Require destructuring from arrays and/or objects
2861
+ * @see https://typescript-eslint.io/rules/prefer-destructuring
2862
+ */
2863
+ "prefer-destructuring": 0,
2864
+ /**
2865
+ * @desc 要求使用 Error 对象作为 Promise 拒绝原因
2866
+ * @descEN Require using Error objects as Promise rejection reasons
2867
+ * @see https://typescript-eslint.io/rules/prefer-promise-reject-errors
2868
+ */
2869
+ "prefer-promise-reject-errors": 0,
2870
+ /**
2871
+ * @desc 禁止没有 await 表达式且不返回 Promise 的异步函数
2872
+ * @descEN Disallow async functions which do not have await expression
2873
+ * @see https://typescript-eslint.io/rules/require-await
2874
+ */
2875
+ "require-await": 0,
2876
+ /**
2877
+ * @desc 要求函数重载签名连续
2878
+ * @descEN Require that function overload signatures be consecutive
2879
+ * @see https://typescript-eslint.io/rules/adjacent-overload-signatures
2880
+ */
2881
+ "ts/adjacent-overload-signatures": 2,
2882
+ /**
2883
+ * @desc 要求一致使用 T[] 或 Array<T>
2884
+ * @descEN Require consistently using either T[] or Array<T> for arrays
2885
+ * @see https://typescript-eslint.io/rules/array-type
2886
+ */
2887
+ "ts/array-type": 2,
2888
+ /**
2889
+ * @desc 禁止 await 非 Thenable 的值
2890
+ * @descEN Disallow awaiting a value that is not a Thenable
2891
+ * @see https://typescript-eslint.io/rules/await-thenable
2892
+ */
2893
+ "ts/await-thenable": 0,
2894
+ /**
2895
+ * @desc 禁止 @ts-<directive> 注释或要求指令后带说明
2896
+ * @descEN Disallow @ts-<directive> comments or require descriptions after directives
2897
+ * @see https://typescript-eslint.io/rules/ban-ts-comment
2898
+ */
2899
+ "ts/ban-ts-comment": 0,
2900
+ /**
2901
+ * @desc 禁止 // tslint:<rule-flag> 注释
2902
+ * @descEN Disallow // tslint:<rule-flag> comments
2903
+ * @see https://typescript-eslint.io/rules/ban-tslint-comment
2904
+ */
2905
+ "ts/ban-tslint-comment": 0,
2906
+ /**
2907
+ * @desc 强制类上的字面量以一致风格暴露
2908
+ * @descEN Enforce that literals on classes are exposed in a consistent style
2909
+ * @see https://typescript-eslint.io/rules/class-literal-property-style
2910
+ */
2911
+ "ts/class-literal-property-style": [2, "fields"],
2912
+ /**
2913
+ * @desc 强制类方法使用 this
2914
+ * @descEN Enforce that class methods utilize this
2915
+ * @see https://typescript-eslint.io/rules/class-methods-use-this
2916
+ */
2917
+ "ts/class-methods-use-this": 0,
2918
+ /**
2919
+ * @desc 强制在构造函数调用上指定泛型类型参数的风格
2920
+ * @descEN Enforce specifying generic type arguments on type annotation or constructor name of a constructor call
2921
+ * @see https://typescript-eslint.io/rules/consistent-generic-constructors
2922
+ */
2923
+ "ts/consistent-generic-constructors": 0,
2924
+ /**
2925
+ * @desc 要求或禁止 Record 类型
2926
+ * @descEN Require or disallow the Record type
2927
+ * @see https://typescript-eslint.io/rules/consistent-indexed-object-style
2928
+ */
2929
+ "ts/consistent-indexed-object-style": 0,
2930
+ /**
2931
+ * @desc 要求函数返回语句要么都指定值要么都不指定
2932
+ * @descEN Require `return` statements to either always or never specify values
2933
+ * @see https://typescript-eslint.io/rules/consistent-return
2934
+ */
2935
+ "ts/consistent-return": 0,
2936
+ /**
2937
+ * @desc 强制类型断言风格一致
2938
+ * @descEN Enforce consistent usage of type assertions
2939
+ * @see https://typescript-eslint.io/rules/consistent-type-assertions
2940
+ */
2941
+ "ts/consistent-type-assertions": 2,
2942
+ /**
2943
+ * @desc 强制类型定义一致使用 interface 或 type
2944
+ * @descEN Enforce type definitions to consistently use either interface or type
2945
+ * @see https://typescript-eslint.io/rules/consistent-type-definitions
2946
+ */
2947
+ "ts/consistent-type-definitions": [2, "interface"],
2948
+ /**
2949
+ * @desc 强制一致使用 type 导出
2950
+ * @descEN Enforce consistent usage of type exports
2951
+ * @see https://typescript-eslint.io/rules/consistent-type-exports
2952
+ */
2953
+ "ts/consistent-type-exports": 2,
2954
+ /**
2955
+ * @desc 强制一致使用 type 导入
2956
+ * @descEN Enforce consistent usage of type imports
2957
+ * @see https://typescript-eslint.io/rules/consistent-type-imports
2958
+ */
2959
+ "ts/consistent-type-imports": [2, { fixStyle: "inline-type-imports" }],
2960
+ /**
2961
+ * @desc 强制默认参数在最后
2962
+ * @descEN Enforce default parameters to be last
2963
+ * @see https://typescript-eslint.io/rules/default-param-last
2964
+ */
2965
+ "ts/default-param-last": 2,
2966
+ /**
2967
+ * @desc 强制尽可能使用点号表示法
2968
+ * @descEN Enforce dot notation whenever possible
2969
+ * @see https://typescript-eslint.io/rules/dot-notation
2970
+ */
2971
+ "ts/dot-notation": 0,
2972
+ /**
2973
+ * @desc 要求函数和方法有显式返回类型
2974
+ * @descEN Require explicit return types on functions and class methods
2975
+ * @see https://typescript-eslint.io/rules/explicit-function-return-type
2976
+ */
2977
+ "ts/explicit-function-return-type": 0,
2978
+ /**
2979
+ * @desc 要求类属性和方法有显式可访问性修饰符
2980
+ * @descEN Require explicit accessibility modifiers on class properties and methods
2981
+ * @see https://typescript-eslint.io/rules/explicit-member-accessibility
2982
+ */
2983
+ "ts/explicit-member-accessibility": 0,
2984
+ /**
2985
+ * @desc 要求导出函数和类的公共方法有显式返回和参数类型
2986
+ * @descEN Require explicit return and argument types on exported functions' and classes' public class methods
2987
+ * @see https://typescript-eslint.io/rules/explicit-module-boundary-types
2988
+ */
2989
+ "ts/explicit-module-boundary-types": 0,
2990
+ /**
2991
+ * @desc 要求或禁止变量声明中初始化
2992
+ * @descEN Require or disallow initialization in variable declarations
2993
+ * @see https://typescript-eslint.io/rules/init-declarations
2994
+ */
2995
+ "ts/init-declarations": 0,
2996
+ /**
2997
+ * @desc 强制函数定义中最大参数数量
2998
+ * @descEN Enforce a maximum number of parameters in function definitions
2999
+ * @see https://typescript-eslint.io/rules/max-params
3000
+ */
3001
+ "ts/max-params": 0,
3002
+ /**
3003
+ * @desc 要求成员声明顺序一致
3004
+ * @descEN Require a consistent member declaration order
3005
+ * @see https://typescript-eslint.io/rules/member-ordering
3006
+ */
3007
+ "ts/member-ordering": [2, { default: preset_default.tsMemberOrder }],
3008
+ /**
3009
+ * @desc 强制使用特定的方法签名语法
3010
+ * @descEN Enforce using a particular method signature syntax
3011
+ * @see https://typescript-eslint.io/rules/method-signature-style
3012
+ */
3013
+ "ts/method-signature-style": 2,
3014
+ /**
3015
+ * @desc 强制整个代码库的命名约定
3016
+ * @descEN Enforce naming conventions for everything across a codebase
3017
+ * @see https://typescript-eslint.io/rules/naming-convention
3018
+ */
3019
+ "ts/naming-convention": 0,
3020
+ /**
3021
+ * @desc 禁止泛型 Array 构造函数
3022
+ * @descEN Disallow generic Array constructors
3023
+ * @see https://typescript-eslint.io/rules/no-array-constructor
3024
+ */
3025
+ "ts/no-array-constructor": 2,
3026
+ /**
3027
+ * @desc 禁止对数组值使用 delete 操作符
3028
+ * @descEN Disallow using the delete operator on array values
3029
+ * @see https://typescript-eslint.io/rules/no-array-delete
3030
+ */
3031
+ "ts/no-array-delete": 2,
3032
+ /**
3033
+ * @desc 要求 toString 和 toLocaleString 仅在提供有用信息的对象上调用
3034
+ * @descEN Require .toString() to only be called on objects which provide useful information when stringified
3035
+ * @see https://typescript-eslint.io/rules/no-base-to-string
3036
+ */
3037
+ "ts/no-base-to-string": 0,
3038
+ /**
3039
+ * @desc 禁止在可能混淆的位置使用非空断言
3040
+ * @descEN Disallow non-null assertion in locations that may be confusing
3041
+ * @see https://typescript-eslint.io/rules/no-confusing-non-null-assertion
3042
+ */
3043
+ "ts/no-confusing-non-null-assertion": 0,
3044
+ /**
3045
+ * @desc 要求 void 类型的表达式出现在语句位置
3046
+ * @descEN Require expressions of type void to appear in statement position
3047
+ * @see https://typescript-eslint.io/rules/no-confusing-void-expression
3048
+ */
3049
+ "ts/no-confusing-void-expression": [2, {
3050
+ ignoreArrowShorthand: true,
3051
+ ignoreVoidOperator: false
3052
+ }],
3053
+ /**
3054
+ * @desc 禁止使用标记为 @deprecated 的代码
3055
+ * @descEN Disallow using code marked as @deprecated
3056
+ * @see https://typescript-eslint.io/rules/no-deprecated
3057
+ */
3058
+ "ts/no-deprecated": 0,
3059
+ /**
3060
+ * @desc 禁止重复的类成员
3061
+ * @descEN Disallow duplicate class members
3062
+ * @see https://typescript-eslint.io/rules/no-dupe-class-members
3063
+ */
3064
+ "ts/no-dupe-class-members": 2,
3065
+ /**
3066
+ * @desc 禁止重复的枚举成员值
3067
+ * @descEN Disallow duplicate enum member values
3068
+ * @see https://typescript-eslint.io/rules/no-duplicate-enum-values
3069
+ */
3070
+ "ts/no-duplicate-enum-values": 2,
3071
+ /**
3072
+ * @desc 禁止联合类型或交叉类型中有重复成分
3073
+ * @descEN Disallow duplicate constituents of union or intersection types
3074
+ * @see https://typescript-eslint.io/rules/no-duplicate-type-constituents
3075
+ */
3076
+ "ts/no-duplicate-type-constituents": 0,
3077
+ /**
3078
+ * @desc 禁止对计算键表达式使用 delete 操作符
3079
+ * @descEN Disallow using the delete operator on computed key expressions
3080
+ * @see https://typescript-eslint.io/rules/no-dynamic-delete
3081
+ */
3082
+ "ts/no-dynamic-delete": 0,
3083
+ /**
3084
+ * @desc 禁止空函数
3085
+ * @descEN Disallow empty functions
3086
+ * @see https://typescript-eslint.io/rules/no-empty-function
3087
+ */
3088
+ "ts/no-empty-function": 0,
3089
+ /**
3090
+ * @desc 禁止意外使用空对象类型
3091
+ * @descEN Disallow accidentally using the "empty object" type
3092
+ * @see https://typescript-eslint.io/rules/no-empty-object-type
3093
+ */
3094
+ "ts/no-empty-object-type": [2, { allowInterfaces: "with-single-extends" }],
3095
+ /**
3096
+ * @desc 禁止 any 类型
3097
+ * @descEN Disallow the any type
3098
+ * @see https://typescript-eslint.io/rules/no-explicit-any
3099
+ */
3100
+ "ts/no-explicit-any": [2, {
3101
+ fixToUnknown: true,
3102
+ ignoreRestArgs: true
3103
+ }],
3104
+ /**
3105
+ * @desc 禁止多余的非空断言
3106
+ * @descEN Disallow extra non-null assertions
3107
+ * @see https://typescript-eslint.io/rules/no-extra-non-null-assertion
3108
+ */
3109
+ "ts/no-extra-non-null-assertion": 0,
3110
+ /**
3111
+ * @desc 禁止用作命名空间的类
3112
+ * @descEN Disallow classes used as namespaces
3113
+ * @see https://typescript-eslint.io/rules/no-extraneous-class
3114
+ */
3115
+ "ts/no-extraneous-class": 0,
3116
+ /**
3117
+ * @desc 要求 Promise 风格的语句被正确处理
3118
+ * @descEN Require Promise-like statements to be handled appropriately
3119
+ * @see https://typescript-eslint.io/rules/no-floating-promises
3120
+ */
3121
+ "ts/no-floating-promises": 0,
3122
+ /**
3123
+ * @desc 禁止使用 for-in 循环遍历数组
3124
+ * @descEN Disallow iterating over an array with a for-in loop
3125
+ * @see https://typescript-eslint.io/rules/no-for-in-array
3126
+ */
3127
+ "ts/no-for-in-array": 0,
3128
+ /**
3129
+ * @desc 禁止解析为 "empty object" 类型的类型操作
3130
+ * @descEN Disallow type operations that resolve to the "empty object" type
3131
+ * @see https://typescript-eslint.io/rules/no-generated-empty-object-type
3132
+ */
3133
+ "ts/no-generated-empty-object-type": 0,
3134
+ /**
3135
+ * @desc 禁止使用类似 eval 的函数
3136
+ * @descEN Disallow the use of eval()-like functions
3137
+ * @see https://typescript-eslint.io/rules/no-implied-eval
3138
+ */
3139
+ "ts/no-implied-eval": 2,
3140
+ /**
3141
+ * @desc 强制当导入只有内联类型限定符时使用顶级 import type 限定符
3142
+ * @descEN Enforce the use of top-level import type qualifier when an import only has specifiers with inline type qualifiers
3143
+ * @see https://typescript-eslint.io/rules/no-import-type-side-effects
3144
+ */
3145
+ "ts/no-import-type-side-effects": 2,
3146
+ /**
3147
+ * @desc 禁止对初始化为数字、字符串或布尔值的变量或参数使用显式类型声明
3148
+ * @descEN Disallow explicit type declarations for variables or parameters initialized to a number, string, or boolean
3149
+ * @see https://typescript-eslint.io/rules/no-inferrable-types
3150
+ */
3151
+ "ts/no-inferrable-types": [2, {
3152
+ ignoreParameters: true,
3153
+ ignoreProperties: true
3154
+ }],
3155
+ /**
3156
+ * @desc 禁止在类或类式对象之外使用 this
3157
+ * @descEN Disallow `this` keywords outside of classes or class-like objects
3158
+ * @see https://typescript-eslint.io/rules/no-invalid-this
3159
+ */
3160
+ "ts/no-invalid-this": 0,
3161
+ /**
3162
+ * @desc 禁止在泛型或返回类型之外使用 void 类型
3163
+ * @descEN Disallow void type outside of generic or return types
3164
+ * @see https://typescript-eslint.io/rules/no-invalid-void-type
3165
+ */
3166
+ "ts/no-invalid-void-type": 2,
3167
+ /**
3168
+ * @desc 禁止在循环语句中包含不安全引用的函数声明
3169
+ * @descEN Disallow function declarations that contain unsafe references inside loop statements
3170
+ * @see https://typescript-eslint.io/rules/no-loop-func
3171
+ */
3172
+ "ts/no-loop-func": 0,
3173
+ /**
3174
+ * @desc 禁止魔术数字
3175
+ * @descEN Disallow magic numbers
3176
+ * @see https://typescript-eslint.io/rules/no-magic-numbers
3177
+ */
3178
+ "ts/no-magic-numbers": 0,
3179
+ /**
3180
+ * @desc 禁止除用于丢弃值外的 void 运算符
3181
+ * @descEN Disallow the void operator except when used to discard a value
3182
+ * @see https://typescript-eslint.io/rules/no-meaningless-void-operator
3183
+ */
3184
+ "ts/no-meaningless-void-operator": 0,
3185
+ /**
3186
+ * @desc 强制 new 和 constructor 的有效定义
3187
+ * @descEN Enforce valid definition of new and constructor
3188
+ * @see https://typescript-eslint.io/rules/no-misused-new
3189
+ */
3190
+ "ts/no-misused-new": 0,
3191
+ /**
3192
+ * @desc 禁止在不设计处理 Promise 的地方使用 Promise
3193
+ * @descEN Disallow Promises in places not designed to handle them
3194
+ * @see https://typescript-eslint.io/rules/no-misused-promises
3195
+ */
3196
+ "ts/no-misused-promises": [2, { checksVoidReturn: false }],
3197
+ /**
3198
+ * @desc 禁止展开运算符可能导致意外行为的使用
3199
+ * @descEN Disallow using the spread operator when it might cause unexpected behavior
3200
+ * @see https://typescript-eslint.io/rules/no-misused-spread
3201
+ */
3202
+ "ts/no-misused-spread": 2,
3203
+ /**
3204
+ * @desc 禁止枚举同时具有数字和字符串成员
3205
+ * @descEN Disallow enums from having both number and string members
3206
+ * @see https://typescript-eslint.io/rules/no-mixed-enums
3207
+ */
3208
+ "ts/no-mixed-enums": 0,
3209
+ /**
3210
+ * @desc 禁止 TypeScript 命名空间
3211
+ * @descEN Disallow TypeScript namespaces
3212
+ * @see https://typescript-eslint.io/rules/no-namespace
3213
+ */
3214
+ "ts/no-namespace": [2, {
3215
+ allowDeclarations: true,
3216
+ allowDefinitionFiles: true
3217
+ }],
3218
+ /**
3219
+ * @desc 禁止空值合并运算符左操作数中的非空断言
3220
+ * @descEN Disallow non-null assertions in the left operand of a nullish coalescing operator
3221
+ * @see https://typescript-eslint.io/rules/no-non-null-asserted-nullish-coalescing
3222
+ */
3223
+ "ts/no-non-null-asserted-nullish-coalescing": 2,
3224
+ /**
3225
+ * @desc 禁止可选链表达式后的非空断言
3226
+ * @descEN Disallow non-null assertions after an optional chain expression
3227
+ * @see https://typescript-eslint.io/rules/no-non-null-asserted-optional-chain
3228
+ */
3229
+ "ts/no-non-null-asserted-optional-chain": 2,
3230
+ /**
3231
+ * @desc 禁止使用 ! 后缀运算符进行非空断言
3232
+ * @descEN Disallow non-null assertions using the ! postfix operator
3233
+ * @see https://typescript-eslint.io/rules/no-non-null-assertion
3234
+ */
3235
+ "ts/no-non-null-assertion": 0,
3236
+ /**
3237
+ * @desc 禁止变量重复声明
3238
+ * @descEN Disallow variable redeclaration
3239
+ * @see https://typescript-eslint.io/rules/no-redeclare
3240
+ */
3241
+ "ts/no-redeclare": 2,
3242
+ /**
3243
+ * @desc 禁止联合类型或交叉类型中不起作用或覆盖类型信息的成员
3244
+ * @descEN Disallow members of unions and intersections that do nothing or override type information
3245
+ * @see https://typescript-eslint.io/rules/no-redundant-type-constituents
3246
+ */
3247
+ "ts/no-redundant-type-constituents": 0,
3248
+ /**
3249
+ * @desc 禁止调用 require()
3250
+ * @descEN Disallow invocation of require()
3251
+ * @see https://typescript-eslint.io/rules/no-require-imports
3252
+ */
3253
+ "ts/no-require-imports": 2,
3254
+ /**
3255
+ * @desc 禁止导入特定模块
3256
+ * @descEN Disallow specified modules when loaded by import
3257
+ * @see https://typescript-eslint.io/rules/no-restricted-imports
3258
+ */
3259
+ "ts/no-restricted-imports": 0,
3260
+ /**
3261
+ * @desc 禁止某些类型
3262
+ * @descEN Disallow certain types
3263
+ * @see https://typescript-eslint.io/rules/no-restricted-types
3264
+ */
3265
+ "ts/no-restricted-types": 0,
3266
+ /**
3267
+ * @desc 禁止变量声明遮蔽外层作用域变量
3268
+ * @descEN Disallow variable declarations from shadowing variables declared in the outer scope
3269
+ * @see https://typescript-eslint.io/rules/no-shadow
3270
+ */
3271
+ "ts/no-shadow": 0,
3272
+ /**
3273
+ * @desc 禁止别名 this
3274
+ * @descEN Disallow aliasing this
3275
+ * @see https://typescript-eslint.io/rules/no-this-alias
3276
+ */
3277
+ "ts/no-this-alias": [2, { allowDestructuring: true }],
3278
+ /**
3279
+ * @desc 禁止与布尔字面量的不必要相等比较
3280
+ * @descEN Disallow unnecessary equality comparisons against boolean literals
3281
+ * @see https://typescript-eslint.io/rules/no-unnecessary-boolean-literal-compare
3282
+ */
3283
+ "ts/no-unnecessary-boolean-literal-compare": 0,
3284
+ /**
3285
+ * @desc 禁止条件表达式类型始终为真或始终为假
3286
+ * @descEN Disallow conditionals where the type is always truthy or always falsy
3287
+ * @see https://typescript-eslint.io/rules/no-unnecessary-condition
3288
+ */
3289
+ "ts/no-unnecessary-condition": 0,
3290
+ /**
3291
+ * @desc 禁止不必要的构造函数属性参数赋值
3292
+ * @descEN Disallow unnecessary assignment of constructor property parameter
3293
+ * @see https://typescript-eslint.io/rules/no-unnecessary-parameter-property-assignment
3294
+ */
3295
+ "ts/no-unnecessary-parameter-property-assignment": 0,
3296
+ /**
3297
+ * @desc 禁止不必要的命名空间限定符
3298
+ * @descEN Disallow unnecessary namespace qualifiers
3299
+ * @see https://typescript-eslint.io/rules/no-unnecessary-qualifier
3300
+ */
3301
+ "ts/no-unnecessary-qualifier": 0,
3302
+ /**
3303
+ * @desc 禁止不必要的模板表达式
3304
+ * @descEN Disallow unnecessary template expressions
3305
+ * @see https://typescript-eslint.io/rules/no-unnecessary-template-expression
3306
+ */
3307
+ "ts/no-unnecessary-template-expression": 2,
3308
+ /**
3309
+ * @desc 禁止等于默认值的类型参数
3310
+ * @descEN Disallow type arguments that are equal to the default
3311
+ * @see https://typescript-eslint.io/rules/no-unnecessary-type-arguments
3312
+ */
3313
+ "ts/no-unnecessary-type-arguments": 0,
3314
+ /**
3315
+ * @desc 禁止不改变表达式类型的类型断言
3316
+ * @descEN Disallow type assertions that do not change the type of an expression
3317
+ * @see https://typescript-eslint.io/rules/no-unnecessary-type-assertion
3318
+ */
3319
+ "ts/no-unnecessary-type-assertion": 0,
3320
+ /**
3321
+ * @desc 禁止对泛型类型的不必要约束
3322
+ * @descEN Disallow unnecessary constraints on generic types
3323
+ * @see https://typescript-eslint.io/rules/no-unnecessary-type-constraint
3324
+ */
3325
+ "ts/no-unnecessary-type-constraint": 2,
3326
+ /**
3327
+ * @desc 禁止不改变类型或值的类型转换惯用法
3328
+ * @descEN Disallow conversion idioms when they do not change the type or value of the expression
3329
+ * @see https://typescript-eslint.io/rules/no-unnecessary-type-conversion
3330
+ */
3331
+ "ts/no-unnecessary-type-conversion": 0,
3332
+ /**
3333
+ * @desc 禁止未多次使用的类型参数
3334
+ * @descEN Disallow type parameters that aren't used multiple times
3335
+ * @see https://typescript-eslint.io/rules/no-unnecessary-type-parameters
3336
+ */
3337
+ "ts/no-unnecessary-type-parameters": 0,
3338
+ /**
3339
+ * @desc 禁止使用类型为 any 的值调用函数
3340
+ * @descEN Disallow calling a function with a value with type any
3341
+ * @see https://typescript-eslint.io/rules/no-unsafe-argument
3342
+ */
3343
+ "ts/no-unsafe-argument": 0,
3344
+ /**
3345
+ * @desc 禁止将类型为 any 的值赋值给变量和属性
3346
+ * @descEN Disallow assigning a value with type any to variables and properties
3347
+ * @see https://typescript-eslint.io/rules/no-unsafe-assignment
3348
+ */
3349
+ "ts/no-unsafe-assignment": 0,
3350
+ /**
3351
+ * @desc 禁止调用类型为 any 的值
3352
+ * @descEN Disallow calling a value with type any
3353
+ * @see https://typescript-eslint.io/rules/no-unsafe-call
3354
+ */
3355
+ "ts/no-unsafe-call": 0,
3356
+ /**
3357
+ * @desc 禁止不安全的声明合并
3358
+ * @descEN Disallow unsafe declaration merging
3359
+ * @see https://typescript-eslint.io/rules/no-unsafe-declaration-merging
3360
+ */
3361
+ "ts/no-unsafe-declaration-merging": 0,
3362
+ /**
3363
+ * @desc 禁止将非枚举值赋值给枚举类型位置
3364
+ * @descEN Disallow assigning non-enum values to enum typed locations
3365
+ * @see https://typescript-eslint.io/rules/no-unsafe-enum-assignment
3366
+ */
3367
+ "ts/no-unsafe-enum-assignment": 2,
3368
+ /**
3369
+ * @desc 禁止将枚举值与非枚举值比较
3370
+ * @descEN Disallow comparing an enum value with a non-enum value
3371
+ * @see https://typescript-eslint.io/rules/no-unsafe-enum-comparison
3372
+ */
3373
+ "ts/no-unsafe-enum-comparison": 0,
3374
+ /**
3375
+ * @desc 禁止使用不安全的原生 Function 类型
3376
+ * @descEN Disallow using the unsafe built-in Function type
3377
+ * @see https://typescript-eslint.io/rules/no-unsafe-function-type
3378
+ */
3379
+ "ts/no-unsafe-function-type": 2,
3380
+ /**
3381
+ * @desc 禁止访问类型为 any 的属性
3382
+ * @descEN Disallow member access on a value with type any
3383
+ * @see https://typescript-eslint.io/rules/no-unsafe-member-access
3384
+ */
3385
+ "ts/no-unsafe-member-access": 0,
3386
+ /**
3387
+ * @desc 禁止从函数返回类型为 any 的值
3388
+ * @descEN Disallow returning a value with type any from a function
3389
+ * @see https://typescript-eslint.io/rules/no-unsafe-return
3390
+ */
3391
+ "ts/no-unsafe-return": 0,
3392
+ /**
3393
+ * @desc 禁止缩小范围类型的类型断言
3394
+ * @descEN Disallow type assertions that narrow a type
3395
+ * @see https://typescript-eslint.io/rules/no-unsafe-type-assertion
3396
+ */
3397
+ "ts/no-unsafe-type-assertion": 0,
3398
+ /**
3399
+ * @desc 要求一元否定运算作用于数字
3400
+ * @descEN Require unary negation to take a number
3401
+ * @see https://typescript-eslint.io/rules/no-unsafe-unary-minus
3402
+ */
3403
+ "ts/no-unsafe-unary-minus": 2,
3404
+ /**
3405
+ * @desc 禁止未使用的表达式
3406
+ * @descEN Disallow unused expressions
3407
+ * @see https://typescript-eslint.io/rules/no-unused-expressions
3408
+ */
3409
+ "ts/no-unused-expressions": [1, {
3410
+ ignoreDirectives: true,
3411
+ allowShortCircuit: true
3412
+ }],
3413
+ /**
3414
+ * @desc 禁止未使用的私有类成员
3415
+ * @descEN Disallow unused private class members
3416
+ * @see https://typescript-eslint.io/rules/no-unused-private-class-members
3417
+ */
3418
+ "ts/no-unused-private-class-members": 1,
3419
+ /**
3420
+ * @desc 禁止未使用的变量
3421
+ * @descEN Disallow unused variables
3422
+ * @see https://typescript-eslint.io/rules/no-unused-vars
3423
+ */
3424
+ "ts/no-unused-vars": [1, {
3425
+ vars: "local",
3426
+ args: "none",
3427
+ caughtErrors: "none",
3428
+ varsIgnorePattern: "^_",
3429
+ destructuredArrayIgnorePattern: "^_"
3430
+ }],
3431
+ /**
3432
+ * @desc 禁止在定义之前使用变量
3433
+ * @descEN Disallow the use of variables before they are defined
3434
+ * @see https://typescript-eslint.io/rules/no-use-before-define
3435
+ */
3436
+ "ts/no-use-before-define": [2, {
3437
+ functions: false,
3438
+ classes: false,
3439
+ variables: false,
3440
+ allowNamedExports: false
3441
+ }],
3442
+ /**
3443
+ * @desc 禁止不必要的构造函数
3444
+ * @descEN Disallow unnecessary constructors
3445
+ * @see https://typescript-eslint.io/rules/no-useless-constructor
3446
+ */
3447
+ "ts/no-useless-constructor": 0,
3448
+ /**
3449
+ * @desc 禁止永远不会生效的默认值
3450
+ * @descEN Disallow default values that will never be used
3451
+ * @see https://typescript-eslint.io/rules/no-useless-default-assignment
3452
+ */
3453
+ "ts/no-useless-default-assignment": 0,
3454
+ /**
3455
+ * @desc 禁止不改变模块文件内容的空导出
3456
+ * @descEN Disallow empty exports that don't change anything in a module file
3457
+ * @see https://typescript-eslint.io/rules/no-useless-empty-export
3458
+ */
3459
+ "ts/no-useless-empty-export": 0,
3460
+ /**
3461
+ * @desc 禁止使用令人困惑的内置基本类型包装器
3462
+ * @descEN Disallow using confusing built-in primitive class wrappers
3463
+ * @see https://typescript-eslint.io/rules/no-wrapper-object-types
3464
+ */
3465
+ "ts/no-wrapper-object-types": 2,
3466
+ /**
3467
+ * @desc 强制使用非空断言而不是显式类型断言
3468
+ * @descEN Enforce non-null assertions over explicit type assertions
3469
+ * @see https://typescript-eslint.io/rules/non-nullable-type-assertion-style
3470
+ */
3471
+ "ts/non-nullable-type-assertion-style": 0,
3472
+ /**
3473
+ * @desc 禁止抛出非 Error 值作为异常
3474
+ * @descEN Disallow throwing non-Error values as exceptions
3475
+ * @see https://typescript-eslint.io/rules/only-throw-error
3476
+ */
3477
+ "ts/only-throw-error": [2, { allow: [{
3478
+ from: "package",
3479
+ package: "@tanstack/router-core",
3480
+ name: "Redirect"
3481
+ }] }],
3482
+ /**
3483
+ * @desc 要求或禁止类构造函数中的参数属性
3484
+ * @descEN Require or disallow parameter properties in class constructors
3485
+ * @see https://typescript-eslint.io/rules/parameter-properties
3486
+ */
3487
+ "ts/parameter-properties": 0,
3488
+ /**
3489
+ * @desc 强制使用 as const 而非字面量类型
3490
+ * @descEN Enforce the use of as const over literal type
3491
+ * @see https://typescript-eslint.io/rules/prefer-as-const
3492
+ */
3493
+ "ts/prefer-as-const": 0,
3494
+ /**
3495
+ * @desc 要求从数组和/或对象进行解构
3496
+ * @descEN Require destructuring from arrays and/or objects
3497
+ * @see https://typescript-eslint.io/rules/prefer-destructuring
3498
+ */
3499
+ "ts/prefer-destructuring": 0,
3500
+ /**
3501
+ * @desc 要求每个枚举成员值都被显式初始化
3502
+ * @descEN Require each enum member value to be explicitly initialized
3503
+ * @see https://typescript-eslint.io/rules/prefer-enum-initializers
3504
+ */
3505
+ "ts/prefer-enum-initializers": 0,
3506
+ /**
3507
+ * @desc 强制使用 Array.prototype.find 而不是 filter 后跟 [0]
3508
+ * @descEN Enforce the use of Array.prototype.find() over Array.prototype.filter() followed by [0]
3509
+ * @see https://typescript-eslint.io/rules/prefer-find
3510
+ */
3511
+ "ts/prefer-find": 2,
3512
+ /**
3513
+ * @desc 强制尽可能使用 for-of 循环代替标准 for 循环
3514
+ * @descEN Enforce the use of for-of loop over the standard for loop where possible
3515
+ * @see https://typescript-eslint.io/rules/prefer-for-of
3516
+ */
3517
+ "ts/prefer-for-of": 0,
3518
+ /**
3519
+ * @desc 强制使用函数类型替代带调用签名的接口
3520
+ * @descEN Enforce using function types instead of interfaces with call signatures
3521
+ * @see https://typescript-eslint.io/rules/prefer-function-type
3522
+ */
3523
+ "ts/prefer-function-type": 2,
3524
+ /**
3525
+ * @desc 强制使用 includes 方法代替 indexOf 方法
3526
+ * @descEN Enforce includes method over indexOf method
3527
+ * @see https://typescript-eslint.io/rules/prefer-includes
3528
+ */
3529
+ "ts/prefer-includes": 0,
3530
+ /**
3531
+ * @desc 要求所有枚举成员必须是字面量值
3532
+ * @descEN Require all enum members to be literal values
3533
+ * @see https://typescript-eslint.io/rules/prefer-literal-enum-member
3534
+ */
3535
+ "ts/prefer-literal-enum-member": 0,
3536
+ /**
3537
+ * @desc 要求使用 namespace 关键字而非 module 关键字
3538
+ * @descEN Require using namespace keyword over module keyword
3539
+ * @see https://typescript-eslint.io/rules/prefer-namespace-keyword
3540
+ */
3541
+ "ts/prefer-namespace-keyword": 2,
3542
+ /**
3543
+ * @desc 强制使用空值合并运算符替代逻辑赋值或链式操作
3544
+ * @descEN Enforce using the nullish coalescing operator instead of logical assignments or chaining
3545
+ * @see https://typescript-eslint.io/rules/prefer-nullish-coalescing
3546
+ */
3547
+ "ts/prefer-nullish-coalescing": 0,
3548
+ /**
3549
+ * @desc 强制使用简洁的可选链表达式替代逻辑与链
3550
+ * @descEN Enforce using concise optional chain expressions instead of chained logical ands
3551
+ * @see https://typescript-eslint.io/rules/prefer-optional-chain
3552
+ */
3553
+ "ts/prefer-optional-chain": 0,
3554
+ /**
3555
+ * @desc 要求使用 Error 对象作为 Promise 拒绝原因
3556
+ * @descEN Require using Error objects as Promise rejection reasons
3557
+ * @see https://typescript-eslint.io/rules/prefer-promise-reject-errors
3558
+ */
3559
+ "ts/prefer-promise-reject-errors": 0,
3560
+ /**
3561
+ * @desc 要求如果私有成员不在构造函数外修改,则标记为 readonly
3562
+ * @descEN Require private members to be marked as readonly if they're never modified outside of the constructor
3563
+ * @see https://typescript-eslint.io/rules/prefer-readonly
3564
+ */
3565
+ "ts/prefer-readonly": 0,
3566
+ /**
3567
+ * @desc 要求函数参数类型为 readonly 以防止意外修改输入
3568
+ * @descEN Require function parameters to be typed as readonly to prevent accidental mutation of inputs
3569
+ * @see https://typescript-eslint.io/rules/prefer-readonly-parameter-types
3570
+ */
3571
+ "ts/prefer-readonly-parameter-types": 0,
3572
+ /**
3573
+ * @desc 强制在调用 Array#reduce 时使用类型参数代替类型断言
3574
+ * @descEN Enforce using type parameter when calling Array#reduce instead of using a type assertion
3575
+ * @see https://typescript-eslint.io/rules/prefer-reduce-type-parameter
3576
+ */
3577
+ "ts/prefer-reduce-type-parameter": 0,
3578
+ /**
3579
+ * @desc 强制在没有全局标志时使用 RegExp#exec 而非 String#match
3580
+ * @descEN Enforce RegExp#exec over String#match if no global flag is provided
3581
+ * @see https://typescript-eslint.io/rules/prefer-regexp-exec
3582
+ */
3583
+ "ts/prefer-regexp-exec": 0,
3584
+ /**
3585
+ * @desc 强制当仅返回 this 类型时使用 this
3586
+ * @descEN Enforce that this is used when only this type is returned
3587
+ * @see https://typescript-eslint.io/rules/prefer-return-this-type
3588
+ */
3589
+ "ts/prefer-return-this-type": 0,
3590
+ /**
3591
+ * @desc 强制使用 String#startsWith 和 String#endsWith 替代其他等效方法
3592
+ * @descEN Enforce using String#startsWith and String#endsWith over other equivalent methods of checking substrings
3593
+ * @see https://typescript-eslint.io/rules/prefer-string-starts-ends-with
3594
+ */
3595
+ "ts/prefer-string-starts-ends-with": 0,
3596
+ /**
3597
+ * @desc 要求返回 Promise 的函数或方法标记为 async
3598
+ * @descEN Require any function or method that returns a Promise to be marked async
3599
+ * @see https://typescript-eslint.io/rules/promise-function-async
3600
+ */
3601
+ "ts/promise-function-async": 0,
3602
+ /**
3603
+ * @desc 强制 get 类型应可赋值给其对应的 set 类型
3604
+ * @descEN Enforce that get() types should be assignable to their equivalent set() type
3605
+ * @see https://typescript-eslint.io/rules/related-getter-setter-pairs
3606
+ */
3607
+ "ts/related-getter-setter-pairs": 2,
3608
+ /**
3609
+ * @desc 要求 Array#sort 调用始终提供 compareFunction
3610
+ * @descEN Require Array#sort calls to always provide a compareFunction
3611
+ * @see https://typescript-eslint.io/rules/require-array-sort-compare
3612
+ */
3613
+ "ts/require-array-sort-compare": 0,
3614
+ /**
3615
+ * @desc 禁止没有 await 表达式的异步函数
3616
+ * @descEN Disallow async functions which do not have await expression
3617
+ * @see https://typescript-eslint.io/rules/require-await
3618
+ */
3619
+ "ts/require-await": 0,
3620
+ /**
3621
+ * @desc 要求加法运算的两个操作数类型相同
3622
+ * @descEN Require both operands of addition to be the same type and be bigint, number, or string
3623
+ * @see https://typescript-eslint.io/rules/restrict-plus-operands
3624
+ */
3625
+ "ts/restrict-plus-operands": 0,
3626
+ /**
3627
+ * @desc 强制模板字面量表达式为 string 类型
3628
+ * @descEN Enforce template literal expressions to be of string type
3629
+ * @see https://typescript-eslint.io/rules/restrict-template-expressions
3630
+ */
3631
+ "ts/restrict-template-expressions": 0,
3632
+ /**
3633
+ * @desc 强制一致等待返回的 Promise
3634
+ * @descEN Enforce consistent awaiting of returned promises
3635
+ * @see https://typescript-eslint.io/rules/return-await
3636
+ */
3637
+ "ts/return-await": 0,
3638
+ /**
3639
+ * @desc 禁止布尔表达式中的某些类型
3640
+ * @descEN Disallow certain types in boolean expressions
3641
+ * @see https://typescript-eslint.io/rules/strict-boolean-expressions
3642
+ */
3643
+ "ts/strict-boolean-expressions": 0,
3644
+ /**
3645
+ * @desc 禁止把有返回值的函数传入接受 void 的位置
3646
+ * @descEN Disallow passing a value-returning function in a position accepting a void function
3647
+ * @see https://typescript-eslint.io/rules/strict-void-return
3648
+ */
3649
+ "ts/strict-void-return": 1,
3650
+ /**
3651
+ * @desc 要求 switch-case 语句穷尽所有可能
3652
+ * @descEN Require switch-case statements to be exhaustive
3653
+ * @see https://typescript-eslint.io/rules/switch-exhaustiveness-check
3654
+ */
3655
+ "ts/switch-exhaustiveness-check": 0,
3656
+ /**
3657
+ * @desc 禁止某些三斜线指令,推荐使用 ES6 导入声明
3658
+ * @descEN Disallow certain triple slash directives in favor of ES6-style import declarations
3659
+ * @see https://typescript-eslint.io/rules/triple-slash-reference
3660
+ */
3661
+ "ts/triple-slash-reference": [2, {
3662
+ path: "never",
3663
+ types: "always",
3664
+ lib: "always"
3665
+ }],
3666
+ /**
3667
+ * @desc 要求在特定地方使用类型注解
3668
+ * @descEN Require type annotations in certain places
3669
+ * @see https://typescript-eslint.io/rules/typedef
3670
+ */
3671
+ "ts/typedef": [2, {
3672
+ arrayDestructuring: false,
3673
+ arrowParameter: false,
3674
+ memberVariableDeclaration: false,
3675
+ objectDestructuring: false,
3676
+ parameter: false,
3677
+ propertyDeclaration: true,
3678
+ variableDeclaration: false
3679
+ }],
3680
+ /**
3681
+ * @desc 强制未绑定的方法在其预期作用域内调用
3682
+ * @descEN Enforce unbound methods are called with their expected scope
3683
+ * @see https://typescript-eslint.io/rules/unbound-method
3684
+ */
3685
+ "ts/unbound-method": 0,
3686
+ /**
3687
+ * @desc 禁止可以统一为一个的多个重载
3688
+ * @descEN Disallow two overloads that could be unified into one
3689
+ * @see https://typescript-eslint.io/rules/unified-signatures
3690
+ */
3691
+ "ts/unified-signatures": 0,
3692
+ /**
3693
+ * @desc 强制 Promise 拒绝回调中的参数类型为 unknown
3694
+ * @descEN Enforce typing arguments in Promise rejection callbacks as unknown
3695
+ * @see https://typescript-eslint.io/rules/use-unknown-in-catch-callback-variable
3696
+ */
3697
+ "ts/use-unknown-in-catch-callback-variable": 0
3698
+ };
3699
+ //#endregion
3700
+ //#region src/core.vue.ts
3701
+ /**
3702
+ * `vue` 规则组配置
3703
+ *
3704
+ * 规则名 → 严重级别/配置的映射:`vue` 组经预设工厂(`src/config.ts`)装配进 flat config,注册名 `vue`。
3705
+ */
3706
+ const rules = {
3707
+ "vue/comment-directive": 2,
3708
+ "vue/jsx-uses-vars": 2,
3709
+ "vue/multi-word-component-names": 0,
3710
+ "vue/no-arrow-functions-in-watch": 2,
3711
+ "vue/no-async-in-computed-properties": 2,
3712
+ "vue/no-child-content": 2,
3713
+ "vue/no-computed-properties-in-data": 2,
3714
+ "vue/no-dupe-keys": 2,
3715
+ "vue/no-dupe-v-else-if": 2,
3716
+ "vue/no-duplicate-attributes": 2,
3717
+ "vue/no-export-in-script-setup": 2,
3718
+ "vue/no-mutating-props": 2,
3719
+ "vue/no-parsing-error": 2,
3720
+ "vue/no-ref-as-operand": 2,
3721
+ "vue/no-reserved-component-names": 2,
3722
+ "vue/no-reserved-keys": 2,
3723
+ "vue/no-reserved-props": 2,
3724
+ "vue/no-shared-component-data": 2,
3725
+ "vue/no-side-effects-in-computed-properties": 2,
3726
+ "vue/no-template-key": 2,
3727
+ "vue/no-textarea-mustache": 2,
3728
+ "vue/no-unused-components": 1,
3729
+ "vue/no-unused-vars": 1,
3730
+ "vue/no-use-computed-property-like-method": 2,
3731
+ "vue/no-use-v-if-with-v-for": 2,
3732
+ "vue/no-useless-template-attributes": 2,
3733
+ "vue/no-v-text-v-html-on-component": 2,
3734
+ "vue/require-component-is": 2,
3735
+ "vue/require-prop-type-constructor": 2,
3736
+ "vue/require-render-return": 2,
3737
+ "vue/require-v-for-key": 2,
3738
+ "vue/require-valid-default-prop": 2,
3739
+ "vue/return-in-computed-property": 2,
3740
+ "vue/return-in-emits-validator": 2,
3741
+ "vue/use-v-on-exact": 2,
3742
+ "vue/valid-attribute-name": 2,
3743
+ "vue/valid-define-emits": 2,
3744
+ "vue/valid-define-props": 2,
3745
+ "vue/valid-next-tick": 2,
3746
+ "vue/valid-template-root": 2,
3747
+ "vue/valid-v-bind": 2,
3748
+ "vue/valid-v-cloak": 2,
3749
+ "vue/valid-v-else-if": 2,
3750
+ "vue/valid-v-else": 2,
3751
+ "vue/valid-v-for": 2,
3752
+ "vue/valid-v-html": 2,
3753
+ "vue/valid-v-if": 2,
3754
+ "vue/valid-v-model": 2,
3755
+ "vue/valid-v-on": 2,
3756
+ "vue/valid-v-once": 2,
3757
+ "vue/valid-v-pre": 2,
3758
+ "vue/valid-v-show": 2,
3759
+ "vue/valid-v-slot": 2,
3760
+ "vue/valid-v-text": 2,
3761
+ "vue/no-deprecated-data-object-declaration": 2,
3762
+ "vue/no-deprecated-delete-set": 2,
3763
+ "vue/no-deprecated-destroyed-lifecycle": 2,
3764
+ "vue/no-deprecated-dollar-listeners-api": 2,
3765
+ "vue/no-deprecated-dollar-scopedslots-api": 2,
3766
+ "vue/no-deprecated-events-api": 2,
3767
+ "vue/no-deprecated-filter": 2,
3768
+ "vue/no-deprecated-functional-template": 2,
3769
+ "vue/no-deprecated-html-element-is": 2,
3770
+ "vue/no-deprecated-inline-template": 2,
3771
+ "vue/no-deprecated-model-definition": 2,
3772
+ "vue/no-deprecated-props-default-this": 2,
3773
+ "vue/no-deprecated-router-link-tag-prop": 2,
3774
+ "vue/no-deprecated-scope-attribute": 2,
3775
+ "vue/no-deprecated-slot-attribute": 2,
3776
+ "vue/no-deprecated-slot-scope-attribute": 2,
3777
+ "vue/no-deprecated-v-bind-sync": 2,
3778
+ "vue/no-deprecated-v-is": 2,
3779
+ "vue/no-deprecated-v-on-native-modifier": 2,
3780
+ "vue/no-deprecated-v-on-number-modifiers": 2,
3781
+ "vue/no-deprecated-vue-config-keycodes": 2,
3782
+ "vue/no-expose-after-await": 2,
3783
+ "vue/no-lifecycle-after-await": 2,
3784
+ "vue/no-v-for-template-key-on-child": 2,
3785
+ "vue/no-watch-after-await": 2,
3786
+ "vue/prefer-import-from-vue": 2,
3787
+ "vue/require-slots-as-functions": 2,
3788
+ "vue/require-toggle-inside-transition": 2,
3789
+ "vue/valid-define-options": 2,
3790
+ "vue/valid-v-is": 2,
3791
+ "vue/valid-v-memo": 2,
3792
+ "vue/no-custom-modifiers-on-v-model": 2,
3793
+ "vue/no-multiple-template-root": 0,
3794
+ "vue/attribute-hyphenation": [
3795
+ 2,
3796
+ "never",
3797
+ { ignore: [] }
3798
+ ],
3799
+ "vue/component-definition-name-casing": 2,
3800
+ "vue/first-attribute-linebreak": [2, {
3801
+ singleline: "beside",
3802
+ multiline: "below"
3803
+ }],
3804
+ "vue/html-closing-bracket-newline": 2,
3805
+ "vue/html-closing-bracket-spacing": 2,
3806
+ "vue/html-end-tags": 2,
3807
+ "vue/html-indent": 2,
3808
+ "vue/html-quotes": 2,
3809
+ "vue/html-self-closing": [2, {
3810
+ html: {
3811
+ void: "always",
3812
+ normal: "always",
3813
+ component: "always"
3814
+ },
3815
+ svg: "always",
3816
+ math: "always"
3817
+ }],
3818
+ "vue/max-attributes-per-line": 2,
3819
+ "vue/multiline-html-element-content-newline": 2,
3820
+ "vue/mustache-interpolation-spacing": 2,
3821
+ "vue/no-multi-spaces": 2,
3822
+ "vue/no-spaces-around-equal-signs-in-attribute": 2,
3823
+ "vue/no-template-shadow": 2,
3824
+ "vue/one-component-per-file": 2,
3825
+ "vue/prop-name-casing": 2,
3826
+ "vue/require-default-prop": 0,
3827
+ "vue/require-prop-types": 2,
3828
+ "vue/singleline-html-element-content-newline": 2,
3829
+ "vue/v-bind-style": 2,
3830
+ "vue/v-on-style": 2,
3831
+ "vue/v-slot-style": 2,
3832
+ "vue/require-explicit-emits": 2,
3833
+ "vue/v-on-event-hyphenation": [
3834
+ 2,
3835
+ "never",
3836
+ { autofix: true }
3837
+ ],
3838
+ "vue/attributes-order": 2,
3839
+ "vue/block-order": [2, { order: [
3840
+ "script:not([setup])",
3841
+ "script[setup]",
3842
+ "template",
3843
+ "style[scoped]",
3844
+ "style:not([scoped])"
3845
+ ] }],
3846
+ "vue/no-lone-template": 2,
3847
+ "vue/no-multiple-slot-args": 2,
3848
+ "vue/no-required-prop-with-default": 2,
3849
+ "vue/no-v-html": 0,
3850
+ "vue/order-in-components": 2,
3851
+ "vue/this-in-template": 2,
3852
+ "vue/block-lang": 0,
3853
+ "vue/block-tag-newline": 2,
3854
+ "vue/component-api-style": 2,
3855
+ "vue/component-name-in-template-casing": [
3856
+ 2,
3857
+ "PascalCase",
3858
+ { registeredComponentsOnly: false }
3859
+ ],
3860
+ "vue/component-options-name-casing": [2, "PascalCase"],
3861
+ "vue/custom-event-name-casing": [
3862
+ 2,
3863
+ "camelCase",
3864
+ { ignores: [] }
3865
+ ],
3866
+ "vue/define-emits-declaration": 0,
3867
+ "vue/define-macros-order": [2, {
3868
+ order: [
3869
+ "defineOptions",
3870
+ "defineProps",
3871
+ "defineSlots",
3872
+ "defineEmits"
3873
+ ],
3874
+ defineExposeLast: false
3875
+ }],
3876
+ "vue/define-props-declaration": 0,
3877
+ "vue/define-props-destructuring": 0,
3878
+ "vue/enforce-style-attribute": 0,
3879
+ "vue/html-button-has-type": 0,
3880
+ "vue/html-comment-content-newline": 2,
3881
+ "vue/html-comment-content-spacing": 2,
3882
+ "vue/html-comment-indent": 2,
3883
+ "vue/match-component-file-name": 0,
3884
+ "vue/match-component-import-name": 2,
3885
+ "vue/max-lines-per-block": 2,
3886
+ "vue/max-props": 0,
3887
+ "vue/max-template-depth": 0,
3888
+ "vue/new-line-between-multi-line-property": 0,
3889
+ "vue/next-tick-style": 0,
3890
+ "vue/no-bare-strings-in-template": 0,
3891
+ "vue/no-boolean-default": 0,
3892
+ "vue/no-duplicate-attr-inheritance": 2,
3893
+ "vue/no-duplicate-class-names": 2,
3894
+ "vue/no-empty-component-block": 2,
3895
+ "vue/no-import-compiler-macros": 0,
3896
+ "vue/no-literals-in-template": 1,
3897
+ "vue/no-multiple-objects-in-class": 0,
3898
+ "vue/no-negated-v-if-condition": 0,
3899
+ "vue/no-potential-component-option-typo": 0,
3900
+ "vue/no-ref-object-reactivity-loss": 0,
3901
+ "vue/no-restricted-block": 0,
3902
+ "vue/no-restricted-call-after-await": 0,
3903
+ "vue/no-restricted-class": 0,
3904
+ "vue/no-restricted-component-names": 0,
3905
+ "vue/no-restricted-component-options": 0,
3906
+ "vue/no-restricted-custom-event": 0,
3907
+ "vue/no-restricted-html-elements": 0,
3908
+ "vue/no-restricted-props": 0,
3909
+ "vue/no-restricted-static-attribute": 0,
3910
+ "vue/no-restricted-v-bind": 0,
3911
+ "vue/no-restricted-v-on": 0,
3912
+ "vue/no-root-v-if": 0,
3913
+ "vue/no-setup-props-reactivity-loss": 0,
3914
+ "vue/no-static-inline-styles": 0,
3915
+ "vue/no-template-target-blank": 0,
3916
+ "vue/no-this-in-before-route-enter": 2,
3917
+ "vue/no-undef-components": 0,
3918
+ "vue/no-undef-directives": 2,
3919
+ "vue/no-undef-properties": 0,
3920
+ "vue/no-unsupported-features": 0,
3921
+ "vue/no-unused-emit-declarations": 0,
3922
+ "vue/no-unused-properties": 1,
3923
+ "vue/no-unused-refs": 1,
3924
+ "vue/no-use-v-else-with-v-for": 0,
3925
+ "vue/no-useless-mustaches": 2,
3926
+ "vue/no-useless-v-bind": 2,
3927
+ "vue/no-v-text": 0,
3928
+ "vue/padding-line-between-blocks": 2,
3929
+ "vue/padding-line-between-tags": 0,
3930
+ "vue/padding-lines-in-component-definition": 0,
3931
+ "vue/prefer-define-options": 2,
3932
+ "vue/prefer-prop-type-boolean-first": 2,
3933
+ "vue/prefer-separate-static-class": 0,
3934
+ "vue/prefer-single-event-payload": 1,
3935
+ "vue/prefer-true-attribute-shorthand": 0,
3936
+ "vue/prefer-use-template-ref": 2,
3937
+ "vue/prefer-v-model": 1,
3938
+ "vue/require-default-export": 2,
3939
+ "vue/require-direct-export": 2,
3940
+ "vue/require-emit-validator": 0,
3941
+ "vue/require-explicit-slots": 2,
3942
+ "vue/require-expose": 2,
3943
+ "vue/require-macro-variable-name": [2, {
3944
+ defineProps: "props",
3945
+ defineEmits: "emits",
3946
+ defineSlots: "slots",
3947
+ useSlots: "slots",
3948
+ useAttrs: "attrs"
3949
+ }],
3950
+ "vue/require-name-property": 0,
3951
+ "vue/require-prop-comment": 0,
3952
+ "vue/require-typed-object-prop": 0,
3953
+ "vue/require-typed-ref": 2,
3954
+ "vue/restricted-component-names": 0,
3955
+ "vue/script-indent": [
3956
+ 0,
3957
+ preset_default.indent,
3958
+ {
3959
+ baseIndent: 0,
3960
+ switchCase: 1,
3961
+ ignores: []
3962
+ }
3963
+ ],
3964
+ "vue/slot-name-casing": 2,
3965
+ "vue/sort-keys": 0,
3966
+ "vue/static-class-names-order": 0,
3967
+ "vue/v-for-delimiter-style": 0,
3968
+ "vue/v-if-else-key": 0,
3969
+ "vue/v-on-handler-style": 0,
3970
+ "vue/array-bracket-newline": [2, "consistent"],
3971
+ "vue/array-bracket-spacing": 2,
3972
+ "vue/array-element-newline": [2, "consistent"],
3973
+ "vue/arrow-spacing": 2,
3974
+ "vue/block-spacing": 2,
3975
+ "vue/brace-style": 2,
3976
+ "vue/camelcase": 0,
3977
+ "vue/comma-dangle": [2, "always-multiline"],
3978
+ "vue/comma-spacing": 2,
3979
+ "vue/comma-style": 2,
3980
+ "vue/dot-location": 0,
3981
+ "vue/dot-notation": 0,
3982
+ "vue/eqeqeq": 2,
3983
+ "vue/func-call-spacing": 2,
3984
+ "vue/key-spacing": 2,
3985
+ "vue/keyword-spacing": 2,
3986
+ "vue/max-len": 0,
3987
+ "vue/multiline-ternary": [2, "always-multiline"],
3988
+ "vue/no-console": 0,
3989
+ "vue/no-constant-condition": 2,
3990
+ "vue/no-empty-pattern": 2,
3991
+ "vue/no-extra-parens": 0,
3992
+ "vue/no-implicit-coercion": [2, { allow: ["!!"] }],
3993
+ "vue/no-irregular-whitespace": 2,
3994
+ "vue/no-loss-of-precision": 2,
3995
+ "vue/no-negated-condition": 0,
3996
+ "vue/no-restricted-syntax": 0,
3997
+ "vue/no-sparse-arrays": 2,
3998
+ "vue/no-useless-concat": 0,
3999
+ "vue/object-curly-newline": 2,
4000
+ "vue/object-curly-spacing": [2, "always"],
4001
+ "vue/object-property-newline": [2, { allowAllPropertiesOnSameLine: true }],
4002
+ "vue/object-shorthand": 0,
4003
+ "vue/operator-linebreak": [
4004
+ 2,
4005
+ "after",
4006
+ { overrides: {
4007
+ "?": "ignore",
4008
+ ":": "ignore",
4009
+ "|": "before"
4010
+ } }
4011
+ ],
4012
+ "vue/prefer-template": 0,
4013
+ "vue/quote-props": [2, "consistent-as-needed"],
4014
+ "vue/space-in-parens": 2,
4015
+ "vue/space-infix-ops": 2,
4016
+ "vue/space-unary-ops": 2,
4017
+ "vue/template-curly-spacing": 2
4018
+ };
4019
+ //#endregion
4020
+ //#region src/globExclude.ts
11
4021
  /**
12
4022
  * 全局忽略目录列表
13
4023
  *
14
4024
  * 在 ESLint 配置中直接忽略的目录与文件 glob 集合,包含依赖、构建产物、锁文件、编辑器目录、缓存等。
4025
+ * 预设工厂(`src/config.ts`)将其作为返回数组的首项。
15
4026
  *
16
4027
  * @example
17
4028
  * ```ts
18
- * import eslintRules from "@pawover/kit-eslint-rules";
4029
+ * import { GLOB_EXCLUDE } from "@pawover/kit-eslint-rules";
19
4030
  *
20
4031
  * export default [
21
- * { ignores: eslintRules.GLOB_EXCLUDE },
4032
+ * { ignores: GLOB_EXCLUDE },
22
4033
  * // ...其余配置
23
4034
  * ];
24
4035
  * ```
@@ -57,70 +4068,224 @@ const GLOB_EXCLUDE = [
57
4068
  "**/auto-component?(s).d.ts",
58
4069
  "**/auto-router?(s).d.ts"
59
4070
  ];
60
- const rules = {
61
- javascript: core_javascript_default,
62
- typescript: core_typescript_default,
63
- react: core_react_default,
64
- reactHooks: core_reactHooks_default,
65
- vue: core_vue_default,
66
- stylistic: core_stylistic_default,
67
- antfu: core_antfu_default,
68
- imports: core_imports_default,
69
- importsSort: core_importsSort_default
4071
+ //#endregion
4072
+ //#region src/plugins.ts
4073
+ /**
4074
+ * 内嵌插件注册表
4075
+ *
4076
+ * 集中导入全部上游 ESLint 插件(作为本包 `dependencies` 精确锁定)并转换为 ESLint flat config 兼容形态,
4077
+ * 供 `src/config.ts` 装配规则组时注册。各键与规则映射中的命名空间前缀一一对应。
4078
+ */
4079
+ const plugins = {
4080
+ /** @eslint-react 插件(注册名 `react`) */
4081
+ react: eslintReact,
4082
+ /** eslint-plugin-react-hooks 插件(注册名 `react-hooks`) */
4083
+ reactHooks,
4084
+ /** eslint-plugin-vue 插件(注册名 `vue`) */
4085
+ vue,
4086
+ /** @stylistic 插件(注册名 `stylistic`) */
4087
+ stylistic,
4088
+ /** eslint-plugin-antfu 插件(注册名 `antfu`) */
4089
+ antfu,
4090
+ /** eslint-plugin-import-lite 插件(注册名 `imports`) */
4091
+ imports: importLite.configs.all.plugins?.["import-lite"],
4092
+ /** eslint-plugin-simple-import-sort 插件(注册名 `importsSort`) */
4093
+ importsSort: simpleImportSort,
4094
+ /** typescript-eslint 插件(注册名 `ts`) */
4095
+ typescript: typescriptEslint.plugin,
4096
+ /** typescript-eslint 的 TypeScript parser */
4097
+ typescriptParser: typescriptEslint.parser,
4098
+ /** vue-eslint-parser(解析 `.vue` 单文件组件) */
4099
+ vueParser: vueEslintParser
4100
+ };
4101
+ /** @eslint-react 中依赖类型信息的规则名(不含命名空间前缀) */
4102
+ const reactTypeCheckedNames = Object.keys(eslintReact.configs["disable-type-checked"].rules ?? {}).filter((ruleId) => ruleId.startsWith("@eslint-react/")).map((ruleId) => ruleId.slice(14));
4103
+ /**
4104
+ * @eslint-react 依赖类型信息的规则关闭表(`react/` 前缀 → 0)
4105
+ *
4106
+ * 自插件 `disable-type-checked` 配置动态派生;react 组未与 `typescript` 同开时,
4107
+ * 工厂据此在配置上显式关闭这些规则。
4108
+ */
4109
+ const reactTypeCheckedOff = Object.fromEntries(reactTypeCheckedNames.map((name) => [`react/${name}`, 0]));
4110
+ /**
4111
+ * `@eslint-react` 的「无类型信息」版本
4112
+ *
4113
+ * 与 `plugins.react` 相同,唯将 type-aware 规则替换为保留原 `meta`(含 schema)的 no-op 实现:
4114
+ * 未开启 `typescript` 时注册此版本,即使用户后置覆盖强制开启这些规则,
4115
+ * 执行也不会报「requires type information」,实现强制关闭。
4116
+ */
4117
+ const reactRules = plugins.react.rules ?? {};
4118
+ const reactWithoutTypeChecked = {
4119
+ ...plugins.react,
4120
+ rules: {
4121
+ ...reactRules,
4122
+ ...Object.fromEntries(reactTypeCheckedNames.flatMap((name) => {
4123
+ const rule = reactRules[name];
4124
+ return rule ? [[name, {
4125
+ ...rule,
4126
+ create: () => ({})
4127
+ }]] : [];
4128
+ }))
4129
+ }
70
4130
  };
4131
+ //#endregion
4132
+ //#region src/config.ts
4133
+ const javascript = rules$5;
4134
+ const typescript = rules$1;
4135
+ const stylistic$1 = rules$2;
4136
+ const antfu$1 = rules$8;
4137
+ const imports = rules$7;
4138
+ const importsSort = rules$6;
4139
+ const react = rules$4;
4140
+ const reactHooks$1 = rules$3;
4141
+ const vue$1 = rules;
4142
+ /** react 映射中依赖类型信息的规则 id(`react/` 前缀) */
4143
+ const reactTypeCheckedRuleIds = new Set(reactTypeCheckedNames.map((name) => `react/${name}`));
4144
+ /** react 映射中的 type-aware 规则子集(仅在 ts/tsx 层启用) */
4145
+ const reactTypeCheckedRules = Object.fromEntries([...reactTypeCheckedRuleIds].flatMap((ruleId) => {
4146
+ const rule = react[ruleId];
4147
+ return rule === void 0 ? [] : [[ruleId, rule]];
4148
+ }));
4149
+ /** react 映射中剔除 type-aware 规则后的基础规则表(作用于全部源文件) */
4150
+ const reactBase = Object.fromEntries(Object.entries(react).filter(([ruleId]) => !reactTypeCheckedRuleIds.has(ruleId)));
4151
+ /** 全部源文件(js / cjs / mjs / jsx / ts / tsx) */
4152
+ const GLOB_SOURCE = ["**/*.{js,cjs,mjs,jsx,ts,tsx}"];
4153
+ /** TypeScript 源文件(ts / tsx) */
4154
+ const GLOB_TYPESCRIPT = ["**/*.{ts,tsx}"];
4155
+ /** Vue 单文件组件 */
4156
+ const GLOB_VUE = "**/*.vue";
4157
+ /** JSX 组件文件(react type-aware 规则的检查对象;类型可用性由项目 tsconfig 的 include/allowJs 决定) */
4158
+ const GLOB_JSX = "**/*.jsx";
71
4159
  /**
72
- * 创建规则集合
4160
+ * 创建 ESLint flat config 预设
73
4161
  *
74
- * 从已有规则组中取出全部规则;传入 `prefix` 时会将规则名的命名空间前缀改写为目标前缀(如 `react/*` → `react-hooks/*`)。
4162
+ * 返回可直接用于 `eslint.config.js` 的 flat config 数组:首项为全局忽略(`GLOB_EXCLUDE`),随后为常开的 `javascript` 基础层与按选项启用的各规则组层。
4163
+ * 全部上游插件已作为本包依赖精确锁定并自动注册,无需用户另行安装或注册插件。
75
4164
  *
76
- * @param rule 规则组名称(`"javascript"` | `"typescript"` | `"react"` | `"reactHooks"` | `"vue"` | `"stylistic"` | `"antfu"` | `"imports"` | `"importsSort"`)
77
- * @param prefix 目标命名空间前缀(可选,格式为 `name/`,如 `"react-hooks"`)
78
- * @returns 规则名到规则配置的映射;规则组不存在时返回空对象
4165
+ * @param options 预设选项;缺省时仅返回忽略层与 `javascript` 基础层
4166
+ * @returns flat config 配置数组
79
4167
  *
80
4168
  * @example
81
4169
  * ```ts
82
- * // 不传 prefix:返回原规则组
83
- * const tsRules = createRules("typescript");
84
- *
85
- * // 传 prefix:改写命名空间前缀
86
- * const reactHooksRules = createRules("react", "react-hooks");
87
- * // { "react-hooks/display-name": 2, ... }
4170
+ * // TypeScript + React 项目
4171
+ * import pawover from "@pawover/kit-eslint-rules";
88
4172
  *
89
- * // 非法规则组:返回空对象
90
- * const empty = createRules("unknown");
4173
+ * export default pawover({
4174
+ * typescript: true,
4175
+ * react: true,
4176
+ * parserOptions: { tsconfigRootDir: import.meta.dirname },
4177
+ * });
91
4178
  * ```
92
- */
93
- function createRules(rule, prefix) {
94
- const result = {};
95
- if (typeof rule === "string" && rule in rules) if (prefix) return Object.entries(rules[rule]).reduce((acc, [key, value]) => {
96
- const oldPrefix = key.split("/")[0];
97
- const newPrefix = prefix.split("/")[0];
98
- const newKey = key.replace(`${oldPrefix}/`, `${newPrefix}/`);
99
- acc[newKey] = value;
100
- return acc;
101
- }, result);
102
- else return rules[rule];
103
- return result;
104
- }
105
- /**
106
- * 默认导出
107
4179
  *
108
- * 聚合全部规则组与工具:`javascript`、`typescript`、`react`、`reactHooks`、`vue`、`stylistic`、`antfu`、`imports`、`importsSort`、`GLOB_EXCLUDE`、`createRules`。
4180
+ * @example
4181
+ * ```ts
4182
+ * // Vue 项目(Vue SFC + TypeScript)
4183
+ * import pawover from "@pawover/kit-eslint-rules";
4184
+ *
4185
+ * export default pawover({ typescript: true, vue: true });
4186
+ * ```
109
4187
  *
110
4188
  * @example
111
4189
  * ```ts
112
- * import eslintRules from "@pawover/kit-eslint-rules";
4190
+ * // 后置覆盖:在预设之后追加自定义配置层
4191
+ * import pawover from "@pawover/kit-eslint-rules";
113
4192
  *
114
4193
  * export default [
115
- * { ignores: eslintRules.GLOB_EXCLUDE },
116
- * { files: ["*.ts", "*.tsx"], rules: { ...eslintRules.javascript, ...eslintRules.typescript } },
4194
+ * ...pawover({ typescript: true }),
4195
+ * { rules: { "ts/no-explicit-any": 0 } },
117
4196
  * ];
118
4197
  * ```
119
4198
  */
120
- var src_default = {
121
- ...rules,
122
- GLOB_EXCLUDE,
123
- createRules
124
- };
4199
+ function pawover(options = {}) {
4200
+ const { typescript: enableTypescript = false, stylistic: enableStylistic = false, antfu: enableAntfu = false, imports: enableImports = false, importsSort: enableImportsSort = false, react: enableReact = false, vue: enableVue = false, parserOptions } = options;
4201
+ const sourceFiles = enableVue ? [...GLOB_SOURCE, GLOB_VUE] : [...GLOB_SOURCE];
4202
+ const typescriptParserOptions = {
4203
+ projectService: true,
4204
+ ...parserOptions
4205
+ };
4206
+ const configs = [{ ignores: [...GLOB_EXCLUDE] }, {
4207
+ files: [...sourceFiles],
4208
+ languageOptions: {
4209
+ ecmaVersion: "latest",
4210
+ sourceType: "module",
4211
+ parserOptions: { ecmaFeatures: { jsx: true } }
4212
+ },
4213
+ rules: javascript
4214
+ }];
4215
+ if (enableTypescript) {
4216
+ const typescriptRuleFiles = enableVue ? [...GLOB_TYPESCRIPT, GLOB_VUE] : [...GLOB_TYPESCRIPT];
4217
+ const typescriptParserFiles = enableReact ? [...typescriptRuleFiles, GLOB_JSX] : [...typescriptRuleFiles];
4218
+ configs.push({
4219
+ files: [...typescriptParserFiles],
4220
+ languageOptions: {
4221
+ parser: plugins.typescriptParser,
4222
+ parserOptions: { ...typescriptParserOptions }
4223
+ }
4224
+ });
4225
+ configs.push({
4226
+ files: [...typescriptRuleFiles],
4227
+ plugins: { ts: plugins.typescript },
4228
+ rules: typescript
4229
+ });
4230
+ }
4231
+ if (enableStylistic) configs.push({
4232
+ files: [...sourceFiles],
4233
+ plugins: { stylistic: plugins.stylistic },
4234
+ rules: stylistic$1
4235
+ });
4236
+ if (enableAntfu) configs.push({
4237
+ files: [...sourceFiles],
4238
+ plugins: { antfu: plugins.antfu },
4239
+ rules: antfu$1
4240
+ });
4241
+ if (enableImports) configs.push({
4242
+ files: [...sourceFiles],
4243
+ plugins: { imports: plugins.imports },
4244
+ rules: imports
4245
+ });
4246
+ if (enableImportsSort) configs.push({
4247
+ files: [...sourceFiles],
4248
+ plugins: { importsSort: plugins.importsSort },
4249
+ rules: importsSort
4250
+ });
4251
+ if (enableReact) {
4252
+ configs.push({
4253
+ files: [...GLOB_SOURCE],
4254
+ plugins: {
4255
+ "react": enableTypescript ? plugins.react : reactWithoutTypeChecked,
4256
+ "react-hooks": plugins.reactHooks
4257
+ },
4258
+ rules: enableTypescript ? {
4259
+ ...reactBase,
4260
+ ...reactHooks$1
4261
+ } : {
4262
+ ...reactBase,
4263
+ ...reactHooks$1,
4264
+ ...reactTypeCheckedOff
4265
+ }
4266
+ });
4267
+ if (enableTypescript) configs.push({
4268
+ files: [...GLOB_TYPESCRIPT, GLOB_JSX],
4269
+ plugins: { react: plugins.react },
4270
+ rules: { ...reactTypeCheckedRules }
4271
+ });
4272
+ }
4273
+ if (enableVue) configs.push({
4274
+ files: [GLOB_VUE],
4275
+ languageOptions: {
4276
+ parser: plugins.vueParser,
4277
+ parserOptions: enableTypescript ? {
4278
+ parser: plugins.typescriptParser,
4279
+ ...typescriptParserOptions
4280
+ } : {}
4281
+ },
4282
+ plugins: { vue: plugins.vue },
4283
+ rules: vue$1
4284
+ });
4285
+ return configs;
4286
+ }
4287
+ //#endregion
4288
+ //#region src/index.ts
4289
+ var src_default = pawover;
125
4290
  //#endregion
126
- export { src_default as default };
4291
+ export { GLOB_EXCLUDE, src_default as default };