@pawover/kit-eslint-rules 0.0.6-alpha.0 → 0.1.0-alpha.2

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