@fast-china/eslint-config 2.0.2 → 2.0.4

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 (127) hide show
  1. package/CHANGELOG.md +23 -1
  2. package/README.md +77 -18
  3. package/README.zh.md +77 -18
  4. package/dist/configs/angular.d.mts +41 -0
  5. package/dist/configs/angular.d.mts.map +1 -0
  6. package/dist/configs/angular.mjs +33 -0
  7. package/dist/configs/angular.mjs.map +1 -0
  8. package/dist/configs/common.d.mts +11 -0
  9. package/dist/configs/common.d.mts.map +1 -0
  10. package/dist/configs/common.mjs +20 -0
  11. package/dist/configs/common.mjs.map +1 -0
  12. package/dist/configs/environment.d.mts +61 -0
  13. package/dist/configs/environment.d.mts.map +1 -0
  14. package/dist/configs/environment.mjs +33 -0
  15. package/dist/configs/environment.mjs.map +1 -0
  16. package/dist/configs/ignores.d.mts +15 -0
  17. package/dist/configs/ignores.d.mts.map +1 -0
  18. package/dist/configs/ignores.mjs +32 -0
  19. package/dist/configs/ignores.mjs.map +1 -0
  20. package/dist/configs/import.d.mts +11 -0
  21. package/dist/configs/import.d.mts.map +1 -0
  22. package/dist/configs/import.mjs +21 -0
  23. package/dist/configs/import.mjs.map +1 -0
  24. package/dist/configs/index.d.mts +17 -0
  25. package/dist/configs/index.mjs +17 -0
  26. package/dist/configs/javascript.d.mts +10 -0
  27. package/dist/configs/javascript.d.mts.map +1 -0
  28. package/dist/configs/javascript.mjs +24 -0
  29. package/dist/configs/javascript.mjs.map +1 -0
  30. package/dist/configs/json.d.mts +10 -0
  31. package/dist/configs/json.d.mts.map +1 -0
  32. package/dist/configs/json.mjs +35 -0
  33. package/dist/configs/json.mjs.map +1 -0
  34. package/dist/configs/lodash.d.mts +12 -0
  35. package/dist/configs/lodash.d.mts.map +1 -0
  36. package/dist/configs/lodash.mjs +18 -0
  37. package/dist/configs/lodash.mjs.map +1 -0
  38. package/dist/configs/markdown.d.mts +10 -0
  39. package/dist/configs/markdown.d.mts.map +1 -0
  40. package/dist/configs/markdown.mjs +18 -0
  41. package/dist/configs/markdown.mjs.map +1 -0
  42. package/dist/configs/prettier.d.mts +11 -0
  43. package/dist/configs/prettier.d.mts.map +1 -0
  44. package/dist/configs/prettier.mjs +17 -0
  45. package/dist/configs/prettier.mjs.map +1 -0
  46. package/dist/configs/react.d.mts +86 -0
  47. package/dist/configs/react.d.mts.map +1 -0
  48. package/dist/configs/react.mjs +31 -0
  49. package/dist/configs/react.mjs.map +1 -0
  50. package/dist/configs/regexp.d.mts +11 -0
  51. package/dist/configs/regexp.d.mts.map +1 -0
  52. package/dist/configs/regexp.mjs +19 -0
  53. package/dist/configs/regexp.mjs.map +1 -0
  54. package/dist/configs/sort-package.d.mts +11 -0
  55. package/dist/configs/sort-package.d.mts.map +1 -0
  56. package/dist/configs/sort-package.mjs +18 -0
  57. package/dist/configs/sort-package.mjs.map +1 -0
  58. package/dist/configs/sort-tsconfig.d.mts +10 -0
  59. package/dist/configs/sort-tsconfig.d.mts.map +1 -0
  60. package/dist/configs/sort-tsconfig.mjs +18 -0
  61. package/dist/configs/sort-tsconfig.mjs.map +1 -0
  62. package/dist/configs/typescript.d.mts +60 -0
  63. package/dist/configs/typescript.d.mts.map +1 -0
  64. package/dist/configs/typescript.mjs +44 -0
  65. package/dist/configs/typescript.mjs.map +1 -0
  66. package/dist/configs/vue.d.mts +43 -0
  67. package/dist/configs/vue.d.mts.map +1 -0
  68. package/dist/configs/vue.mjs +50 -0
  69. package/dist/configs/vue.mjs.map +1 -0
  70. package/dist/constants/index.d.mts +34 -0
  71. package/dist/constants/index.d.mts.map +1 -0
  72. package/dist/constants/index.mjs +52 -0
  73. package/dist/constants/index.mjs.map +1 -0
  74. package/dist/index.d.mts +20 -147
  75. package/dist/index.d.mts.map +1 -1
  76. package/dist/index.mjs +31 -402
  77. package/dist/index.mjs.map +1 -1
  78. package/dist/rules/angular.d.mts +46 -0
  79. package/dist/rules/angular.d.mts.map +1 -0
  80. package/dist/rules/angular.mjs +47 -0
  81. package/dist/rules/angular.mjs.map +1 -0
  82. package/dist/rules/common.d.mts +32 -0
  83. package/dist/rules/common.d.mts.map +1 -0
  84. package/dist/rules/common.mjs +38 -0
  85. package/dist/rules/common.mjs.map +1 -0
  86. package/dist/rules/import.d.mts +24 -0
  87. package/dist/rules/import.d.mts.map +1 -0
  88. package/dist/rules/import.mjs +35 -0
  89. package/dist/rules/import.mjs.map +1 -0
  90. package/dist/rules/index.d.mts +12 -309
  91. package/dist/rules/index.mjs +10 -1
  92. package/dist/rules/javascript.d.mts +48 -0
  93. package/dist/rules/javascript.d.mts.map +1 -0
  94. package/dist/rules/javascript.mjs +49 -0
  95. package/dist/rules/javascript.mjs.map +1 -0
  96. package/dist/rules/lodash.d.mts +40 -0
  97. package/dist/rules/lodash.d.mts.map +1 -0
  98. package/dist/rules/lodash.mjs +43 -0
  99. package/dist/rules/lodash.mjs.map +1 -0
  100. package/dist/rules/react.d.mts +26 -0
  101. package/dist/rules/react.d.mts.map +1 -0
  102. package/dist/rules/react.mjs +27 -0
  103. package/dist/rules/react.mjs.map +1 -0
  104. package/dist/rules/sort-package.d.mts +32 -0
  105. package/dist/rules/sort-package.d.mts.map +1 -0
  106. package/dist/rules/sort-package.mjs +75 -0
  107. package/dist/rules/sort-package.mjs.map +1 -0
  108. package/dist/rules/sort-tsconfig.d.mts +20 -0
  109. package/dist/rules/sort-tsconfig.d.mts.map +1 -0
  110. package/dist/rules/sort-tsconfig.mjs +122 -0
  111. package/dist/rules/sort-tsconfig.mjs.map +1 -0
  112. package/dist/rules/typescript.d.mts +34 -0
  113. package/dist/rules/typescript.d.mts.map +1 -0
  114. package/dist/rules/typescript.mjs +35 -0
  115. package/dist/rules/typescript.mjs.map +1 -0
  116. package/dist/rules/vue.d.mts +24 -0
  117. package/dist/rules/vue.d.mts.map +1 -0
  118. package/dist/rules/vue.mjs +33 -0
  119. package/dist/rules/vue.mjs.map +1 -0
  120. package/dist/typegen.d.mts +1 -1
  121. package/docs/engineering-audit.zh.md +25 -23
  122. package/docs/rules-risk.md +3 -3
  123. package/docs/rules-risk.zh.md +3 -3
  124. package/package.json +16 -6
  125. package/dist/rules/index.d.mts.map +0 -1
  126. package/dist/rules.mjs +0 -477
  127. package/dist/rules.mjs.map +0 -1
package/dist/rules.mjs DELETED
@@ -1,477 +0,0 @@
1
- //#region src/rules/angular.ts
2
- /**
3
- * Angular TypeScript 推荐规则。
4
- *
5
- * Angular ESLint 的拆分插件不直接导出 Flat Config 预置;本记录与 angular-eslint
6
- * 22.x 的 `tsRecommended` 保持一致,并逐条说明启用理由。
7
- */
8
- const angularRules = {
9
- "@angular-eslint/contextual-lifecycle": "error",
10
- "@angular-eslint/no-empty-lifecycle-method": "error",
11
- "@angular-eslint/no-input-rename": "error",
12
- "@angular-eslint/no-inputs-metadata-property": "error",
13
- "@angular-eslint/no-output-native": "error",
14
- "@angular-eslint/no-output-on-prefix": "error",
15
- "@angular-eslint/no-output-rename": "error",
16
- "@angular-eslint/no-outputs-metadata-property": "error",
17
- "@angular-eslint/prefer-inject": "error",
18
- "@angular-eslint/prefer-on-push-component-change-detection": "error",
19
- "@angular-eslint/prefer-standalone": "error",
20
- "@angular-eslint/use-pipe-transform-interface": "error",
21
- "@angular-eslint/use-lifecycle-interface": "warn"
22
- };
23
- /** Angular HTML 模板推荐规则,与 angular-eslint 22.x 的 `templateRecommended` 对齐。 */
24
- const angularTemplateRules = {
25
- "@angular-eslint/template/banana-in-box": "error",
26
- "@angular-eslint/template/eqeqeq": "error",
27
- "@angular-eslint/template/no-negated-async": "error",
28
- "@angular-eslint/template/prefer-control-flow": "error"
29
- };
30
- /** Angular 模板无障碍规则;可通过 `angular.templateAccessibility` 整组关闭。 */
31
- const angularTemplateAccessibilityRules = {
32
- "@angular-eslint/template/alt-text": "error",
33
- "@angular-eslint/template/click-events-have-key-events": "error",
34
- "@angular-eslint/template/elements-content": "error",
35
- "@angular-eslint/template/interactive-supports-focus": "error",
36
- "@angular-eslint/template/label-has-associated-control": "error",
37
- "@angular-eslint/template/mouse-events-have-key-events": "error",
38
- "@angular-eslint/template/no-autofocus": "error",
39
- "@angular-eslint/template/no-distracting-elements": "error",
40
- "@angular-eslint/template/role-has-required-aria": "error",
41
- "@angular-eslint/template/table-scope": "error",
42
- "@angular-eslint/template/valid-aria": "error"
43
- };
44
- //#endregion
45
- //#region src/rules/common.ts
46
- /**
47
- * 跨 JavaScript、TypeScript 与 Vue 脚本生效的公共规则。
48
- *
49
- * 维护约定:每条本地覆写都要说明启用原因;可能造成大面积改动、采用成本或
50
- * 行为变化的规则使用 `[高影响]` 标记,并同步维护 `docs/rules-risk.zh.md`。
51
- */
52
- const commonRules = {
53
- "array-callback-return": "error",
54
- "no-alert": "warn",
55
- "no-case-declarations": "error",
56
- "no-multi-str": "error",
57
- "no-with": "error",
58
- "no-void": ["error", { allowAsStatement: true }],
59
- eqeqeq: [
60
- "error",
61
- "always",
62
- { null: "ignore" }
63
- ],
64
- "prefer-exponentiation-operator": "error",
65
- "prefer-object-has-own": "error",
66
- "sort-imports": ["warn", {
67
- ignoreCase: false,
68
- ignoreDeclarationSort: true,
69
- ignoreMemberSort: false,
70
- memberSyntaxSortOrder: [
71
- "none",
72
- "all",
73
- "multiple",
74
- "single"
75
- ],
76
- allowSeparatedGroups: false
77
- }]
78
- };
79
- //#endregion
80
- //#region src/rules/import.ts
81
- /** 默认启用的模块导入正确性与排序规则。 */
82
- const importRules = {
83
- "import-x/first": "error",
84
- "import-x/no-duplicates": "error",
85
- "import-x/order": ["error", {
86
- groups: [
87
- "builtin",
88
- "external",
89
- "internal",
90
- "parent",
91
- "sibling",
92
- "index",
93
- "object",
94
- "type",
95
- "unknown"
96
- ],
97
- "newlines-between": "always",
98
- alphabetize: {
99
- order: "asc",
100
- caseInsensitive: true
101
- },
102
- warnOnUnassignedImports: true
103
- }],
104
- "import-x/no-unresolved": "off",
105
- "import-x/namespace": "off",
106
- "import-x/default": "off",
107
- "import-x/no-named-as-default": "off",
108
- "import-x/no-named-as-default-member": "off",
109
- "import-x/named": "off"
110
- };
111
- //#endregion
112
- //#region src/rules/javascript.ts
113
- /**
114
- * JavaScript 本地覆写规则。
115
- * 高影响规则的解释与关闭方式见 `docs/rules-risk.zh.md`。
116
- */
117
- const javascriptRules = {
118
- "no-console": ["warn", { allow: ["warn", "error"] }],
119
- "no-debugger": "error",
120
- "no-constant-condition": ["error", { checkLoops: false }],
121
- "no-restricted-syntax": ["error", "LabeledStatement"],
122
- "no-var": "error",
123
- "no-empty": ["error", { allowEmptyCatch: true }],
124
- "no-irregular-whitespace": "error",
125
- "no-use-before-define": ["warn", {
126
- classes: true,
127
- functions: false,
128
- variables: true
129
- }],
130
- "prefer-const": ["warn", {
131
- destructuring: "all",
132
- ignoreReadBeforeAssign: true
133
- }],
134
- "prefer-arrow-callback": ["error", {
135
- allowNamedFunctions: false,
136
- allowUnboundThis: true
137
- }],
138
- "object-shorthand": [
139
- "error",
140
- "always",
141
- {
142
- ignoreConstructors: false,
143
- avoidQuotes: true
144
- }
145
- ],
146
- "logical-assignment-operators": [
147
- "error",
148
- "always",
149
- { enforceForIfStatements: true }
150
- ],
151
- "prefer-object-spread": "error",
152
- "prefer-rest-params": "error",
153
- "prefer-spread": "error",
154
- "prefer-template": "error",
155
- "no-redeclare": "error"
156
- };
157
- //#endregion
158
- //#region src/rules/lodash.ts
159
- /**
160
- * 统一使用 `lodash-unified` 的可选导入策略。
161
- *
162
- * 该规则只约束静态 import/export 的模块来源,不会安装依赖,也不会检查动态
163
- * `import()` 或 CommonJS `require()`。选择此策略的项目应自行安装 `lodash-unified`。
164
- */
165
- const preferLodashUnifiedRules = { "no-restricted-imports": ["error", {
166
- paths: [{
167
- name: "lodash",
168
- message: "Use \"lodash-unified\" consistently instead of \"lodash\"."
169
- }, {
170
- name: "lodash-es",
171
- message: "Use \"lodash-unified\" consistently instead of \"lodash-es\"."
172
- }],
173
- patterns: [{
174
- group: ["lodash/*", "lodash-es/*"],
175
- message: "Use exports from \"lodash-unified\" instead of Lodash subpath imports."
176
- }]
177
- }] };
178
- /**
179
- * 统一使用 `lodash` 的可选导入策略。
180
- *
181
- * 根入口和 `lodash/*` 子路径都允许使用;规则只负责避免与 `lodash-es` 或
182
- * `lodash-unified` 混用,不替项目决定整包导入或按方法导入。
183
- */
184
- const preferLodashRules = { "no-restricted-imports": ["error", {
185
- paths: [{
186
- name: "lodash-es",
187
- message: "Use \"lodash\" consistently instead of \"lodash-es\"."
188
- }, {
189
- name: "lodash-unified",
190
- message: "Use \"lodash\" consistently instead of \"lodash-unified\"."
191
- }],
192
- patterns: [{
193
- group: ["lodash-es/*", "lodash-unified/*"],
194
- message: "Use \"lodash\" or a \"lodash/*\" subpath consistently."
195
- }]
196
- }] };
197
- //#endregion
198
- //#region src/rules/react.ts
199
- /**
200
- * React 本地覆写规则。
201
- *
202
- * `@eslint-react/recommended*` 负责组件、JSX、DOM 与 Web API 正确性,
203
- * `react-hooks/recommended` 负责 React 官方 Hooks 与 Compiler 诊断。这里关闭两套
204
- * 预置间的重复诊断,并补充少量明确的 DOM 安全约束。
205
- */
206
- const reactRules = {
207
- "@eslint-react/error-boundaries": "off",
208
- "@eslint-react/exhaustive-deps": "off",
209
- "@eslint-react/purity": "off",
210
- "@eslint-react/rules-of-hooks": "off",
211
- "@eslint-react/set-state-in-effect": "off",
212
- "@eslint-react/set-state-in-render": "off",
213
- "@eslint-react/static-components": "off",
214
- "@eslint-react/unsupported-syntax": "off",
215
- "@eslint-react/use-memo": "off",
216
- "@eslint-react/dom-no-missing-button-type": "error",
217
- "@eslint-react/dom-no-missing-iframe-sandbox": "warn",
218
- "@eslint-react/dom-no-unknown-property": "error",
219
- "@eslint-react/dom-no-unsafe-target-blank": "error"
220
- };
221
- //#endregion
222
- //#region src/rules/sort-package.ts
223
- /**
224
- * package.json 属性排序规则。
225
- *
226
- * `[高影响][可自动修复]`:仅在 `sortPackageJson: true` 时启用,首次修复可能重排大量字段。
227
- * 注意:这里故意不排序 `exports` 内部键;条件导出的键顺序具有模块解析语义。
228
- */
229
- const packageJsonSortRules = {
230
- "jsonc/sort-array-values": ["error", {
231
- order: { type: "asc" },
232
- pathPattern: "^files$"
233
- }],
234
- "jsonc/sort-keys": [
235
- "error",
236
- {
237
- order: [
238
- "name",
239
- "version",
240
- "private",
241
- "packageManager",
242
- "description",
243
- "type",
244
- "keywords",
245
- "license",
246
- "homepage",
247
- "bugs",
248
- "repository",
249
- "author",
250
- "contributors",
251
- "funding",
252
- "files",
253
- "main",
254
- "module",
255
- "types",
256
- "exports",
257
- "typesVersions",
258
- "sideEffects",
259
- "unpkg",
260
- "jsdelivr",
261
- "browser",
262
- "bin",
263
- "man",
264
- "directories",
265
- "publishConfig",
266
- "scripts",
267
- "peerDependencies",
268
- "peerDependenciesMeta",
269
- "optionalDependencies",
270
- "dependencies",
271
- "devDependencies",
272
- "engines",
273
- "config",
274
- "overrides",
275
- "pnpm",
276
- "husky",
277
- "lint-staged",
278
- "eslintConfig",
279
- "prettier"
280
- ],
281
- pathPattern: "^$"
282
- },
283
- {
284
- order: { type: "asc" },
285
- pathPattern: "^(?:dev|peer|optional|bundled)?[Dd]ependencies(Meta)?$"
286
- },
287
- {
288
- order: { type: "asc" },
289
- pathPattern: "^(?:resolutions|overrides|pnpm.overrides)$"
290
- }
291
- ]
292
- };
293
- //#endregion
294
- //#region src/rules/sort-tsconfig.ts
295
- /**
296
- * tsconfig.json 属性排序规则。
297
- *
298
- * `[高影响][可自动修复]`:仅在 `sortTsconfig: true` 时启用,首次修复会重排大量字段,
299
- * 但只改变 JSONC 的阅读顺序,不改变 TypeScript 编译选项值。
300
- */
301
- const tsconfigJsonSortRules = {
302
- "jsonc/no-comments": "off",
303
- "jsonc/sort-keys": [
304
- "error",
305
- {
306
- order: [
307
- "extends",
308
- "compilerOptions",
309
- "references",
310
- "files",
311
- "include",
312
- "exclude"
313
- ],
314
- pathPattern: "^$"
315
- },
316
- {
317
- order: [
318
- "incremental",
319
- "composite",
320
- "tsBuildInfoFile",
321
- "disableSourceOfProjectReferenceRedirect",
322
- "disableSolutionSearching",
323
- "disableReferencedProjectLoad",
324
- "target",
325
- "jsx",
326
- "jsxFactory",
327
- "jsxFragmentFactory",
328
- "jsxImportSource",
329
- "lib",
330
- "moduleDetection",
331
- "noLib",
332
- "reactNamespace",
333
- "useDefineForClassFields",
334
- "emitDecoratorMetadata",
335
- "experimentalDecorators",
336
- "baseUrl",
337
- "rootDir",
338
- "rootDirs",
339
- "customConditions",
340
- "module",
341
- "moduleResolution",
342
- "moduleSuffixes",
343
- "noResolve",
344
- "paths",
345
- "resolveJsonModule",
346
- "resolvePackageJsonExports",
347
- "resolvePackageJsonImports",
348
- "typeRoots",
349
- "types",
350
- "allowArbitraryExtensions",
351
- "allowImportingTsExtensions",
352
- "allowUmdGlobalAccess",
353
- "allowJs",
354
- "checkJs",
355
- "maxNodeModuleJsDepth",
356
- "strict",
357
- "strictBindCallApply",
358
- "strictFunctionTypes",
359
- "strictNullChecks",
360
- "strictPropertyInitialization",
361
- "allowUnreachableCode",
362
- "allowUnusedLabels",
363
- "alwaysStrict",
364
- "exactOptionalPropertyTypes",
365
- "noFallthroughCasesInSwitch",
366
- "noImplicitAny",
367
- "noImplicitOverride",
368
- "noImplicitReturns",
369
- "noImplicitThis",
370
- "noPropertyAccessFromIndexSignature",
371
- "noUncheckedIndexedAccess",
372
- "noUnusedLocals",
373
- "noUnusedParameters",
374
- "useUnknownInCatchVariables",
375
- "declaration",
376
- "declarationDir",
377
- "declarationMap",
378
- "downlevelIteration",
379
- "emitBOM",
380
- "emitDeclarationOnly",
381
- "importHelpers",
382
- "importsNotUsedAsValues",
383
- "inlineSourceMap",
384
- "inlineSources",
385
- "isolatedDeclarations",
386
- "mapRoot",
387
- "newLine",
388
- "noEmit",
389
- "noEmitHelpers",
390
- "noEmitOnError",
391
- "outDir",
392
- "outFile",
393
- "preserveConstEnums",
394
- "preserveValueImports",
395
- "removeComments",
396
- "sourceMap",
397
- "sourceRoot",
398
- "stripInternal",
399
- "allowSyntheticDefaultImports",
400
- "esModuleInterop",
401
- "forceConsistentCasingInFileNames",
402
- "isolatedModules",
403
- "preserveSymlinks",
404
- "verbatimModuleSyntax",
405
- "skipDefaultLibCheck",
406
- "skipLibCheck"
407
- ],
408
- pathPattern: "^compilerOptions$"
409
- }
410
- ]
411
- };
412
- //#endregion
413
- //#region src/rules/typescript.ts
414
- /**
415
- * TypeScript 本地覆写规则。
416
- * 这里补充 typescript-eslint 预置;高影响规则需同步维护风险文档。
417
- */
418
- const typescriptRules = {
419
- "@typescript-eslint/no-redeclare": "error",
420
- "@typescript-eslint/no-unused-vars": ["error", {
421
- args: "after-used",
422
- argsIgnorePattern: "^_",
423
- caughtErrors: "all",
424
- caughtErrorsIgnorePattern: "^_",
425
- ignoreRestSiblings: true,
426
- varsIgnorePattern: "^_"
427
- }],
428
- "@typescript-eslint/no-namespace": "off",
429
- "@typescript-eslint/no-explicit-any": "warn",
430
- "@typescript-eslint/no-require-imports": "error",
431
- "@typescript-eslint/no-unused-expressions": ["error", {
432
- allowShortCircuit: true,
433
- allowTernary: true
434
- }],
435
- "@typescript-eslint/no-inferrable-types": "error",
436
- "@typescript-eslint/no-non-null-assertion": "warn",
437
- "@typescript-eslint/no-non-null-asserted-optional-chain": "error",
438
- "@typescript-eslint/consistent-type-imports": ["error", {
439
- disallowTypeAnnotations: false,
440
- fixStyle: "inline-type-imports",
441
- prefer: "type-imports"
442
- }]
443
- };
444
- //#endregion
445
- //#region src/rules/vue.ts
446
- /**
447
- * Vue SFC 本地覆写规则。
448
- * 上游 `flat/recommended` 已覆盖基础正确性,这里只记录项目取舍与附加约束。
449
- */
450
- const vueRules = {
451
- "vue/no-v-html": "warn",
452
- "vue/require-default-prop": "off",
453
- "vue/require-explicit-emits": "error",
454
- "vue/multi-word-component-names": "off",
455
- "vue/prefer-import-from-vue": "warn",
456
- "vue/no-dupe-keys": "error",
457
- "vue/no-mutating-props": "error",
458
- "vue/no-reserved-component-names": "error",
459
- "vue/no-v-text-v-html-on-component": "error",
460
- "vue/custom-event-name-casing": ["error", "camelCase"],
461
- "vue/one-component-per-file": "off",
462
- "vue/attributes-order": ["error", { order: [
463
- "DEFINITION",
464
- "LIST_RENDERING",
465
- "CONDITIONALS",
466
- "RENDER_MODIFIERS",
467
- "GLOBAL",
468
- "UNIQUE",
469
- "OTHER_ATTR",
470
- "EVENTS",
471
- "CONTENT"
472
- ] }]
473
- };
474
- //#endregion
475
- export { reactRules as a, javascriptRules as c, angularRules as d, angularTemplateAccessibilityRules as f, packageJsonSortRules as i, importRules as l, typescriptRules as n, preferLodashRules as o, angularTemplateRules as p, tsconfigJsonSortRules as r, preferLodashUnifiedRules as s, vueRules as t, commonRules as u };
476
-
477
- //# sourceMappingURL=rules.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"rules.mjs","names":[],"sources":["../src/rules/angular.ts","../src/rules/common.ts","../src/rules/import.ts","../src/rules/javascript.ts","../src/rules/lodash.ts","../src/rules/react.ts","../src/rules/sort-package.ts","../src/rules/sort-tsconfig.ts","../src/rules/typescript.ts","../src/rules/vue.ts"],"sourcesContent":["import type { RuleOptions } from \"../typegen\";\n\n/**\n * Angular TypeScript 推荐规则。\n *\n * Angular ESLint 的拆分插件不直接导出 Flat Config 预置;本记录与 angular-eslint\n * 22.x 的 `tsRecommended` 保持一致,并逐条说明启用理由。\n */\nexport const angularRules = {\n\t// 生命周期方法只能出现在对应的 Angular 组件或指令上下文中,避免无效钩子。\n\t\"@angular-eslint/contextual-lifecycle\": \"error\",\n\t// 空生命周期方法没有行为且容易误导维护者,应直接移除。\n\t\"@angular-eslint/no-empty-lifecycle-method\": \"error\",\n\t// Input 别名会让模板 API 与类属性名称分离,增加搜索和重构成本。\n\t\"@angular-eslint/no-input-rename\": \"error\",\n\t// 统一使用 input()/@Input 声明输入,避免与 metadata 数组混用两套 API。\n\t\"@angular-eslint/no-inputs-metadata-property\": \"error\",\n\t// 输出名称不得覆盖原生 DOM 事件,否则模板事件含义容易混淆。\n\t\"@angular-eslint/no-output-native\": \"error\",\n\t// 输出本身已经表达事件语义,不使用 on 前缀以保持 Angular 公共 API 约定。\n\t\"@angular-eslint/no-output-on-prefix\": \"error\",\n\t// Output 别名会让模板 API 与类属性名称分离,增加搜索和重构成本。\n\t\"@angular-eslint/no-output-rename\": \"error\",\n\t// 统一使用 output()/@Output 声明输出,避免与 metadata 数组混用两套 API。\n\t\"@angular-eslint/no-outputs-metadata-property\": \"error\",\n\t// [高影响][按需启用] Angular 22 推荐 inject(),旧构造器注入代码启用框架后可能集中报错。\n\t\"@angular-eslint/prefer-inject\": \"error\",\n\t// [高影响][按需启用] OnPush 改变变更检测边界,修复时必须验证状态更新与视图刷新。\n\t\"@angular-eslint/prefer-on-push-component-change-detection\": \"error\",\n\t// [高影响][按需启用] 独立组件是现代 Angular 默认模型,旧 NgModule 项目需规划后再迁移。\n\t\"@angular-eslint/prefer-standalone\": \"error\",\n\t// Pipe 类实现接口后可由 TypeScript 检查 transform 签名,避免运行时才发现不一致。\n\t\"@angular-eslint/use-pipe-transform-interface\": \"error\",\n\t// 生命周期接口让方法拼写和签名可由 TypeScript 验证;warn 便于渐进补齐旧代码。\n\t\"@angular-eslint/use-lifecycle-interface\": \"warn\",\n} satisfies RuleOptions;\n\n/** Angular HTML 模板推荐规则,与 angular-eslint 22.x 的 `templateRecommended` 对齐。 */\nexport const angularTemplateRules = {\n\t// 双向绑定必须使用 [(...)] 顺序,反写的“香蕉盒”通常是模板笔误。\n\t\"@angular-eslint/template/banana-in-box\": \"error\",\n\t// 模板比较使用严格等号,避免 Angular 表达式中的隐式类型转换。\n\t\"@angular-eslint/template/eqeqeq\": \"error\",\n\t// 对 async pipe 结果直接取反会让初始 null 状态产生反直觉分支。\n\t\"@angular-eslint/template/no-negated-async\": \"error\",\n\t// [高影响][按需启用] 统一采用现代 @if/@for 控制流,旧模板启用后需要规划迁移。\n\t\"@angular-eslint/template/prefer-control-flow\": \"error\",\n} satisfies RuleOptions;\n\n/** Angular 模板无障碍规则;可通过 `angular.templateAccessibility` 整组关闭。 */\nexport const angularTemplateAccessibilityRules = {\n\t// 图片和图像型元素需要替代文本,确保非视觉用户能获得等价信息。\n\t\"@angular-eslint/template/alt-text\": \"error\",\n\t// click 交互需要键盘等价入口,避免仅鼠标用户可操作。\n\t\"@angular-eslint/template/click-events-have-key-events\": \"error\",\n\t// 需要可访问名称的元素不得为空,避免读屏软件播报无意义控件。\n\t\"@angular-eslint/template/elements-content\": \"error\",\n\t// 具有交互语义的元素必须可聚焦,确保键盘导航能够到达。\n\t\"@angular-eslint/template/interactive-supports-focus\": \"error\",\n\t// 表单 label 必须关联控件,扩大可点击区域并为辅助技术提供名称。\n\t\"@angular-eslint/template/label-has-associated-control\": \"error\",\n\t// mouseover/mouseout 行为需要对应键盘焦点事件,保持输入方式等价。\n\t\"@angular-eslint/template/mouse-events-have-key-events\": \"error\",\n\t// autofocus 会突然移动焦点并干扰读屏流程,默认禁止。\n\t\"@angular-eslint/template/no-autofocus\": \"error\",\n\t// 禁止 marquee、blink 等干扰性元素,避免可读性和可访问性问题。\n\t\"@angular-eslint/template/no-distracting-elements\": \"error\",\n\t// ARIA role 必须提供该角色要求的属性,避免声明不完整的语义。\n\t\"@angular-eslint/template/role-has-required-aria\": \"error\",\n\t// 表头 scope 只能使用合法值,使表格关系可被辅助技术正确解析。\n\t\"@angular-eslint/template/table-scope\": \"error\",\n\t// ARIA 属性名和值必须有效,避免浏览器静默忽略错误语义。\n\t\"@angular-eslint/template/valid-aria\": \"error\",\n} satisfies RuleOptions;\n","import type { RuleOptions } from \"../typegen\";\n\n/**\n * 跨 JavaScript、TypeScript 与 Vue 脚本生效的公共规则。\n *\n * 维护约定:每条本地覆写都要说明启用原因;可能造成大面积改动、采用成本或\n * 行为变化的规则使用 `[高影响]` 标记,并同步维护 `docs/rules-risk.zh.md`。\n */\nexport const commonRules = {\n\t// 要求数组回调在所有可到达分支返回值,避免 map/filter 等调用静默产生 undefined。\n\t\"array-callback-return\": \"error\",\n\t// 浏览器弹窗通常不适合生产代码;使用 warn 允许原型调试,同时确保发布前能够被发现。\n\t\"no-alert\": \"warn\",\n\t// switch 的 case 不创建词法作用域;要求用花括号包裹声明,避免跨 case 冲突。\n\t\"no-case-declarations\": \"error\",\n\t// 禁止反斜杠续行字符串,优先使用可读性更好的模板字符串。\n\t\"no-multi-str\": \"error\",\n\t// with 会让标识符解析不可预测,并且在严格模式和 ESM 中不可用。\n\t\"no-with\": \"error\",\n\t// 允许用 `void promise` 明确忽略 Promise,但禁止在普通表达式中滥用 void。\n\t\"no-void\": [\n\t\t\"error\",\n\t\t{\n\t\t\tallowAsStatement: true,\n\t\t},\n\t],\n\t// 要求严格相等;保留 `value == null` 同时判断 null/undefined 的常用写法。\n\teqeqeq: [\"error\", \"always\", { null: \"ignore\" }],\n\t// 幂运算统一使用 **,减少 Math.pow 嵌套并保持现代语法风格。\n\t\"prefer-exponentiation-operator\": \"error\",\n\t// 使用 Object.hasOwn,避免对象覆盖或缺少 hasOwnProperty 时产生异常。\n\t\"prefer-object-has-own\": \"error\",\n\n\t// [可自动修复] 声明间顺序交给 import-x;这里只排序同一 import 的成员。\n\t\"sort-imports\": [\n\t\t\"warn\",\n\t\t{\n\t\t\tignoreCase: false,\n\t\t\tignoreDeclarationSort: true,\n\t\t\tignoreMemberSort: false,\n\t\t\tmemberSyntaxSortOrder: [\"none\", \"all\", \"multiple\", \"single\"],\n\t\t\tallowSeparatedGroups: false,\n\t\t},\n\t],\n} satisfies RuleOptions;\n","import type { RuleOptions } from \"../typegen\";\n\n/** 默认启用的模块导入正确性与排序规则。 */\nexport const importRules = {\n\t// import 必须位于其他语句之前,避免模块依赖散落在执行逻辑中。\n\t\"import-x/first\": \"error\",\n\t// 合并同一模块的重复 import,避免绑定分散或副作用被误读。\n\t\"import-x/no-duplicates\": \"error\",\n\t// [高影响][可自动修复] 按来源分组并排序;带副作用的裸 import 仅报告,人工移动前必须确认执行顺序。\n\t\"import-x/order\": [\n\t\t\"error\",\n\t\t{\n\t\t\tgroups: [\n\t\t\t\t// Node.js 内置模块\n\t\t\t\t\"builtin\",\n\t\t\t\t// 第三方依赖\n\t\t\t\t\"external\",\n\t\t\t\t// 项目内部别名模块\n\t\t\t\t\"internal\",\n\t\t\t\t// 父级目录模块\n\t\t\t\t\"parent\",\n\t\t\t\t// 同级目录模块\n\t\t\t\t\"sibling\",\n\t\t\t\t// 当前目录入口模块\n\t\t\t\t\"index\",\n\t\t\t\t// TypeScript import = require() 导入\n\t\t\t\t\"object\",\n\t\t\t\t// TypeScript 类型导入\n\t\t\t\t\"type\",\n\t\t\t\t// 无法识别分类的导入\n\t\t\t\t\"unknown\",\n\t\t\t],\n\t\t\t// 不同 import 分组之间必须保留一个空行\n\t\t\t\"newlines-between\": \"always\",\n\t\t\t// 同一分组内按照模块路径字母升序排列\n\t\t\talphabetize: {\n\t\t\t\torder: \"asc\",\n\t\t\t\tcaseInsensitive: true,\n\t\t\t},\n\t\t\t// 对没有赋值给变量的副作用导入进行排序检查\n\t\t\twarnOnUnassignedImports: true,\n\t\t},\n\t],\n\t// [默认关闭] Vite/TypeScript 别名由项目解析器校验,避免共享配置绑定特定 resolver。\n\t\"import-x/no-unresolved\": \"off\",\n\t// [默认关闭] 未配置 resolver 时,namespace 导出的静态分析容易产生误报。\n\t\"import-x/namespace\": \"off\",\n\t// [默认关闭] 未配置 resolver 时,默认导出的静态分析容易产生误报。\n\t\"import-x/default\": \"off\",\n\t// [默认关闭] 不限制同时存在默认导出与相近命名导出的模块 API 风格。\n\t\"import-x/no-named-as-default\": \"off\",\n\t// [默认关闭] 不限制通过默认导入对象访问同名属性的项目 API 风格。\n\t\"import-x/no-named-as-default-member\": \"off\",\n\t// [默认关闭] 未配置 resolver 时,命名导出的静态分析容易产生误报。\n\t\"import-x/named\": \"off\",\n} satisfies RuleOptions;\n","import type { RuleOptions } from \"../typegen\";\n\n/**\n * JavaScript 本地覆写规则。\n * 高影响规则的解释与关闭方式见 `docs/rules-risk.zh.md`。\n */\nexport const javascriptRules = {\n\t// 控制台调用在应用源码中需要人工确认;warn/error 仍可用于必要的诊断输出。\n\t\"no-console\": [\n\t\t\"warn\",\n\t\t{\n\t\t\tallow: [\"warn\", \"error\"],\n\t\t},\n\t],\n\t// 防止调试断点进入发布代码并中断运行。\n\t\"no-debugger\": \"error\",\n\t// 禁止意外的恒定条件,但允许 while (true) 等有明确退出逻辑的循环。\n\t\"no-constant-condition\": [\n\t\t\"error\",\n\t\t{\n\t\t\tcheckLoops: false,\n\t\t},\n\t],\n\t// [高影响] 禁止标签语句;包含多层循环 labeled break/continue 的代码需先重构控制流。\n\t\"no-restricted-syntax\": [\"error\", \"LabeledStatement\"],\n\t// [高影响][可自动修复] 使用 let/const 替代 var;首次启用需复核循环闭包和声明提升行为。\n\t\"no-var\": \"error\",\n\t// 禁止无说明的空代码块;允许用于“忽略失败”语义的空 catch。\n\t\"no-empty\": [\n\t\t\"error\",\n\t\t{\n\t\t\tallowEmptyCatch: true,\n\t\t},\n\t],\n\t// 拒绝肉眼难以识别、可能导致解析差异的非常规空白字符。\n\t\"no-irregular-whitespace\": \"error\",\n\t// 变量和类先声明后使用;函数声明允许提升。warn 保留函数式组合和循环依赖重构空间。\n\t\"no-use-before-define\": [\n\t\t\"warn\",\n\t\t{\n\t\t\tclasses: true,\n\t\t\tfunctions: false,\n\t\t\tvariables: true,\n\t\t},\n\t],\n\t// [可自动修复] 能保持引用不变的变量优先使用 const;读取发生在赋值前时不做不可靠判断。\n\t\"prefer-const\": [\n\t\t\"warn\",\n\t\t{\n\t\t\tdestructuring: \"all\",\n\t\t\tignoreReadBeforeAssign: true,\n\t\t},\n\t],\n\t// [高影响][可自动修复] 优先箭头回调;批量修复后应复核 this/arguments 与函数名栈信息。\n\t\"prefer-arrow-callback\": [\n\t\t\"error\",\n\t\t{\n\t\t\tallowNamedFunctions: false,\n\t\t\tallowUnboundThis: true,\n\t\t},\n\t],\n\t// [可自动修复] 属性和值同名时使用对象简写,带引号键名不强制改写。\n\t\"object-shorthand\": [\n\t\t\"error\",\n\t\t\"always\",\n\t\t{\n\t\t\tignoreConstructors: false,\n\t\t\tavoidQuotes: true,\n\t\t},\n\t],\n\t// [高影响][可自动修复] 使用 ||=、&&=、??=;涉及 getter/Proxy 的代码应复核求值次数。\n\t\"logical-assignment-operators\": [\"error\", \"always\", { enforceForIfStatements: true }],\n\t// [可自动修复] 合并对象时优先展开语法,避免 Object.assign 的额外目标对象样板。\n\t\"prefer-object-spread\": \"error\",\n\t// 可变参数函数优先 rest 参数,避免依赖类数组 arguments;该规则只报告,不自动改写签名。\n\t\"prefer-rest-params\": \"error\",\n\t// 调用可迭代对象时优先 spread;该规则只报告,避免自动改变 apply 的 this 语义。\n\t\"prefer-spread\": \"error\",\n\t// [可自动修复] 字符串拼接优先模板字符串,便于阅读和多段插值。\n\t\"prefer-template\": \"error\",\n\t// 同一作用域禁止重复声明,避免后声明遮盖前声明。\n\t\"no-redeclare\": \"error\",\n} satisfies RuleOptions;\n","import type { RuleOptions } from \"../typegen\";\n\n/**\n * 统一使用 `lodash-unified` 的可选导入策略。\n *\n * 该规则只约束静态 import/export 的模块来源,不会安装依赖,也不会检查动态\n * `import()` 或 CommonJS `require()`。选择此策略的项目应自行安装 `lodash-unified`。\n */\nexport const preferLodashUnifiedRules = {\n\t// [高影响][按需启用] 禁止混用 lodash 与 lodash-es,避免同一项目维护多套等价依赖入口。\n\t\"no-restricted-imports\": [\n\t\t\"error\",\n\t\t{\n\t\t\tpaths: [\n\t\t\t\t{\n\t\t\t\t\tname: \"lodash\",\n\t\t\t\t\tmessage: 'Use \"lodash-unified\" consistently instead of \"lodash\".',\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tname: \"lodash-es\",\n\t\t\t\t\tmessage: 'Use \"lodash-unified\" consistently instead of \"lodash-es\".',\n\t\t\t\t},\n\t\t\t],\n\t\t\tpatterns: [\n\t\t\t\t{\n\t\t\t\t\tgroup: [\"lodash/*\", \"lodash-es/*\"],\n\t\t\t\t\tmessage: 'Use exports from \"lodash-unified\" instead of Lodash subpath imports.',\n\t\t\t\t},\n\t\t\t],\n\t\t},\n\t],\n} satisfies RuleOptions;\n\n/**\n * 统一使用 `lodash` 的可选导入策略。\n *\n * 根入口和 `lodash/*` 子路径都允许使用;规则只负责避免与 `lodash-es` 或\n * `lodash-unified` 混用,不替项目决定整包导入或按方法导入。\n */\nexport const preferLodashRules = {\n\t// [高影响][按需启用] 禁止混用 lodash-es 与 lodash-unified,保持运行时和类型来源一致。\n\t\"no-restricted-imports\": [\n\t\t\"error\",\n\t\t{\n\t\t\tpaths: [\n\t\t\t\t{\n\t\t\t\t\tname: \"lodash-es\",\n\t\t\t\t\tmessage: 'Use \"lodash\" consistently instead of \"lodash-es\".',\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tname: \"lodash-unified\",\n\t\t\t\t\tmessage: 'Use \"lodash\" consistently instead of \"lodash-unified\".',\n\t\t\t\t},\n\t\t\t],\n\t\t\tpatterns: [\n\t\t\t\t{\n\t\t\t\t\tgroup: [\"lodash-es/*\", \"lodash-unified/*\"],\n\t\t\t\t\tmessage: 'Use \"lodash\" or a \"lodash/*\" subpath consistently.',\n\t\t\t\t},\n\t\t\t],\n\t\t},\n\t],\n} satisfies RuleOptions;\n","import type { RuleOptions } from \"../typegen\";\n\n/**\n * React 本地覆写规则。\n *\n * `@eslint-react/recommended*` 负责组件、JSX、DOM 与 Web API 正确性,\n * `react-hooks/recommended` 负责 React 官方 Hooks 与 Compiler 诊断。这里关闭两套\n * 预置间的重复诊断,并补充少量明确的 DOM 安全约束。\n */\nexport const reactRules = {\n\t// React 官方 Hooks 插件提供更完整的 Error Boundary/Compiler 诊断,避免同一问题重复报告。\n\t\"@eslint-react/error-boundaries\": \"off\",\n\t// 依赖数组由 React 官方 exhaustive-deps 规则统一检查,避免重复警告。\n\t\"@eslint-react/exhaustive-deps\": \"off\",\n\t// 纯函数约束交给 React 官方 Compiler 规则维护,确保与 React 版本同步。\n\t\"@eslint-react/purity\": \"off\",\n\t// Hooks 调用顺序由 React 官方规则作为唯一来源,避免编辑器显示两个相同错误。\n\t\"@eslint-react/rules-of-hooks\": \"off\",\n\t// Effect 内同步更新状态由 React 官方 Compiler 规则判断,避免两套实现严重级别不一致。\n\t\"@eslint-react/set-state-in-effect\": \"off\",\n\t// 渲染期间更新状态由 React 官方 Compiler 规则判断,避免重复错误。\n\t\"@eslint-react/set-state-in-render\": \"off\",\n\t// 组件引用稳定性由 React 官方 Compiler 规则统一检查。\n\t\"@eslint-react/static-components\": \"off\",\n\t// Compiler 不支持的语法由 React 官方规则统一报告。\n\t\"@eslint-react/unsupported-syntax\": \"off\",\n\t// memoization 建议由 React 官方 Compiler 规则统一报告。\n\t\"@eslint-react/use-memo\": \"off\",\n\n\t// button 缺少 type 时在表单内默认为 submit,显式声明可避免意外提交。\n\t\"@eslint-react/dom-no-missing-button-type\": \"error\",\n\t// [安全关注] 未受限 iframe 权限面较大;以 warn 提醒评估可信来源和 sandbox 策略。\n\t\"@eslint-react/dom-no-missing-iframe-sandbox\": \"warn\",\n\t// JSX 属性拼写错误会被 React 忽略或错误透传到 DOM,应在提交前阻断。\n\t\"@eslint-react/dom-no-unknown-property\": \"error\",\n\t// [安全关注] target=\"_blank\" 未隔离 opener 时可能允许目标页控制来源页。\n\t\"@eslint-react/dom-no-unsafe-target-blank\": \"error\",\n} satisfies RuleOptions;\n","import type { RuleOptions } from \"../typegen\";\n\n/**\n * package.json 属性排序规则。\n *\n * `[高影响][可自动修复]`:仅在 `sortPackageJson: true` 时启用,首次修复可能重排大量字段。\n * 注意:这里故意不排序 `exports` 内部键;条件导出的键顺序具有模块解析语义。\n */\nexport const packageJsonSortRules = {\n\t// [高影响][可自动修复][按需启用] npm 的 files 清单按字母排序;数组顺序不改打包集合,但首次 diff 较大。\n\t\"jsonc/sort-array-values\": [\n\t\t\"error\",\n\t\t{\n\t\t\torder: { type: \"asc\" },\n\t\t\tpathPattern: \"^files$\",\n\t\t},\n\t],\n\t// [高影响][可自动修复][按需启用] 仅排序明确安全的 package.json 区域,不进入 exports 条件对象。\n\t\"jsonc/sort-keys\": [\n\t\t\"error\",\n\t\t// 根字段按常见阅读顺序组织,减少不同项目之间的清单噪声。\n\t\t{\n\t\t\torder: [\n\t\t\t\t\"name\",\n\t\t\t\t\"version\",\n\t\t\t\t\"private\",\n\t\t\t\t\"packageManager\",\n\t\t\t\t\"description\",\n\t\t\t\t\"type\",\n\t\t\t\t\"keywords\",\n\t\t\t\t\"license\",\n\t\t\t\t\"homepage\",\n\t\t\t\t\"bugs\",\n\t\t\t\t\"repository\",\n\t\t\t\t\"author\",\n\t\t\t\t\"contributors\",\n\t\t\t\t\"funding\",\n\t\t\t\t\"files\",\n\t\t\t\t\"main\",\n\t\t\t\t\"module\",\n\t\t\t\t\"types\",\n\t\t\t\t\"exports\",\n\t\t\t\t\"typesVersions\",\n\t\t\t\t\"sideEffects\",\n\t\t\t\t\"unpkg\",\n\t\t\t\t\"jsdelivr\",\n\t\t\t\t\"browser\",\n\t\t\t\t\"bin\",\n\t\t\t\t\"man\",\n\t\t\t\t\"directories\",\n\t\t\t\t\"publishConfig\",\n\t\t\t\t\"scripts\",\n\t\t\t\t\"peerDependencies\",\n\t\t\t\t\"peerDependenciesMeta\",\n\t\t\t\t\"optionalDependencies\",\n\t\t\t\t\"dependencies\",\n\t\t\t\t\"devDependencies\",\n\t\t\t\t\"engines\",\n\t\t\t\t\"config\",\n\t\t\t\t\"overrides\",\n\t\t\t\t\"pnpm\",\n\t\t\t\t\"husky\",\n\t\t\t\t\"lint-staged\",\n\t\t\t\t\"eslintConfig\",\n\t\t\t\t\"prettier\",\n\t\t\t],\n\t\t\tpathPattern: \"^$\",\n\t\t},\n\t\t// 各类依赖映射按包名排序,方便发现重复或异常依赖。\n\t\t{\n\t\t\torder: { type: \"asc\" },\n\t\t\tpathPattern: \"^(?:dev|peer|optional|bundled)?[Dd]ependencies(Meta)?$\",\n\t\t},\n\t\t// overrides/resolutions 只排序直接键;修改前仍应关注包管理器的模式匹配语义。\n\t\t{\n\t\t\torder: { type: \"asc\" },\n\t\t\tpathPattern: \"^(?:resolutions|overrides|pnpm.overrides)$\",\n\t\t},\n\t],\n} satisfies RuleOptions;\n","import type { RuleOptions } from \"../typegen\";\n\n/**\n * tsconfig.json 属性排序规则。\n *\n * `[高影响][可自动修复]`:仅在 `sortTsconfig: true` 时启用,首次修复会重排大量字段,\n * 但只改变 JSONC 的阅读顺序,不改变 TypeScript 编译选项值。\n */\nexport const tsconfigJsonSortRules = {\n\t// tsconfig 是 JSONC,注释用于解释不直观的编译器取舍,必须保留。\n\t\"jsonc/no-comments\": \"off\",\n\n\t// [高影响][可自动修复][按需启用] 只调整顶层和 compilerOptions 的键顺序,不改写任何选项值或数组。\n\t\"jsonc/sort-keys\": [\n\t\t\"error\",\n\t\t// 顶层按继承、选项、项目引用和文件范围的阅读顺序排列。\n\t\t{\n\t\t\torder: [\"extends\", \"compilerOptions\", \"references\", \"files\", \"include\", \"exclude\"],\n\t\t\tpathPattern: \"^$\",\n\t\t},\n\t\t// compilerOptions 的顺序跟随 TypeScript 文档主题,便于检索和代码审查。\n\t\t{\n\t\t\torder: [\n\t\t\t\t/* Projects */\n\t\t\t\t\"incremental\",\n\t\t\t\t\"composite\",\n\t\t\t\t\"tsBuildInfoFile\",\n\t\t\t\t\"disableSourceOfProjectReferenceRedirect\",\n\t\t\t\t\"disableSolutionSearching\",\n\t\t\t\t\"disableReferencedProjectLoad\",\n\t\t\t\t/* Language and Environment */\n\t\t\t\t\"target\",\n\t\t\t\t\"jsx\",\n\t\t\t\t\"jsxFactory\",\n\t\t\t\t\"jsxFragmentFactory\",\n\t\t\t\t\"jsxImportSource\",\n\t\t\t\t\"lib\",\n\t\t\t\t\"moduleDetection\",\n\t\t\t\t\"noLib\",\n\t\t\t\t\"reactNamespace\",\n\t\t\t\t\"useDefineForClassFields\",\n\t\t\t\t\"emitDecoratorMetadata\",\n\t\t\t\t\"experimentalDecorators\",\n\t\t\t\t/* Modules */\n\t\t\t\t\"baseUrl\",\n\t\t\t\t\"rootDir\",\n\t\t\t\t\"rootDirs\",\n\t\t\t\t\"customConditions\",\n\t\t\t\t\"module\",\n\t\t\t\t\"moduleResolution\",\n\t\t\t\t\"moduleSuffixes\",\n\t\t\t\t\"noResolve\",\n\t\t\t\t\"paths\",\n\t\t\t\t\"resolveJsonModule\",\n\t\t\t\t\"resolvePackageJsonExports\",\n\t\t\t\t\"resolvePackageJsonImports\",\n\t\t\t\t\"typeRoots\",\n\t\t\t\t\"types\",\n\t\t\t\t\"allowArbitraryExtensions\",\n\t\t\t\t\"allowImportingTsExtensions\",\n\t\t\t\t\"allowUmdGlobalAccess\",\n\t\t\t\t/* JavaScript Support */\n\t\t\t\t\"allowJs\",\n\t\t\t\t\"checkJs\",\n\t\t\t\t\"maxNodeModuleJsDepth\",\n\t\t\t\t/* Type Checking */\n\t\t\t\t\"strict\",\n\t\t\t\t\"strictBindCallApply\",\n\t\t\t\t\"strictFunctionTypes\",\n\t\t\t\t\"strictNullChecks\",\n\t\t\t\t\"strictPropertyInitialization\",\n\t\t\t\t\"allowUnreachableCode\",\n\t\t\t\t\"allowUnusedLabels\",\n\t\t\t\t\"alwaysStrict\",\n\t\t\t\t\"exactOptionalPropertyTypes\",\n\t\t\t\t\"noFallthroughCasesInSwitch\",\n\t\t\t\t\"noImplicitAny\",\n\t\t\t\t\"noImplicitOverride\",\n\t\t\t\t\"noImplicitReturns\",\n\t\t\t\t\"noImplicitThis\",\n\t\t\t\t\"noPropertyAccessFromIndexSignature\",\n\t\t\t\t\"noUncheckedIndexedAccess\",\n\t\t\t\t\"noUnusedLocals\",\n\t\t\t\t\"noUnusedParameters\",\n\t\t\t\t\"useUnknownInCatchVariables\",\n\t\t\t\t/* Emit */\n\t\t\t\t\"declaration\",\n\t\t\t\t\"declarationDir\",\n\t\t\t\t\"declarationMap\",\n\t\t\t\t\"downlevelIteration\",\n\t\t\t\t\"emitBOM\",\n\t\t\t\t\"emitDeclarationOnly\",\n\t\t\t\t\"importHelpers\",\n\t\t\t\t\"importsNotUsedAsValues\",\n\t\t\t\t\"inlineSourceMap\",\n\t\t\t\t\"inlineSources\",\n\t\t\t\t\"isolatedDeclarations\",\n\t\t\t\t\"mapRoot\",\n\t\t\t\t\"newLine\",\n\t\t\t\t\"noEmit\",\n\t\t\t\t\"noEmitHelpers\",\n\t\t\t\t\"noEmitOnError\",\n\t\t\t\t\"outDir\",\n\t\t\t\t\"outFile\",\n\t\t\t\t\"preserveConstEnums\",\n\t\t\t\t\"preserveValueImports\",\n\t\t\t\t\"removeComments\",\n\t\t\t\t\"sourceMap\",\n\t\t\t\t\"sourceRoot\",\n\t\t\t\t\"stripInternal\",\n\t\t\t\t/* Interop Constraints */\n\t\t\t\t\"allowSyntheticDefaultImports\",\n\t\t\t\t\"esModuleInterop\",\n\t\t\t\t\"forceConsistentCasingInFileNames\",\n\t\t\t\t\"isolatedModules\",\n\t\t\t\t\"preserveSymlinks\",\n\t\t\t\t\"verbatimModuleSyntax\",\n\t\t\t\t/* Completeness */\n\t\t\t\t\"skipDefaultLibCheck\",\n\t\t\t\t\"skipLibCheck\",\n\t\t\t],\n\t\t\tpathPattern: \"^compilerOptions$\",\n\t\t},\n\t],\n} satisfies RuleOptions;\n","import type { RuleOptions } from \"../typegen\";\n\n/**\n * TypeScript 本地覆写规则。\n * 这里补充 typescript-eslint 预置;高影响规则需同步维护风险文档。\n */\nexport const typescriptRules = {\n\t// 使用 TypeScript 版本避免核心规则误判声明合并、类型和值的同名声明。\n\t\"@typescript-eslint/no-redeclare\": \"error\",\n\t// [高影响][可自动修复] 未使用符号视为错误;以下划线开头可显式表示参数或变量被有意忽略。\n\t\"@typescript-eslint/no-unused-vars\": [\n\t\t\"error\",\n\t\t{\n\t\t\targs: \"after-used\",\n\t\t\targsIgnorePattern: \"^_\",\n\t\t\tcaughtErrors: \"all\",\n\t\t\tcaughtErrorsIgnorePattern: \"^_\",\n\t\t\tignoreRestSiblings: true,\n\t\t\tvarsIgnorePattern: \"^_\",\n\t\t},\n\t],\n\t// [默认关闭] 声明文件、全局扩展和部分 SDK 仍需要 namespace。\n\t\"@typescript-eslint/no-namespace\": \"off\",\n\t// any 会绕过类型检查,但在第三方边界和渐进式类型完善中有合理用途,因此只警告。\n\t\"@typescript-eslint/no-explicit-any\": \"warn\",\n\t// [高影响] 默认要求 ESM import;CommonJS、动态加载或工具链互操作代码可能需要按文件关闭。\n\t\"@typescript-eslint/no-require-imports\": \"error\",\n\t// 使用 TS 版本识别类型断言等语法;允许常见的短路和三元表达式调用模式。\n\t\"@typescript-eslint/no-unused-expressions\": [\n\t\t\"error\",\n\t\t{\n\t\t\tallowShortCircuit: true,\n\t\t\tallowTernary: true,\n\t\t},\n\t],\n\t// [可自动修复] 删除可由 TypeScript 明确推断的原始值类型标注,减少重复信息。\n\t\"@typescript-eslint/no-inferrable-types\": \"error\",\n\t// 非空断言可能隐藏空值缺陷;以警告提示逐步消除,避免一次性产生大量阻断错误。\n\t\"@typescript-eslint/no-non-null-assertion\": \"warn\",\n\t// 可选链之后再做非空断言逻辑矛盾,通常表示边界条件设计有误。\n\t\"@typescript-eslint/no-non-null-asserted-optional-chain\": \"error\",\n\t// [高影响][可自动修复] 类型依赖改用内联 type import;需复核仅靠 import 触发的模块副作用。\n\t\"@typescript-eslint/consistent-type-imports\": [\n\t\t\"error\",\n\t\t{\n\t\t\tdisallowTypeAnnotations: false,\n\t\t\tfixStyle: \"inline-type-imports\",\n\t\t\tprefer: \"type-imports\",\n\t\t},\n\t],\n} satisfies RuleOptions;\n","import type { RuleOptions } from \"../typegen\";\n\n/**\n * Vue SFC 本地覆写规则。\n * 上游 `flat/recommended` 已覆盖基础正确性,这里只记录项目取舍与附加约束。\n */\nexport const vueRules = {\n\t// [安全关注] v-html 可能引入 XSS;保留 warn 以兼容经过净化的富文本场景。\n\t\"vue/no-v-html\": \"warn\",\n\t// [默认关闭] TypeScript 类型 props 和 required 声明已能表达可选性,不强制每个可选 prop 提供默认值。\n\t\"vue/require-default-prop\": \"off\",\n\t// [高影响] 组件必须声明对外事件;首次启用时会暴露未建模的公共事件 API。\n\t\"vue/require-explicit-emits\": \"error\",\n\t// [默认关闭] 允许 App、Layout 等约定俗成的单词组件名。\n\t\"vue/multi-word-component-names\": \"off\",\n\t// 优先从 vue 入口导入由 Vue 重新导出的 API,避免依赖内部包边界。\n\t\"vue/prefer-import-from-vue\": \"warn\",\n\n\t// 防止 props、data、computed、methods 等组件命名空间出现冲突。\n\t\"vue/no-dupe-keys\": \"error\",\n\t// [高影响] 禁止组件直接修改 props,要求通过事件或本地状态维持单向数据流。\n\t\"vue/no-mutating-props\": \"error\",\n\t// 避免自定义组件名与 Vue 内置组件冲突。\n\t\"vue/no-reserved-component-names\": \"error\",\n\t// [安全关注] 禁止在组件节点上使用 v-text/v-html,避免覆盖组件内容和模糊数据边界。\n\t\"vue/no-v-text-v-html-on-component\": \"error\",\n\t// 统一模板与脚本中的自定义事件名称为 camelCase。\n\t\"vue/custom-event-name-casing\": [\"error\", \"camelCase\"],\n\t// [默认关闭] 允许在一个 SFC 中声明仅供当前文件使用的小型辅助组件。\n\t\"vue/one-component-per-file\": \"off\",\n\t// [高影响][可自动修复] 统一模板属性分组;首次启用可能产生大量仅排序的模板差异。\n\t\"vue/attributes-order\": [\n\t\t\"error\",\n\t\t{\n\t\t\torder: [\"DEFINITION\", \"LIST_RENDERING\", \"CONDITIONALS\", \"RENDER_MODIFIERS\", \"GLOBAL\", \"UNIQUE\", \"OTHER_ATTR\", \"EVENTS\", \"CONTENT\"],\n\t\t},\n\t],\n} satisfies RuleOptions;\n"],"mappings":";;;;;;;AAQA,MAAa,eAAe;CAE3B,wCAAwC;CAExC,6CAA6C;CAE7C,mCAAmC;CAEnC,+CAA+C;CAE/C,oCAAoC;CAEpC,uCAAuC;CAEvC,oCAAoC;CAEpC,gDAAgD;CAEhD,iCAAiC;CAEjC,6DAA6D;CAE7D,qCAAqC;CAErC,gDAAgD;CAEhD,2CAA2C;AAC5C;;AAGA,MAAa,uBAAuB;CAEnC,0CAA0C;CAE1C,mCAAmC;CAEnC,6CAA6C;CAE7C,gDAAgD;AACjD;;AAGA,MAAa,oCAAoC;CAEhD,qCAAqC;CAErC,yDAAyD;CAEzD,6CAA6C;CAE7C,uDAAuD;CAEvD,yDAAyD;CAEzD,yDAAyD;CAEzD,yCAAyC;CAEzC,oDAAoD;CAEpD,mDAAmD;CAEnD,wCAAwC;CAExC,uCAAuC;AACxC;;;;;;;;;ACjEA,MAAa,cAAc;CAE1B,yBAAyB;CAEzB,YAAY;CAEZ,wBAAwB;CAExB,gBAAgB;CAEhB,WAAW;CAEX,WAAW,CACV,SACA,EACC,kBAAkB,KACnB,CACD;CAEA,QAAQ;EAAC;EAAS;EAAU,EAAE,MAAM,SAAS;CAAC;CAE9C,kCAAkC;CAElC,yBAAyB;CAGzB,gBAAgB,CACf,QACA;EACC,YAAY;EACZ,uBAAuB;EACvB,kBAAkB;EAClB,uBAAuB;GAAC;GAAQ;GAAO;GAAY;EAAQ;EAC3D,sBAAsB;CACvB,CACD;AACD;;;;ACzCA,MAAa,cAAc;CAE1B,kBAAkB;CAElB,0BAA0B;CAE1B,kBAAkB,CACjB,SACA;EACC,QAAQ;GAEP;GAEA;GAEA;GAEA;GAEA;GAEA;GAEA;GAEA;GAEA;EACD;EAEA,oBAAoB;EAEpB,aAAa;GACZ,OAAO;GACP,iBAAiB;EAClB;EAEA,yBAAyB;CAC1B,CACD;CAEA,0BAA0B;CAE1B,sBAAsB;CAEtB,oBAAoB;CAEpB,gCAAgC;CAEhC,uCAAuC;CAEvC,kBAAkB;AACnB;;;;;;;ACjDA,MAAa,kBAAkB;CAE9B,cAAc,CACb,QACA,EACC,OAAO,CAAC,QAAQ,OAAO,EACxB,CACD;CAEA,eAAe;CAEf,yBAAyB,CACxB,SACA,EACC,YAAY,MACb,CACD;CAEA,wBAAwB,CAAC,SAAS,kBAAkB;CAEpD,UAAU;CAEV,YAAY,CACX,SACA,EACC,iBAAiB,KAClB,CACD;CAEA,2BAA2B;CAE3B,wBAAwB,CACvB,QACA;EACC,SAAS;EACT,WAAW;EACX,WAAW;CACZ,CACD;CAEA,gBAAgB,CACf,QACA;EACC,eAAe;EACf,wBAAwB;CACzB,CACD;CAEA,yBAAyB,CACxB,SACA;EACC,qBAAqB;EACrB,kBAAkB;CACnB,CACD;CAEA,oBAAoB;EACnB;EACA;EACA;GACC,oBAAoB;GACpB,aAAa;EACd;CACD;CAEA,gCAAgC;EAAC;EAAS;EAAU,EAAE,wBAAwB,KAAK;CAAC;CAEpF,wBAAwB;CAExB,sBAAsB;CAEtB,iBAAiB;CAEjB,mBAAmB;CAEnB,gBAAgB;AACjB;;;;;;;;;AC1EA,MAAa,2BAA2B,EAEvC,yBAAyB,CACxB,SACA;CACC,OAAO,CACN;EACC,MAAM;EACN,SAAS;CACV,GACA;EACC,MAAM;EACN,SAAS;CACV,CACD;CACA,UAAU,CACT;EACC,OAAO,CAAC,YAAY,aAAa;EACjC,SAAS;CACV,CACD;AACD,CACD,EACD;;;;;;;AAQA,MAAa,oBAAoB,EAEhC,yBAAyB,CACxB,SACA;CACC,OAAO,CACN;EACC,MAAM;EACN,SAAS;CACV,GACA;EACC,MAAM;EACN,SAAS;CACV,CACD;CACA,UAAU,CACT;EACC,OAAO,CAAC,eAAe,kBAAkB;EACzC,SAAS;CACV,CACD;AACD,CACD,EACD;;;;;;;;;;ACrDA,MAAa,aAAa;CAEzB,kCAAkC;CAElC,iCAAiC;CAEjC,wBAAwB;CAExB,gCAAgC;CAEhC,qCAAqC;CAErC,qCAAqC;CAErC,mCAAmC;CAEnC,oCAAoC;CAEpC,0BAA0B;CAG1B,4CAA4C;CAE5C,+CAA+C;CAE/C,yCAAyC;CAEzC,4CAA4C;AAC7C;;;;;;;;;AC7BA,MAAa,uBAAuB;CAEnC,2BAA2B,CAC1B,SACA;EACC,OAAO,EAAE,MAAM,MAAM;EACrB,aAAa;CACd,CACD;CAEA,mBAAmB;EAClB;EAEA;GACC,OAAO;IACN;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;GACD;GACA,aAAa;EACd;EAEA;GACC,OAAO,EAAE,MAAM,MAAM;GACrB,aAAa;EACd;EAEA;GACC,OAAO,EAAE,MAAM,MAAM;GACrB,aAAa;EACd;CACD;AACD;;;;;;;;;ACvEA,MAAa,wBAAwB;CAEpC,qBAAqB;CAGrB,mBAAmB;EAClB;EAEA;GACC,OAAO;IAAC;IAAW;IAAmB;IAAc;IAAS;IAAW;GAAS;GACjF,aAAa;EACd;EAEA;GACC,OAAO;IAEN;IACA;IACA;IACA;IACA;IACA;IAEA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IAEA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IAEA;IACA;IACA;IAEA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IAEA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IAEA;IACA;IACA;IACA;IACA;IACA;IAEA;IACA;GACD;GACA,aAAa;EACd;CACD;AACD;;;;;;;ACtHA,MAAa,kBAAkB;CAE9B,mCAAmC;CAEnC,qCAAqC,CACpC,SACA;EACC,MAAM;EACN,mBAAmB;EACnB,cAAc;EACd,2BAA2B;EAC3B,oBAAoB;EACpB,mBAAmB;CACpB,CACD;CAEA,mCAAmC;CAEnC,sCAAsC;CAEtC,yCAAyC;CAEzC,4CAA4C,CAC3C,SACA;EACC,mBAAmB;EACnB,cAAc;CACf,CACD;CAEA,0CAA0C;CAE1C,4CAA4C;CAE5C,0DAA0D;CAE1D,8CAA8C,CAC7C,SACA;EACC,yBAAyB;EACzB,UAAU;EACV,QAAQ;CACT,CACD;AACD;;;;;;;AC5CA,MAAa,WAAW;CAEvB,iBAAiB;CAEjB,4BAA4B;CAE5B,8BAA8B;CAE9B,kCAAkC;CAElC,8BAA8B;CAG9B,oBAAoB;CAEpB,yBAAyB;CAEzB,mCAAmC;CAEnC,qCAAqC;CAErC,gCAAgC,CAAC,SAAS,WAAW;CAErD,8BAA8B;CAE9B,wBAAwB,CACvB,SACA,EACC,OAAO;EAAC;EAAc;EAAkB;EAAgB;EAAoB;EAAU;EAAU;EAAc;EAAU;CAAS,EAClI,CACD;AACD"}