@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
@@ -1,309 +1,12 @@
1
- import { t as RuleOptions } from "../typegen.mjs";
2
- //#region src/rules/angular.d.ts
3
- /**
4
- * Angular TypeScript 推荐规则。
5
- *
6
- * Angular ESLint 的拆分插件不直接导出 Flat Config 预置;本记录与 angular-eslint
7
- * 22.x `tsRecommended` 保持一致,并逐条说明启用理由。
8
- */
9
- declare const angularRules: {
10
- "@angular-eslint/contextual-lifecycle": "error";
11
- "@angular-eslint/no-empty-lifecycle-method": "error";
12
- "@angular-eslint/no-input-rename": "error";
13
- "@angular-eslint/no-inputs-metadata-property": "error";
14
- "@angular-eslint/no-output-native": "error";
15
- "@angular-eslint/no-output-on-prefix": "error";
16
- "@angular-eslint/no-output-rename": "error";
17
- "@angular-eslint/no-outputs-metadata-property": "error";
18
- "@angular-eslint/prefer-inject": "error";
19
- "@angular-eslint/prefer-on-push-component-change-detection": "error";
20
- "@angular-eslint/prefer-standalone": "error";
21
- "@angular-eslint/use-pipe-transform-interface": "error";
22
- "@angular-eslint/use-lifecycle-interface": "warn";
23
- };
24
- /** Angular HTML 模板推荐规则,与 angular-eslint 22.x 的 `templateRecommended` 对齐。 */
25
- declare const angularTemplateRules: {
26
- "@angular-eslint/template/banana-in-box": "error";
27
- "@angular-eslint/template/eqeqeq": "error";
28
- "@angular-eslint/template/no-negated-async": "error";
29
- "@angular-eslint/template/prefer-control-flow": "error";
30
- };
31
- /** Angular 模板无障碍规则;可通过 `angular.templateAccessibility` 整组关闭。 */
32
- declare const angularTemplateAccessibilityRules: {
33
- "@angular-eslint/template/alt-text": "error";
34
- "@angular-eslint/template/click-events-have-key-events": "error";
35
- "@angular-eslint/template/elements-content": "error";
36
- "@angular-eslint/template/interactive-supports-focus": "error";
37
- "@angular-eslint/template/label-has-associated-control": "error";
38
- "@angular-eslint/template/mouse-events-have-key-events": "error";
39
- "@angular-eslint/template/no-autofocus": "error";
40
- "@angular-eslint/template/no-distracting-elements": "error";
41
- "@angular-eslint/template/role-has-required-aria": "error";
42
- "@angular-eslint/template/table-scope": "error";
43
- "@angular-eslint/template/valid-aria": "error";
44
- };
45
- //#endregion
46
- //#region src/rules/common.d.ts
47
- /**
48
- * 跨 JavaScript、TypeScript 与 Vue 脚本生效的公共规则。
49
- *
50
- * 维护约定:每条本地覆写都要说明启用原因;可能造成大面积改动、采用成本或
51
- * 行为变化的规则使用 `[高影响]` 标记,并同步维护 `docs/rules-risk.zh.md`。
52
- */
53
- declare const commonRules: {
54
- "array-callback-return": "error";
55
- "no-alert": "warn";
56
- "no-case-declarations": "error";
57
- "no-multi-str": "error";
58
- "no-with": "error";
59
- "no-void": ["error", {
60
- allowAsStatement: true;
61
- }];
62
- eqeqeq: ["error", "always", {
63
- null: "ignore";
64
- }];
65
- "prefer-exponentiation-operator": "error";
66
- "prefer-object-has-own": "error";
67
- "sort-imports": ["warn", {
68
- ignoreCase: false;
69
- ignoreDeclarationSort: true;
70
- ignoreMemberSort: false;
71
- memberSyntaxSortOrder: ["none", "all", "multiple", "single"];
72
- allowSeparatedGroups: false;
73
- }];
74
- };
75
- //#endregion
76
- //#region src/rules/import.d.ts
77
- /** 默认启用的模块导入正确性与排序规则。 */
78
- declare const importRules: {
79
- "import-x/first": "error";
80
- "import-x/no-duplicates": "error";
81
- "import-x/order": ["error", {
82
- groups: string[];
83
- "newlines-between": "always";
84
- alphabetize: {
85
- order: "asc";
86
- caseInsensitive: true;
87
- };
88
- warnOnUnassignedImports: true;
89
- }];
90
- "import-x/no-unresolved": "off";
91
- "import-x/namespace": "off";
92
- "import-x/default": "off";
93
- "import-x/no-named-as-default": "off";
94
- "import-x/no-named-as-default-member": "off";
95
- "import-x/named": "off";
96
- };
97
- //#endregion
98
- //#region src/rules/javascript.d.ts
99
- /**
100
- * JavaScript 本地覆写规则。
101
- * 高影响规则的解释与关闭方式见 `docs/rules-risk.zh.md`。
102
- */
103
- declare const javascriptRules: {
104
- "no-console": ["warn", {
105
- allow: [string, string];
106
- }];
107
- "no-debugger": "error";
108
- "no-constant-condition": ["error", {
109
- checkLoops: false;
110
- }];
111
- "no-restricted-syntax": ["error", string];
112
- "no-var": "error";
113
- "no-empty": ["error", {
114
- allowEmptyCatch: true;
115
- }];
116
- "no-irregular-whitespace": "error";
117
- "no-use-before-define": ["warn", {
118
- classes: true;
119
- functions: false;
120
- variables: true;
121
- }];
122
- "prefer-const": ["warn", {
123
- destructuring: "all";
124
- ignoreReadBeforeAssign: true;
125
- }];
126
- "prefer-arrow-callback": ["error", {
127
- allowNamedFunctions: false;
128
- allowUnboundThis: true;
129
- }];
130
- "object-shorthand": ["error", "always", {
131
- ignoreConstructors: false;
132
- avoidQuotes: true;
133
- }];
134
- "logical-assignment-operators": ["error", "always", {
135
- enforceForIfStatements: true;
136
- }];
137
- "prefer-object-spread": "error";
138
- "prefer-rest-params": "error";
139
- "prefer-spread": "error";
140
- "prefer-template": "error";
141
- "no-redeclare": "error";
142
- };
143
- //#endregion
144
- //#region src/rules/lodash.d.ts
145
- /**
146
- * 统一使用 `lodash-unified` 的可选导入策略。
147
- *
148
- * 该规则只约束静态 import/export 的模块来源,不会安装依赖,也不会检查动态
149
- * `import()` 或 CommonJS `require()`。选择此策略的项目应自行安装 `lodash-unified`。
150
- */
151
- declare const preferLodashUnifiedRules: {
152
- "no-restricted-imports": ["error", {
153
- paths: {
154
- name: string;
155
- message: string;
156
- }[];
157
- patterns: {
158
- group: string[];
159
- message: string;
160
- }[];
161
- }];
162
- };
163
- /**
164
- * 统一使用 `lodash` 的可选导入策略。
165
- *
166
- * 根入口和 `lodash/*` 子路径都允许使用;规则只负责避免与 `lodash-es` 或
167
- * `lodash-unified` 混用,不替项目决定整包导入或按方法导入。
168
- */
169
- declare const preferLodashRules: {
170
- "no-restricted-imports": ["error", {
171
- paths: {
172
- name: string;
173
- message: string;
174
- }[];
175
- patterns: {
176
- group: string[];
177
- message: string;
178
- }[];
179
- }];
180
- };
181
- //#endregion
182
- //#region src/rules/react.d.ts
183
- /**
184
- * React 本地覆写规则。
185
- *
186
- * `@eslint-react/recommended*` 负责组件、JSX、DOM 与 Web API 正确性,
187
- * `react-hooks/recommended` 负责 React 官方 Hooks 与 Compiler 诊断。这里关闭两套
188
- * 预置间的重复诊断,并补充少量明确的 DOM 安全约束。
189
- */
190
- declare const reactRules: {
191
- "@eslint-react/error-boundaries": "off";
192
- "@eslint-react/exhaustive-deps": "off";
193
- "@eslint-react/purity": "off";
194
- "@eslint-react/rules-of-hooks": "off";
195
- "@eslint-react/set-state-in-effect": "off";
196
- "@eslint-react/set-state-in-render": "off";
197
- "@eslint-react/static-components": "off";
198
- "@eslint-react/unsupported-syntax": "off";
199
- "@eslint-react/use-memo": "off";
200
- "@eslint-react/dom-no-missing-button-type": "error";
201
- "@eslint-react/dom-no-missing-iframe-sandbox": "warn";
202
- "@eslint-react/dom-no-unknown-property": "error";
203
- "@eslint-react/dom-no-unsafe-target-blank": "error";
204
- };
205
- //#endregion
206
- //#region src/rules/sort-package.d.ts
207
- /**
208
- * package.json 属性排序规则。
209
- *
210
- * `[高影响][可自动修复]`:仅在 `sortPackageJson: true` 时启用,首次修复可能重排大量字段。
211
- * 注意:这里故意不排序 `exports` 内部键;条件导出的键顺序具有模块解析语义。
212
- */
213
- declare const packageJsonSortRules: {
214
- "jsonc/sort-array-values": ["error", {
215
- order: {
216
- type: "asc";
217
- };
218
- pathPattern: string;
219
- }];
220
- "jsonc/sort-keys": ["error", {
221
- order: string[];
222
- pathPattern: string;
223
- }, {
224
- order: {
225
- type: "asc";
226
- };
227
- pathPattern: string;
228
- }, {
229
- order: {
230
- type: "asc";
231
- };
232
- pathPattern: string;
233
- }];
234
- };
235
- //#endregion
236
- //#region src/rules/sort-tsconfig.d.ts
237
- /**
238
- * tsconfig.json 属性排序规则。
239
- *
240
- * `[高影响][可自动修复]`:仅在 `sortTsconfig: true` 时启用,首次修复会重排大量字段,
241
- * 但只改变 JSONC 的阅读顺序,不改变 TypeScript 编译选项值。
242
- */
243
- declare const tsconfigJsonSortRules: {
244
- "jsonc/no-comments": "off";
245
- "jsonc/sort-keys": ["error", {
246
- order: string[];
247
- pathPattern: string;
248
- }, {
249
- order: string[];
250
- pathPattern: string;
251
- }];
252
- };
253
- //#endregion
254
- //#region src/rules/typescript.d.ts
255
- /**
256
- * TypeScript 本地覆写规则。
257
- * 这里补充 typescript-eslint 预置;高影响规则需同步维护风险文档。
258
- */
259
- declare const typescriptRules: {
260
- "@typescript-eslint/no-redeclare": "error";
261
- "@typescript-eslint/no-unused-vars": ["error", {
262
- args: "after-used";
263
- argsIgnorePattern: string;
264
- caughtErrors: "all";
265
- caughtErrorsIgnorePattern: string;
266
- ignoreRestSiblings: true;
267
- varsIgnorePattern: string;
268
- }];
269
- "@typescript-eslint/no-namespace": "off";
270
- "@typescript-eslint/no-explicit-any": "warn";
271
- "@typescript-eslint/no-require-imports": "error";
272
- "@typescript-eslint/no-unused-expressions": ["error", {
273
- allowShortCircuit: true;
274
- allowTernary: true;
275
- }];
276
- "@typescript-eslint/no-inferrable-types": "error";
277
- "@typescript-eslint/no-non-null-assertion": "warn";
278
- "@typescript-eslint/no-non-null-asserted-optional-chain": "error";
279
- "@typescript-eslint/consistent-type-imports": ["error", {
280
- disallowTypeAnnotations: false;
281
- fixStyle: "inline-type-imports";
282
- prefer: "type-imports";
283
- }];
284
- };
285
- //#endregion
286
- //#region src/rules/vue.d.ts
287
- /**
288
- * Vue SFC 本地覆写规则。
289
- * 上游 `flat/recommended` 已覆盖基础正确性,这里只记录项目取舍与附加约束。
290
- */
291
- declare const vueRules: {
292
- "vue/no-v-html": "warn";
293
- "vue/require-default-prop": "off";
294
- "vue/require-explicit-emits": "error";
295
- "vue/multi-word-component-names": "off";
296
- "vue/prefer-import-from-vue": "warn";
297
- "vue/no-dupe-keys": "error";
298
- "vue/no-mutating-props": "error";
299
- "vue/no-reserved-component-names": "error";
300
- "vue/no-v-text-v-html-on-component": "error";
301
- "vue/custom-event-name-casing": ["error", "camelCase"];
302
- "vue/one-component-per-file": "off";
303
- "vue/attributes-order": ["error", {
304
- order: ("DEFINITION" | "LIST_RENDERING" | "CONDITIONALS" | "RENDER_MODIFIERS" | "GLOBAL" | "UNIQUE" | "OTHER_ATTR" | "EVENTS" | "CONTENT")[];
305
- }];
306
- };
307
- //#endregion
308
- export { type RuleOptions, angularRules, angularTemplateAccessibilityRules, angularTemplateRules, commonRules, importRules, javascriptRules, packageJsonSortRules, preferLodashRules, preferLodashUnifiedRules, reactRules, tsconfigJsonSortRules, typescriptRules, vueRules };
309
- //# sourceMappingURL=index.d.mts.map
1
+ import { RuleOptions } from "../typegen.mjs";
2
+ import { angularRules, angularTemplateAccessibilityRules, angularTemplateRules } from "./angular.mjs";
3
+ import { commonRules } from "./common.mjs";
4
+ import { importRules } from "./import.mjs";
5
+ import { javascriptRules } from "./javascript.mjs";
6
+ import { preferLodashRules, preferLodashUnifiedRules } from "./lodash.mjs";
7
+ import { reactRules } from "./react.mjs";
8
+ import { packageJsonSortRules } from "./sort-package.mjs";
9
+ import { tsconfigJsonSortRules } from "./sort-tsconfig.mjs";
10
+ import { typescriptRules } from "./typescript.mjs";
11
+ import { vueRules } from "./vue.mjs";
12
+ export { type RuleOptions, angularRules, angularTemplateAccessibilityRules, angularTemplateRules, commonRules, importRules, javascriptRules, packageJsonSortRules, preferLodashRules, preferLodashUnifiedRules, reactRules, tsconfigJsonSortRules, typescriptRules, vueRules };
@@ -1,2 +1,11 @@
1
- import { a as reactRules, c as javascriptRules, d as angularRules, f as angularTemplateAccessibilityRules, i as packageJsonSortRules, l as importRules, n as typescriptRules, o as preferLodashRules, p as angularTemplateRules, r as tsconfigJsonSortRules, s as preferLodashUnifiedRules, t as vueRules, u as commonRules } from "../rules.mjs";
1
+ import { angularRules, angularTemplateAccessibilityRules, angularTemplateRules } from "./angular.mjs";
2
+ import { commonRules } from "./common.mjs";
3
+ import { importRules } from "./import.mjs";
4
+ import { javascriptRules } from "./javascript.mjs";
5
+ import { preferLodashRules, preferLodashUnifiedRules } from "./lodash.mjs";
6
+ import { reactRules } from "./react.mjs";
7
+ import { packageJsonSortRules } from "./sort-package.mjs";
8
+ import { tsconfigJsonSortRules } from "./sort-tsconfig.mjs";
9
+ import { typescriptRules } from "./typescript.mjs";
10
+ import { vueRules } from "./vue.mjs";
2
11
  export { angularRules, angularTemplateAccessibilityRules, angularTemplateRules, commonRules, importRules, javascriptRules, packageJsonSortRules, preferLodashRules, preferLodashUnifiedRules, reactRules, tsconfigJsonSortRules, typescriptRules, vueRules };
@@ -0,0 +1,48 @@
1
+ //#region src/rules/javascript.d.ts
2
+ /**
3
+ * JavaScript 本地覆写规则。
4
+ * 高影响规则的解释与关闭方式见 `docs/rules-risk.zh.md`。
5
+ */
6
+ declare const javascriptRules: {
7
+ "no-console": ["warn", {
8
+ allow: [string, string];
9
+ }];
10
+ "no-debugger": "error";
11
+ "no-constant-condition": ["error", {
12
+ checkLoops: false;
13
+ }];
14
+ "no-restricted-syntax": ["error", string];
15
+ "no-var": "error";
16
+ "no-empty": ["error", {
17
+ allowEmptyCatch: true;
18
+ }];
19
+ "no-irregular-whitespace": "error";
20
+ "no-use-before-define": ["warn", {
21
+ classes: true;
22
+ functions: false;
23
+ variables: true;
24
+ }];
25
+ "prefer-const": ["warn", {
26
+ destructuring: "all";
27
+ ignoreReadBeforeAssign: true;
28
+ }];
29
+ "prefer-arrow-callback": ["error", {
30
+ allowNamedFunctions: false;
31
+ allowUnboundThis: true;
32
+ }];
33
+ "object-shorthand": ["error", "always", {
34
+ ignoreConstructors: false;
35
+ avoidQuotes: true;
36
+ }];
37
+ "logical-assignment-operators": ["error", "always", {
38
+ enforceForIfStatements: true;
39
+ }];
40
+ "prefer-object-spread": "error";
41
+ "prefer-rest-params": "error";
42
+ "prefer-spread": "error";
43
+ "prefer-template": "error";
44
+ "no-redeclare": "error";
45
+ };
46
+ //#endregion
47
+ export { javascriptRules };
48
+ //# sourceMappingURL=javascript.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"javascript.d.mts","names":[],"sources":["../../src/rules/javascript.ts"],"mappings":";;;;;cAMa"}
@@ -0,0 +1,49 @@
1
+ //#region src/rules/javascript.ts
2
+ /**
3
+ * JavaScript 本地覆写规则。
4
+ * 高影响规则的解释与关闭方式见 `docs/rules-risk.zh.md`。
5
+ */
6
+ const javascriptRules = {
7
+ "no-console": ["warn", { allow: ["warn", "error"] }],
8
+ "no-debugger": "error",
9
+ "no-constant-condition": ["error", { checkLoops: false }],
10
+ "no-restricted-syntax": ["error", "LabeledStatement"],
11
+ "no-var": "error",
12
+ "no-empty": ["error", { allowEmptyCatch: true }],
13
+ "no-irregular-whitespace": "error",
14
+ "no-use-before-define": ["warn", {
15
+ classes: true,
16
+ functions: false,
17
+ variables: true
18
+ }],
19
+ "prefer-const": ["warn", {
20
+ destructuring: "all",
21
+ ignoreReadBeforeAssign: true
22
+ }],
23
+ "prefer-arrow-callback": ["error", {
24
+ allowNamedFunctions: false,
25
+ allowUnboundThis: true
26
+ }],
27
+ "object-shorthand": [
28
+ "error",
29
+ "always",
30
+ {
31
+ ignoreConstructors: false,
32
+ avoidQuotes: true
33
+ }
34
+ ],
35
+ "logical-assignment-operators": [
36
+ "error",
37
+ "always",
38
+ { enforceForIfStatements: true }
39
+ ],
40
+ "prefer-object-spread": "error",
41
+ "prefer-rest-params": "error",
42
+ "prefer-spread": "error",
43
+ "prefer-template": "error",
44
+ "no-redeclare": "error"
45
+ };
46
+ //#endregion
47
+ export { javascriptRules };
48
+
49
+ //# sourceMappingURL=javascript.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"javascript.mjs","names":[],"sources":["../../src/rules/javascript.ts"],"sourcesContent":["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"],"mappings":";;;;;AAMA,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"}
@@ -0,0 +1,40 @@
1
+ //#region src/rules/lodash.d.ts
2
+ /**
3
+ * 统一使用 `lodash-unified` 的可选导入策略。
4
+ *
5
+ * 该规则只约束静态 import/export 的模块来源,不会安装依赖,也不会检查动态
6
+ * `import()` 或 CommonJS `require()`。选择此策略的项目应自行安装 `lodash-unified`。
7
+ */
8
+ declare const preferLodashUnifiedRules: {
9
+ "no-restricted-imports": ["error", {
10
+ paths: {
11
+ name: string;
12
+ message: string;
13
+ }[];
14
+ patterns: {
15
+ group: string[];
16
+ message: string;
17
+ }[];
18
+ }];
19
+ };
20
+ /**
21
+ * 统一使用 `lodash` 的可选导入策略。
22
+ *
23
+ * 根入口和 `lodash/*` 子路径都允许使用;规则只负责避免与 `lodash-es` 或
24
+ * `lodash-unified` 混用,不替项目决定整包导入或按方法导入。
25
+ */
26
+ declare const preferLodashRules: {
27
+ "no-restricted-imports": ["error", {
28
+ paths: {
29
+ name: string;
30
+ message: string;
31
+ }[];
32
+ patterns: {
33
+ group: string[];
34
+ message: string;
35
+ }[];
36
+ }];
37
+ };
38
+ //#endregion
39
+ export { preferLodashRules, preferLodashUnifiedRules };
40
+ //# sourceMappingURL=lodash.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"lodash.d.mts","names":[],"sources":["../../src/rules/lodash.ts"],"mappings":";;;;;;;cAQa;;;;;;;;;;;;;;;;;;cA+BA"}
@@ -0,0 +1,43 @@
1
+ //#region src/rules/lodash.ts
2
+ /**
3
+ * 统一使用 `lodash-unified` 的可选导入策略。
4
+ *
5
+ * 该规则只约束静态 import/export 的模块来源,不会安装依赖,也不会检查动态
6
+ * `import()` 或 CommonJS `require()`。选择此策略的项目应自行安装 `lodash-unified`。
7
+ */
8
+ const preferLodashUnifiedRules = { "no-restricted-imports": ["error", {
9
+ paths: [{
10
+ name: "lodash",
11
+ message: "Use \"lodash-unified\" consistently instead of \"lodash\"."
12
+ }, {
13
+ name: "lodash-es",
14
+ message: "Use \"lodash-unified\" consistently instead of \"lodash-es\"."
15
+ }],
16
+ patterns: [{
17
+ group: ["lodash/*", "lodash-es/*"],
18
+ message: "Use exports from \"lodash-unified\" instead of Lodash subpath imports."
19
+ }]
20
+ }] };
21
+ /**
22
+ * 统一使用 `lodash` 的可选导入策略。
23
+ *
24
+ * 根入口和 `lodash/*` 子路径都允许使用;规则只负责避免与 `lodash-es` 或
25
+ * `lodash-unified` 混用,不替项目决定整包导入或按方法导入。
26
+ */
27
+ const preferLodashRules = { "no-restricted-imports": ["error", {
28
+ paths: [{
29
+ name: "lodash-es",
30
+ message: "Use \"lodash\" consistently instead of \"lodash-es\"."
31
+ }, {
32
+ name: "lodash-unified",
33
+ message: "Use \"lodash\" consistently instead of \"lodash-unified\"."
34
+ }],
35
+ patterns: [{
36
+ group: ["lodash-es/*", "lodash-unified/*"],
37
+ message: "Use \"lodash\" or a \"lodash/*\" subpath consistently."
38
+ }]
39
+ }] };
40
+ //#endregion
41
+ export { preferLodashRules, preferLodashUnifiedRules };
42
+
43
+ //# sourceMappingURL=lodash.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"lodash.mjs","names":[],"sources":["../../src/rules/lodash.ts"],"sourcesContent":["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"],"mappings":";;;;;;;AAQA,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"}
@@ -0,0 +1,26 @@
1
+ //#region src/rules/react.d.ts
2
+ /**
3
+ * React 本地覆写规则。
4
+ *
5
+ * `@eslint-react/recommended*` 负责组件、JSX、DOM 与 Web API 正确性,
6
+ * `react-hooks/recommended` 负责 React 官方 Hooks 与 Compiler 诊断。这里关闭两套
7
+ * 预置间的重复诊断,并补充少量明确的 DOM 安全约束。
8
+ */
9
+ declare const reactRules: {
10
+ "@eslint-react/error-boundaries": "off";
11
+ "@eslint-react/exhaustive-deps": "off";
12
+ "@eslint-react/purity": "off";
13
+ "@eslint-react/rules-of-hooks": "off";
14
+ "@eslint-react/set-state-in-effect": "off";
15
+ "@eslint-react/set-state-in-render": "off";
16
+ "@eslint-react/static-components": "off";
17
+ "@eslint-react/unsupported-syntax": "off";
18
+ "@eslint-react/use-memo": "off";
19
+ "@eslint-react/dom-no-missing-button-type": "error";
20
+ "@eslint-react/dom-no-missing-iframe-sandbox": "warn";
21
+ "@eslint-react/dom-no-unknown-property": "error";
22
+ "@eslint-react/dom-no-unsafe-target-blank": "error";
23
+ };
24
+ //#endregion
25
+ export { reactRules };
26
+ //# sourceMappingURL=react.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"react.d.mts","names":[],"sources":["../../src/rules/react.ts"],"mappings":";;;;;;;;cASa"}
@@ -0,0 +1,27 @@
1
+ //#region src/rules/react.ts
2
+ /**
3
+ * React 本地覆写规则。
4
+ *
5
+ * `@eslint-react/recommended*` 负责组件、JSX、DOM 与 Web API 正确性,
6
+ * `react-hooks/recommended` 负责 React 官方 Hooks 与 Compiler 诊断。这里关闭两套
7
+ * 预置间的重复诊断,并补充少量明确的 DOM 安全约束。
8
+ */
9
+ const reactRules = {
10
+ "@eslint-react/error-boundaries": "off",
11
+ "@eslint-react/exhaustive-deps": "off",
12
+ "@eslint-react/purity": "off",
13
+ "@eslint-react/rules-of-hooks": "off",
14
+ "@eslint-react/set-state-in-effect": "off",
15
+ "@eslint-react/set-state-in-render": "off",
16
+ "@eslint-react/static-components": "off",
17
+ "@eslint-react/unsupported-syntax": "off",
18
+ "@eslint-react/use-memo": "off",
19
+ "@eslint-react/dom-no-missing-button-type": "error",
20
+ "@eslint-react/dom-no-missing-iframe-sandbox": "warn",
21
+ "@eslint-react/dom-no-unknown-property": "error",
22
+ "@eslint-react/dom-no-unsafe-target-blank": "error"
23
+ };
24
+ //#endregion
25
+ export { reactRules };
26
+
27
+ //# sourceMappingURL=react.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"react.mjs","names":[],"sources":["../../src/rules/react.ts"],"sourcesContent":["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"],"mappings":";;;;;;;;AASA,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"}
@@ -0,0 +1,32 @@
1
+ //#region src/rules/sort-package.d.ts
2
+ /**
3
+ * package.json 属性排序规则。
4
+ *
5
+ * `[高影响][可自动修复]`:仅在 `sortPackageJson: true` 时启用,首次修复可能重排大量字段。
6
+ * 注意:这里故意不排序 `exports` 内部键;条件导出的键顺序具有模块解析语义。
7
+ */
8
+ declare const packageJsonSortRules: {
9
+ "jsonc/sort-array-values": ["error", {
10
+ order: {
11
+ type: "asc";
12
+ };
13
+ pathPattern: string;
14
+ }];
15
+ "jsonc/sort-keys": ["error", {
16
+ order: string[];
17
+ pathPattern: string;
18
+ }, {
19
+ order: {
20
+ type: "asc";
21
+ };
22
+ pathPattern: string;
23
+ }, {
24
+ order: {
25
+ type: "asc";
26
+ };
27
+ pathPattern: string;
28
+ }];
29
+ };
30
+ //#endregion
31
+ export { packageJsonSortRules };
32
+ //# sourceMappingURL=sort-package.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sort-package.d.mts","names":[],"sources":["../../src/rules/sort-package.ts"],"mappings":";;;;;;;cAQa"}