@fast-china/eslint-config 2.0.0 → 2.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/rules.mjs ADDED
@@ -0,0 +1,485 @@
1
+ //#region src/define-rules.ts
2
+ /**
3
+ * 为项目规则提供精确的规则名、严重级别和规则选项自动补全。
4
+ *
5
+ * 该函数不会修改传入对象;它只在 TypeScript 编译阶段拒绝未知规则和无效选项。
6
+ */
7
+ const defineRules = (rules) => rules;
8
+ //#endregion
9
+ //#region src/rules/angular.ts
10
+ /**
11
+ * Angular TypeScript 推荐规则。
12
+ *
13
+ * Angular ESLint 的拆分插件不直接导出 Flat Config 预置;本记录与 angular-eslint
14
+ * 22.x 的 `tsRecommended` 保持一致,并逐条说明启用理由。
15
+ */
16
+ const angularRules = {
17
+ "@angular-eslint/contextual-lifecycle": "error",
18
+ "@angular-eslint/no-empty-lifecycle-method": "error",
19
+ "@angular-eslint/no-input-rename": "error",
20
+ "@angular-eslint/no-inputs-metadata-property": "error",
21
+ "@angular-eslint/no-output-native": "error",
22
+ "@angular-eslint/no-output-on-prefix": "error",
23
+ "@angular-eslint/no-output-rename": "error",
24
+ "@angular-eslint/no-outputs-metadata-property": "error",
25
+ "@angular-eslint/prefer-inject": "error",
26
+ "@angular-eslint/prefer-on-push-component-change-detection": "error",
27
+ "@angular-eslint/prefer-standalone": "error",
28
+ "@angular-eslint/use-pipe-transform-interface": "error",
29
+ "@angular-eslint/use-lifecycle-interface": "warn"
30
+ };
31
+ /** Angular HTML 模板推荐规则,与 angular-eslint 22.x 的 `templateRecommended` 对齐。 */
32
+ const angularTemplateRules = {
33
+ "@angular-eslint/template/banana-in-box": "error",
34
+ "@angular-eslint/template/eqeqeq": "error",
35
+ "@angular-eslint/template/no-negated-async": "error",
36
+ "@angular-eslint/template/prefer-control-flow": "error"
37
+ };
38
+ /** Angular 模板无障碍规则;可通过 `angular.templateAccessibility` 整组关闭。 */
39
+ const angularTemplateAccessibilityRules = {
40
+ "@angular-eslint/template/alt-text": "error",
41
+ "@angular-eslint/template/click-events-have-key-events": "error",
42
+ "@angular-eslint/template/elements-content": "error",
43
+ "@angular-eslint/template/interactive-supports-focus": "error",
44
+ "@angular-eslint/template/label-has-associated-control": "error",
45
+ "@angular-eslint/template/mouse-events-have-key-events": "error",
46
+ "@angular-eslint/template/no-autofocus": "error",
47
+ "@angular-eslint/template/no-distracting-elements": "error",
48
+ "@angular-eslint/template/role-has-required-aria": "error",
49
+ "@angular-eslint/template/table-scope": "error",
50
+ "@angular-eslint/template/valid-aria": "error"
51
+ };
52
+ //#endregion
53
+ //#region src/rules/common.ts
54
+ /**
55
+ * 跨 JavaScript、TypeScript 与 Vue 脚本生效的公共规则。
56
+ *
57
+ * 维护约定:每条本地覆写都要说明启用原因;可能造成大面积改动、采用成本或
58
+ * 行为变化的规则使用 `[高影响]` 标记,并同步维护 `docs/rules-risk.zh.md`。
59
+ */
60
+ const commonRules = {
61
+ "array-callback-return": "error",
62
+ "no-alert": "warn",
63
+ "no-case-declarations": "error",
64
+ "no-multi-str": "error",
65
+ "no-with": "error",
66
+ "no-void": ["error", { allowAsStatement: true }],
67
+ eqeqeq: [
68
+ "error",
69
+ "always",
70
+ { null: "ignore" }
71
+ ],
72
+ "prefer-exponentiation-operator": "error",
73
+ "prefer-object-has-own": "error",
74
+ "sort-imports": ["warn", {
75
+ ignoreCase: false,
76
+ ignoreDeclarationSort: true,
77
+ ignoreMemberSort: false,
78
+ memberSyntaxSortOrder: [
79
+ "none",
80
+ "all",
81
+ "multiple",
82
+ "single"
83
+ ],
84
+ allowSeparatedGroups: false
85
+ }]
86
+ };
87
+ //#endregion
88
+ //#region src/rules/import.ts
89
+ /** 默认启用的模块导入正确性与排序规则。 */
90
+ const importRules = {
91
+ "import-x/first": "error",
92
+ "import-x/no-duplicates": "error",
93
+ "import-x/order": ["error", {
94
+ groups: [
95
+ "builtin",
96
+ "external",
97
+ "internal",
98
+ "parent",
99
+ "sibling",
100
+ "index",
101
+ "object",
102
+ "type",
103
+ "unknown"
104
+ ],
105
+ "newlines-between": "always",
106
+ alphabetize: {
107
+ order: "asc",
108
+ caseInsensitive: true
109
+ },
110
+ warnOnUnassignedImports: true
111
+ }],
112
+ "import-x/no-unresolved": "off",
113
+ "import-x/namespace": "off",
114
+ "import-x/default": "off",
115
+ "import-x/no-named-as-default": "off",
116
+ "import-x/no-named-as-default-member": "off",
117
+ "import-x/named": "off"
118
+ };
119
+ //#endregion
120
+ //#region src/rules/javascript.ts
121
+ /**
122
+ * JavaScript 本地覆写规则。
123
+ * 高影响规则的解释与关闭方式见 `docs/rules-risk.zh.md`。
124
+ */
125
+ const javascriptRules = {
126
+ "no-console": ["warn", { allow: ["warn", "error"] }],
127
+ "no-debugger": "error",
128
+ "no-constant-condition": ["error", { checkLoops: false }],
129
+ "no-restricted-syntax": ["error", "LabeledStatement"],
130
+ "no-var": "error",
131
+ "no-empty": ["error", { allowEmptyCatch: true }],
132
+ "no-irregular-whitespace": "error",
133
+ "no-use-before-define": ["warn", {
134
+ classes: true,
135
+ functions: false,
136
+ variables: true
137
+ }],
138
+ "prefer-const": ["warn", {
139
+ destructuring: "all",
140
+ ignoreReadBeforeAssign: true
141
+ }],
142
+ "prefer-arrow-callback": ["error", {
143
+ allowNamedFunctions: false,
144
+ allowUnboundThis: true
145
+ }],
146
+ "object-shorthand": [
147
+ "error",
148
+ "always",
149
+ {
150
+ ignoreConstructors: false,
151
+ avoidQuotes: true
152
+ }
153
+ ],
154
+ "logical-assignment-operators": [
155
+ "error",
156
+ "always",
157
+ { enforceForIfStatements: true }
158
+ ],
159
+ "prefer-object-spread": "error",
160
+ "prefer-rest-params": "error",
161
+ "prefer-spread": "error",
162
+ "prefer-template": "error",
163
+ "no-redeclare": "error"
164
+ };
165
+ //#endregion
166
+ //#region src/rules/lodash.ts
167
+ /**
168
+ * 统一使用 `lodash-unified` 的可选导入策略。
169
+ *
170
+ * 该规则只约束静态 import/export 的模块来源,不会安装依赖,也不会检查动态
171
+ * `import()` 或 CommonJS `require()`。选择此策略的项目应自行安装 `lodash-unified`。
172
+ */
173
+ const preferLodashUnifiedRules = { "no-restricted-imports": ["error", {
174
+ paths: [{
175
+ name: "lodash",
176
+ message: "Use \"lodash-unified\" consistently instead of \"lodash\"."
177
+ }, {
178
+ name: "lodash-es",
179
+ message: "Use \"lodash-unified\" consistently instead of \"lodash-es\"."
180
+ }],
181
+ patterns: [{
182
+ group: ["lodash/*", "lodash-es/*"],
183
+ message: "Use exports from \"lodash-unified\" instead of Lodash subpath imports."
184
+ }]
185
+ }] };
186
+ /**
187
+ * 统一使用 `lodash` 的可选导入策略。
188
+ *
189
+ * 根入口和 `lodash/*` 子路径都允许使用;规则只负责避免与 `lodash-es` 或
190
+ * `lodash-unified` 混用,不替项目决定整包导入或按方法导入。
191
+ */
192
+ const preferLodashRules = { "no-restricted-imports": ["error", {
193
+ paths: [{
194
+ name: "lodash-es",
195
+ message: "Use \"lodash\" consistently instead of \"lodash-es\"."
196
+ }, {
197
+ name: "lodash-unified",
198
+ message: "Use \"lodash\" consistently instead of \"lodash-unified\"."
199
+ }],
200
+ patterns: [{
201
+ group: ["lodash-es/*", "lodash-unified/*"],
202
+ message: "Use \"lodash\" or a \"lodash/*\" subpath consistently."
203
+ }]
204
+ }] };
205
+ //#endregion
206
+ //#region src/rules/react.ts
207
+ /**
208
+ * React 本地覆写规则。
209
+ *
210
+ * `@eslint-react/recommended*` 负责组件、JSX、DOM 与 Web API 正确性,
211
+ * `react-hooks/recommended` 负责 React 官方 Hooks 与 Compiler 诊断。这里关闭两套
212
+ * 预置间的重复诊断,并补充少量明确的 DOM 安全约束。
213
+ */
214
+ const reactRules = {
215
+ "@eslint-react/error-boundaries": "off",
216
+ "@eslint-react/exhaustive-deps": "off",
217
+ "@eslint-react/purity": "off",
218
+ "@eslint-react/rules-of-hooks": "off",
219
+ "@eslint-react/set-state-in-effect": "off",
220
+ "@eslint-react/set-state-in-render": "off",
221
+ "@eslint-react/static-components": "off",
222
+ "@eslint-react/unsupported-syntax": "off",
223
+ "@eslint-react/use-memo": "off",
224
+ "@eslint-react/dom-no-missing-button-type": "error",
225
+ "@eslint-react/dom-no-missing-iframe-sandbox": "warn",
226
+ "@eslint-react/dom-no-unknown-property": "error",
227
+ "@eslint-react/dom-no-unsafe-target-blank": "error"
228
+ };
229
+ //#endregion
230
+ //#region src/rules/sort-package.ts
231
+ /**
232
+ * package.json 属性排序规则。
233
+ *
234
+ * `[高影响][可自动修复]`:仅在 `sortPackageJson: true` 时启用,首次修复可能重排大量字段。
235
+ * 注意:这里故意不排序 `exports` 内部键;条件导出的键顺序具有模块解析语义。
236
+ */
237
+ const packageJsonSortRules = {
238
+ "jsonc/sort-array-values": ["error", {
239
+ order: { type: "asc" },
240
+ pathPattern: "^files$"
241
+ }],
242
+ "jsonc/sort-keys": [
243
+ "error",
244
+ {
245
+ order: [
246
+ "name",
247
+ "version",
248
+ "private",
249
+ "packageManager",
250
+ "description",
251
+ "type",
252
+ "keywords",
253
+ "license",
254
+ "homepage",
255
+ "bugs",
256
+ "repository",
257
+ "author",
258
+ "contributors",
259
+ "funding",
260
+ "files",
261
+ "main",
262
+ "module",
263
+ "types",
264
+ "exports",
265
+ "typesVersions",
266
+ "sideEffects",
267
+ "unpkg",
268
+ "jsdelivr",
269
+ "browser",
270
+ "bin",
271
+ "man",
272
+ "directories",
273
+ "publishConfig",
274
+ "scripts",
275
+ "peerDependencies",
276
+ "peerDependenciesMeta",
277
+ "optionalDependencies",
278
+ "dependencies",
279
+ "devDependencies",
280
+ "engines",
281
+ "config",
282
+ "overrides",
283
+ "pnpm",
284
+ "husky",
285
+ "lint-staged",
286
+ "eslintConfig",
287
+ "prettier"
288
+ ],
289
+ pathPattern: "^$"
290
+ },
291
+ {
292
+ order: { type: "asc" },
293
+ pathPattern: "^(?:dev|peer|optional|bundled)?[Dd]ependencies(Meta)?$"
294
+ },
295
+ {
296
+ order: { type: "asc" },
297
+ pathPattern: "^(?:resolutions|overrides|pnpm.overrides)$"
298
+ }
299
+ ]
300
+ };
301
+ //#endregion
302
+ //#region src/rules/sort-tsconfig.ts
303
+ /**
304
+ * tsconfig.json 属性排序规则。
305
+ *
306
+ * `[高影响][可自动修复]`:仅在 `sortTsconfig: true` 时启用,首次修复会重排大量字段,
307
+ * 但只改变 JSONC 的阅读顺序,不改变 TypeScript 编译选项值。
308
+ */
309
+ const tsconfigJsonSortRules = {
310
+ "jsonc/no-comments": "off",
311
+ "jsonc/sort-keys": [
312
+ "error",
313
+ {
314
+ order: [
315
+ "extends",
316
+ "compilerOptions",
317
+ "references",
318
+ "files",
319
+ "include",
320
+ "exclude"
321
+ ],
322
+ pathPattern: "^$"
323
+ },
324
+ {
325
+ order: [
326
+ "incremental",
327
+ "composite",
328
+ "tsBuildInfoFile",
329
+ "disableSourceOfProjectReferenceRedirect",
330
+ "disableSolutionSearching",
331
+ "disableReferencedProjectLoad",
332
+ "target",
333
+ "jsx",
334
+ "jsxFactory",
335
+ "jsxFragmentFactory",
336
+ "jsxImportSource",
337
+ "lib",
338
+ "moduleDetection",
339
+ "noLib",
340
+ "reactNamespace",
341
+ "useDefineForClassFields",
342
+ "emitDecoratorMetadata",
343
+ "experimentalDecorators",
344
+ "baseUrl",
345
+ "rootDir",
346
+ "rootDirs",
347
+ "customConditions",
348
+ "module",
349
+ "moduleResolution",
350
+ "moduleSuffixes",
351
+ "noResolve",
352
+ "paths",
353
+ "resolveJsonModule",
354
+ "resolvePackageJsonExports",
355
+ "resolvePackageJsonImports",
356
+ "typeRoots",
357
+ "types",
358
+ "allowArbitraryExtensions",
359
+ "allowImportingTsExtensions",
360
+ "allowUmdGlobalAccess",
361
+ "allowJs",
362
+ "checkJs",
363
+ "maxNodeModuleJsDepth",
364
+ "strict",
365
+ "strictBindCallApply",
366
+ "strictFunctionTypes",
367
+ "strictNullChecks",
368
+ "strictPropertyInitialization",
369
+ "allowUnreachableCode",
370
+ "allowUnusedLabels",
371
+ "alwaysStrict",
372
+ "exactOptionalPropertyTypes",
373
+ "noFallthroughCasesInSwitch",
374
+ "noImplicitAny",
375
+ "noImplicitOverride",
376
+ "noImplicitReturns",
377
+ "noImplicitThis",
378
+ "noPropertyAccessFromIndexSignature",
379
+ "noUncheckedIndexedAccess",
380
+ "noUnusedLocals",
381
+ "noUnusedParameters",
382
+ "useUnknownInCatchVariables",
383
+ "declaration",
384
+ "declarationDir",
385
+ "declarationMap",
386
+ "downlevelIteration",
387
+ "emitBOM",
388
+ "emitDeclarationOnly",
389
+ "importHelpers",
390
+ "importsNotUsedAsValues",
391
+ "inlineSourceMap",
392
+ "inlineSources",
393
+ "isolatedDeclarations",
394
+ "mapRoot",
395
+ "newLine",
396
+ "noEmit",
397
+ "noEmitHelpers",
398
+ "noEmitOnError",
399
+ "outDir",
400
+ "outFile",
401
+ "preserveConstEnums",
402
+ "preserveValueImports",
403
+ "removeComments",
404
+ "sourceMap",
405
+ "sourceRoot",
406
+ "stripInternal",
407
+ "allowSyntheticDefaultImports",
408
+ "esModuleInterop",
409
+ "forceConsistentCasingInFileNames",
410
+ "isolatedModules",
411
+ "preserveSymlinks",
412
+ "verbatimModuleSyntax",
413
+ "skipDefaultLibCheck",
414
+ "skipLibCheck"
415
+ ],
416
+ pathPattern: "^compilerOptions$"
417
+ }
418
+ ]
419
+ };
420
+ //#endregion
421
+ //#region src/rules/typescript.ts
422
+ /**
423
+ * TypeScript 本地覆写规则。
424
+ * 这里补充 typescript-eslint 预置;高影响规则需同步维护风险文档。
425
+ */
426
+ const typescriptRules = {
427
+ "@typescript-eslint/no-redeclare": "error",
428
+ "@typescript-eslint/no-unused-vars": ["error", {
429
+ args: "after-used",
430
+ argsIgnorePattern: "^_",
431
+ caughtErrors: "all",
432
+ caughtErrorsIgnorePattern: "^_",
433
+ ignoreRestSiblings: true,
434
+ varsIgnorePattern: "^_"
435
+ }],
436
+ "@typescript-eslint/no-namespace": "off",
437
+ "@typescript-eslint/no-explicit-any": "warn",
438
+ "@typescript-eslint/no-require-imports": "error",
439
+ "@typescript-eslint/no-unused-expressions": ["error", {
440
+ allowShortCircuit: true,
441
+ allowTernary: true
442
+ }],
443
+ "@typescript-eslint/no-inferrable-types": "error",
444
+ "@typescript-eslint/no-non-null-assertion": "warn",
445
+ "@typescript-eslint/no-non-null-asserted-optional-chain": "error",
446
+ "@typescript-eslint/consistent-type-imports": ["error", {
447
+ disallowTypeAnnotations: false,
448
+ fixStyle: "inline-type-imports",
449
+ prefer: "type-imports"
450
+ }]
451
+ };
452
+ //#endregion
453
+ //#region src/rules/vue.ts
454
+ /**
455
+ * Vue SFC 本地覆写规则。
456
+ * 上游 `flat/recommended` 已覆盖基础正确性,这里只记录项目取舍与附加约束。
457
+ */
458
+ const vueRules = {
459
+ "vue/no-v-html": "warn",
460
+ "vue/require-default-prop": "off",
461
+ "vue/require-explicit-emits": "error",
462
+ "vue/multi-word-component-names": "off",
463
+ "vue/prefer-import-from-vue": "warn",
464
+ "vue/no-dupe-keys": "error",
465
+ "vue/no-mutating-props": "error",
466
+ "vue/no-reserved-component-names": "error",
467
+ "vue/no-v-text-v-html-on-component": "error",
468
+ "vue/custom-event-name-casing": ["error", "camelCase"],
469
+ "vue/one-component-per-file": "off",
470
+ "vue/attributes-order": ["error", { order: [
471
+ "DEFINITION",
472
+ "LIST_RENDERING",
473
+ "CONDITIONALS",
474
+ "RENDER_MODIFIERS",
475
+ "GLOBAL",
476
+ "UNIQUE",
477
+ "OTHER_ATTR",
478
+ "EVENTS",
479
+ "CONTENT"
480
+ ] }]
481
+ };
482
+ //#endregion
483
+ export { reactRules as a, javascriptRules as c, angularRules as d, angularTemplateAccessibilityRules as f, packageJsonSortRules as i, importRules as l, defineRules as m, typescriptRules as n, preferLodashRules as o, angularTemplateRules as p, tsconfigJsonSortRules as r, preferLodashUnifiedRules as s, vueRules as t, commonRules as u };
484
+
485
+ //# sourceMappingURL=rules.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"rules.mjs","names":[],"sources":["../src/define-rules.ts","../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\";\nimport type { Linter } from \"eslint\";\n\ntype RejectUnknownRuleNames<Rules extends RuleOptions> = Rules & Record<Exclude<keyof Rules, keyof RuleOptions>, never>;\n\n/**\n * 为项目规则提供精确的规则名、严重级别和规则选项自动补全。\n *\n * 该函数不会修改传入对象;它只在 TypeScript 编译阶段拒绝未知规则和无效选项。\n */\nexport const defineRules = <const Rules extends RuleOptions>(rules: RejectUnknownRuleNames<Rules>): Rules & Linter.RulesRecord => rules;\n\nexport type { RuleOptions } from \"./typegen\";\n","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":"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N;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"}
@@ -2,20 +2,20 @@
2
2
 
3
3
  审查日期:2026-07-26
4
4
 
5
- 审查对象:`@fast-china/eslint-config` 2.0.0 工作区
5
+ 审查对象:`@fast-china/eslint-config` 2.0.1 工作区
6
6
 
7
7
  ## 结论
8
8
 
9
9
  当前仓库已经具备完整 ESLint Flat Config 开源库所需的核心能力:稳定且精简的公共 API、明确的语言作用域、可选类型感知检查、精确规则类型、可重复构建、集成测试、CI、发布归档检查和中英文文档。
10
10
 
11
- 默认场景面向 Vue 3 + Vite + TypeScript,同时支持 JavaScript、Node.js、JSON、JSONC、JSON5、Markdown、正则表达式和模块导入检查。所有可选能力均通过 `fastConfig(options, ...overrides)` 组合,项目覆写始终位于内置配置之后。
11
+ 默认场景面向 Vue 3 + Vite + TypeScript,同时提供按需启用的一等 React 与 Angular 集成,并支持 JavaScript、Node.js、JSON、JSONC、JSON5、Markdown、正则表达式和模块导入检查。所有可选能力均通过 `fastConfig(options, ...overrides)` 组合,项目覆写始终位于内置配置之后。
12
12
 
13
13
  ## 审查范围
14
14
 
15
15
  - npm 包元数据、ESM 入口、公开子路径与发布文件
16
- - TypeScript、tsup、类型生成与声明文件
16
+ - TypeScript 6tsdown、类型生成与声明文件
17
17
  - ESLint Flat Config 顺序、文件作用域、解析器和插件注册
18
- - JavaScript、TypeScript、Vue、JSON 方言、Markdown、RegExp 与 import 集成
18
+ - JavaScript、TypeScript、Vue、React、Angular、JSON 方言、Markdown、RegExp 与 import 集成
19
19
  - 浏览器、Node.js、通用环境和项目自定义全局变量
20
20
  - Lodash 静态导入策略、清单排序与 Prettier 职责边界
21
21
  - README、规则风险说明、贡献流程、CI、测试和发布前检查
@@ -27,6 +27,8 @@
27
27
  | 公共 API | 通过 | 根入口提供 `fastConfig`、`defaultConfigOptions`、`defineRules` 和相关类型 |
28
28
  | Flat Config | 通过 | 所有语言和插件配置限定到明确文件范围,项目覆写最后应用 |
29
29
  | Vue 3 | 通过 | `vue-eslint-parser` 处理 SFC,TypeScript 解析器正确嵌套 |
30
+ | React | 通过 | 按需覆盖 JSX/TSX、组件、官方 Hooks、Compiler 诊断与 DOM 安全 |
31
+ | Angular | 通过 | 按需覆盖框架 TypeScript、外部 HTML、内联模板与模板无障碍 |
30
32
  | TypeScript | 通过 | 默认使用推荐规则,可选 Project Service 类型感知模式 |
31
33
  | JavaScript | 通过 | 应用 `@eslint/js` 推荐规则并区分应用环境与 Node.js 工程文件 |
32
34
  | 数据与文档文件 | 通过 | JSON、JSONC、JSON5 和 Markdown 分别使用对应语言配置 |
@@ -34,7 +36,7 @@
34
36
  | Lodash 策略 | 通过 | 可选统一 `lodash` 或 `lodash-unified`,默认不限制项目依赖选择 |
35
37
  | 清单排序 | 通过 | 默认关闭;启用后不会重排 `package.json#exports` 条件键 |
36
38
  | Prettier | 通过 | 只关闭冲突规则,格式化由 Prettier CLI 或编辑器负责 |
37
- | 构建与发布 | 通过 | tsup 生成 ESM、声明和 source map,`prepack` 执行完整质量门禁 |
39
+ | 构建与发布 | 通过 | tsdown 生成 `.mjs`、`.d.mts` source map,`prepack` 执行完整质量门禁 |
38
40
  | 自动化验证 | 通过 | 运行时测试、消费者类型测试、格式检查、静态检查和 Node.js 多版本 CI |
39
41
 
40
42
  ## 配置组合模型
@@ -43,7 +45,7 @@
43
45
 
44
46
  1. 内置忽略项、项目附加忽略项和可选 `.gitignore`。
45
47
  2. 应用运行环境、项目全局变量和 Node.js 工程文件全局变量。
46
- 3. JavaScript、import-x、Lodash 策略、RegExp、TypeScript、JSON 方言、Vue 和 Markdown 配置。
48
+ 3. JavaScript、import-x、Lodash 策略、RegExp、TypeScript、JSON 方言、Vue、React、Angular 和 Markdown 配置。
47
49
  4. 可选 `package.json`、`tsconfig*.json` 排序配置。
48
50
  5. Prettier 冲突关闭配置。
49
51
  6. 工厂级 `rules` 与调用方传入的文件级覆写。
@@ -56,6 +58,7 @@
56
58
  - 高影响、可自动修复、安全相关和按需启用规则使用统一标签。
57
59
  - 默认高影响规则同步记录在中英文风险指南中。
58
60
  - `src/typegen.d.ts` 由规则 schema 生成,不允许手工编辑。
61
+ - React、Angular 插件也参与类型生成,因此框架规则名与选项可获得同样的精确自动补全。
59
62
  - ESLint 或插件升级后必须运行 `pnpm typegen` 并审查类型差异。
60
63
  - `@fast-china/eslint-config/rules` 提供有完整注释的原始规则记录,便于高级组合。
61
64
 
@@ -79,17 +82,18 @@ pnpm pack --dry-run
79
82
  5. Prettier 格式检查。
80
83
  6. 消费者类型测试和运行时集成测试。
81
84
 
82
- 发布归档必须包含根入口和 `./rules` 子入口的 JavaScript、声明文件和 source map,且不得包含源码缓存、测试缓存或本地依赖目录。
85
+ 发布归档必须包含根入口和 `./rules` 子入口的 JavaScript 与声明文件,以及生成的 JavaScript、声明 source map;且不得包含源码缓存、测试缓存或本地依赖目录。
83
86
 
84
87
  ## CI 与发布边界
85
88
 
86
- GitHub Actions 在 `master`、`main` 推送和 Pull Request 上运行,覆盖 Node.js 22.13 和 24。CI 使用 pnpm 11.x、冻结锁文件安装、完整质量门禁和发布归档预览。
89
+ GitHub Actions 在 `master`、`main` 推送和 Pull Request 上运行,覆盖 Node.js 22.18 和 24.11。CI 使用 pnpm 11.x、冻结锁文件安装、完整质量门禁和发布归档预览。
87
90
 
88
91
  CI 只验证代码和发布包,不自动发布 npm。正式发布仍由维护者确认版本、Changelog、归档内容和 npm 身份后执行。
89
92
 
90
93
  ## 剩余风险
91
94
 
92
95
  - ESLint 和插件推荐预置会随依赖升级变化,每次升级都要检查实际生效配置和生成类型差异。
96
+ - React 与 Angular 默认关闭;启用 Angular 时必须同时启用 TypeScript,并把现代组件、变更检测、控制流和无障碍规则作为框架接入成本审查。
93
97
  - 类型感知模式依赖项目 `tsconfig.json` 覆盖被检查文件,复杂 monorepo 应显式设置 `tsconfigRootDir`。
94
98
  - 自动修复可能调整 import、模板属性、正则表达式和清单字段,应在独立提交中审查结果。
95
99
  - Lodash 策略只覆盖静态模块语法;需要限制 CommonJS 或动态导入的项目应追加自己的文件级规则或代码审查约定。