@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/CHANGELOG.md +15 -0
- package/README.md +73 -24
- package/README.zh.md +55 -6
- package/dist/{define-rules-CSwQ8C1q.d.ts → define-rules.d.mts} +6010 -4651
- package/dist/define-rules.d.mts.map +1 -0
- package/dist/index.d.mts +181 -0
- package/dist/index.d.mts.map +1 -0
- package/dist/index.mjs +475 -0
- package/dist/index.mjs.map +1 -0
- package/dist/rules/index.d.mts +309 -0
- package/dist/rules/index.d.mts.map +1 -0
- package/dist/rules/index.mjs +2 -0
- package/dist/rules.mjs +485 -0
- package/dist/rules.mjs.map +1 -0
- package/docs/engineering-audit.zh.md +12 -8
- package/docs/rules-risk.md +8 -2
- package/docs/rules-risk.zh.md +8 -2
- package/package.json +24 -17
- package/dist/index.d.ts +0 -133
- package/dist/index.js +0 -809
- package/dist/index.js.map +0 -1
- package/dist/rules/index.d.ts +0 -234
- package/dist/rules/index.js +0 -500
- package/dist/rules/index.js.map +0 -1
package/dist/index.mjs
ADDED
|
@@ -0,0 +1,475 @@
|
|
|
1
|
+
import { a as reactRules, c as javascriptRules, d as angularRules, f as angularTemplateAccessibilityRules, i as packageJsonSortRules, l as importRules, m as defineRules, n as typescriptRules, o as preferLodashRules, p as angularTemplateRules, r as tsconfigJsonSortRules, s as preferLodashUnifiedRules, t as vueRules, u as commonRules } from "./rules.mjs";
|
|
2
|
+
import { defineConfig, globalIgnores } from "eslint/config";
|
|
3
|
+
import angularPlugin from "@angular-eslint/eslint-plugin";
|
|
4
|
+
import angularTemplatePlugin from "@angular-eslint/eslint-plugin-template";
|
|
5
|
+
import angularTemplateParser from "@angular-eslint/template-parser";
|
|
6
|
+
import globals from "globals";
|
|
7
|
+
import eslintConfigFlatGitignore from "eslint-config-flat-gitignore";
|
|
8
|
+
import eslintPluginImportX from "eslint-plugin-import-x";
|
|
9
|
+
import eslint from "@eslint/js";
|
|
10
|
+
import eslintPluginJsonc from "eslint-plugin-jsonc";
|
|
11
|
+
import eslintMarkdown from "@eslint/markdown";
|
|
12
|
+
import eslintConfigPrettierFlat from "eslint-config-prettier/flat";
|
|
13
|
+
import eslintReact from "@eslint-react/eslint-plugin";
|
|
14
|
+
import eslintPluginReactHooks from "eslint-plugin-react-hooks";
|
|
15
|
+
import eslintPluginRegexp from "eslint-plugin-regexp";
|
|
16
|
+
import tseslint from "typescript-eslint";
|
|
17
|
+
import eslintPluginVue from "eslint-plugin-vue";
|
|
18
|
+
import vueEslintParser from "vue-eslint-parser";
|
|
19
|
+
//#region src/constants/index.ts
|
|
20
|
+
/** JavaScript 与 JSX 文件;扩展名列表与 Node.js ESM/CJS 约定保持一致。 */
|
|
21
|
+
const GLOBS_JAVASCRIPT = ["**/*.{js,cjs,mjs,jsx}"];
|
|
22
|
+
/** TypeScript 与 TSX 文件;包含 TypeScript 的 ESM/CJS 专用扩展名。 */
|
|
23
|
+
const GLOBS_TYPESCRIPT = ["**/*.{ts,cts,mts,tsx}"];
|
|
24
|
+
/** Vue 3 单文件组件。 */
|
|
25
|
+
const GLOB_VUE = "**/*.vue";
|
|
26
|
+
/** Angular 组件、指令、服务等框架源码;Angular CLI 项目以 `.ts` 为标准源码扩展名。 */
|
|
27
|
+
const GLOB_ANGULAR_TYPESCRIPT = "**/*.ts";
|
|
28
|
+
/** Angular 外部模板;内联模板由 Angular 处理器提取后复用同一模板配置。 */
|
|
29
|
+
const GLOB_ANGULAR_TEMPLATE = "**/*.html";
|
|
30
|
+
/** ESLint JSON language 支持的三种 JSON 方言。 */
|
|
31
|
+
const GLOB_JSON = "**/*.json";
|
|
32
|
+
const GLOB_JSONC = "**/*.jsonc";
|
|
33
|
+
const GLOB_JSON5 = "**/*.json5";
|
|
34
|
+
/** Markdown 文档。 */
|
|
35
|
+
const GLOB_MARKDOWN = "**/*.md";
|
|
36
|
+
/** 默认由 JavaScript、TypeScript 和 Vue 规则处理的全部代码文件。 */
|
|
37
|
+
const GLOBS_CODE = [
|
|
38
|
+
...GLOBS_JAVASCRIPT,
|
|
39
|
+
...GLOBS_TYPESCRIPT,
|
|
40
|
+
GLOB_VUE
|
|
41
|
+
];
|
|
42
|
+
/**
|
|
43
|
+
* 应额外获得 Node.js 全局变量的工程文件。
|
|
44
|
+
*
|
|
45
|
+
* 这些模式还会与当前已启用的 JavaScript/TypeScript 文件模式做 AND 匹配,
|
|
46
|
+
* 因而关闭 TypeScript 后不会意外让 ESLint 接管 `.ts` 文件。
|
|
47
|
+
*/
|
|
48
|
+
const GLOBS_NODE_TOOLING = [
|
|
49
|
+
"**/*.{config,setup}.{js,cjs,mjs,jsx,ts,cts,mts,tsx}",
|
|
50
|
+
"**/{scripts,bin}/**/*.{js,cjs,mjs,jsx,ts,cts,mts,tsx}",
|
|
51
|
+
"**/{test,tests}/**/*.{js,cjs,mjs,jsx,ts,cts,mts,tsx}",
|
|
52
|
+
"**/*.{test,spec}.{js,cjs,mjs,jsx,ts,cts,mts,tsx}",
|
|
53
|
+
"**/cli.{js,cjs,mjs,ts,cts,mts}"
|
|
54
|
+
];
|
|
55
|
+
/** TypeScript 配置文件;它们使用 JSONC 语法并允许注释。 */
|
|
56
|
+
const GLOBS_TSCONFIG = ["**/tsconfig.json", "**/tsconfig.*.json"];
|
|
57
|
+
/** 不应交给 JSON/Markdown 解析器处理的包管理器锁文件。 */
|
|
58
|
+
const GLOBS_LOCKFILES = [
|
|
59
|
+
"**/package-lock.json",
|
|
60
|
+
"**/yarn.lock",
|
|
61
|
+
"**/pnpm-lock.yaml",
|
|
62
|
+
"**/bun.lock",
|
|
63
|
+
"**/bun.lockb",
|
|
64
|
+
"**/deno.lock"
|
|
65
|
+
];
|
|
66
|
+
//#endregion
|
|
67
|
+
//#region src/configs/angular.ts
|
|
68
|
+
/**
|
|
69
|
+
* 创建 Angular TypeScript、外部 HTML 模板与内联模板配置。
|
|
70
|
+
*
|
|
71
|
+
* Angular 支持依赖工厂的 TypeScript 配置先注册 typescript-eslint 解析器;模板由
|
|
72
|
+
* Angular 专用 parser 解析,内联模板通过官方 processor 复用同一套 HTML 规则。
|
|
73
|
+
*/
|
|
74
|
+
const createAngularConfigs = ({ inlineTemplates = true, templateAccessibility = true } = {}) => defineConfig([{
|
|
75
|
+
name: inlineTemplates ? "@fast-china/angular/typescript-with-inline-templates" : "@fast-china/angular/typescript",
|
|
76
|
+
files: [GLOB_ANGULAR_TYPESCRIPT],
|
|
77
|
+
plugins: { "@angular-eslint": angularPlugin },
|
|
78
|
+
...inlineTemplates ? { processor: angularTemplatePlugin.processors["extract-inline-html"] } : {},
|
|
79
|
+
rules: angularRules
|
|
80
|
+
}, {
|
|
81
|
+
name: templateAccessibility ? "@fast-china/angular/template-accessibility" : "@fast-china/angular/template",
|
|
82
|
+
files: [GLOB_ANGULAR_TEMPLATE],
|
|
83
|
+
languageOptions: { parser: angularTemplateParser },
|
|
84
|
+
plugins: { "@angular-eslint/template": angularTemplatePlugin },
|
|
85
|
+
rules: {
|
|
86
|
+
...angularTemplateRules,
|
|
87
|
+
...templateAccessibility ? angularTemplateAccessibilityRules : {}
|
|
88
|
+
}
|
|
89
|
+
}]);
|
|
90
|
+
//#endregion
|
|
91
|
+
//#region src/configs/common.ts
|
|
92
|
+
/**
|
|
93
|
+
* 创建跨 JavaScript、TypeScript 与 Vue 脚本生效的基础配置。
|
|
94
|
+
*
|
|
95
|
+
* 除公共规则外,这里还把无效的 `eslint-disable` 指令提升为错误,避免规则被移除后
|
|
96
|
+
* 留下长期失效的抑制注释。
|
|
97
|
+
*/
|
|
98
|
+
const createBaseConfigs = (files = GLOBS_CODE) => defineConfig([{
|
|
99
|
+
name: "@fast-china/common",
|
|
100
|
+
files: [...files],
|
|
101
|
+
linterOptions: { reportUnusedDisableDirectives: "error" },
|
|
102
|
+
rules: commonRules
|
|
103
|
+
}]);
|
|
104
|
+
//#endregion
|
|
105
|
+
//#region src/configs/environment.ts
|
|
106
|
+
const createEnvironmentConfigs = ({ environment = "browser", files = GLOBS_CODE, nodeFiles = GLOBS_JAVASCRIPT, globals: projectGlobals = {} } = {}) => {
|
|
107
|
+
const runtimeGlobals = {
|
|
108
|
+
...environment !== "node" ? globals.browser : {},
|
|
109
|
+
...environment !== "browser" ? globals.node : {},
|
|
110
|
+
...projectGlobals
|
|
111
|
+
};
|
|
112
|
+
const nodeToolingFiles = GLOBS_NODE_TOOLING.flatMap((nodeGlob) => nodeFiles.map((fileGlob) => [nodeGlob, fileGlob]));
|
|
113
|
+
return defineConfig([{
|
|
114
|
+
name: `@fast-china/globals/${environment}`,
|
|
115
|
+
files: [...files],
|
|
116
|
+
languageOptions: { globals: runtimeGlobals }
|
|
117
|
+
}, {
|
|
118
|
+
name: "@fast-china/globals/node-tooling",
|
|
119
|
+
files: nodeToolingFiles,
|
|
120
|
+
languageOptions: { globals: globals.node },
|
|
121
|
+
rules: { "no-console": "off" }
|
|
122
|
+
}]);
|
|
123
|
+
};
|
|
124
|
+
//#endregion
|
|
125
|
+
//#region src/configs/ignores.ts
|
|
126
|
+
/**
|
|
127
|
+
* 默认忽略依赖、构建结果、缓存、生成文件和包管理器锁文件。
|
|
128
|
+
*
|
|
129
|
+
* 不忽略 `src`、`public`、测试夹具或普通 Markdown 文档,避免共享配置静默漏检
|
|
130
|
+
* 应由项目维护的文件。
|
|
131
|
+
*/
|
|
132
|
+
const DEFAULT_IGNORE_PATTERNS = Object.freeze([
|
|
133
|
+
"**/node_modules/**",
|
|
134
|
+
"**/{dist,build,coverage,output,temp,tmp}/**",
|
|
135
|
+
"**/{.cache,.nuxt,.output,.vercel,.nitro}/**",
|
|
136
|
+
"**/{.vitepress/cache,.vite-inspect}/**",
|
|
137
|
+
"**/__snapshots__/**",
|
|
138
|
+
"**/*.min.*",
|
|
139
|
+
"**/auto-import?(s).d.ts",
|
|
140
|
+
"**/components.d.ts",
|
|
141
|
+
...GLOBS_LOCKFILES
|
|
142
|
+
]);
|
|
143
|
+
/** 创建全局忽略配置,并在默认集合之后追加项目自定义模式。 */
|
|
144
|
+
const createGlobalIgnores = (additionalPatterns = []) => globalIgnores([...DEFAULT_IGNORE_PATTERNS, ...additionalPatterns], "@fast-china/ignores/global");
|
|
145
|
+
/** 读取运行 ESLint 的项目根目录中的 `.gitignore`。 */
|
|
146
|
+
const createGitignoreConfigs = () => defineConfig([{
|
|
147
|
+
name: "@fast-china/ignores/git",
|
|
148
|
+
...eslintConfigFlatGitignore({ strict: false })
|
|
149
|
+
}]);
|
|
150
|
+
//#endregion
|
|
151
|
+
//#region src/configs/import.ts
|
|
152
|
+
/**
|
|
153
|
+
* 创建模块导入规则配置。
|
|
154
|
+
*
|
|
155
|
+
* 共享库不猜测项目的路径别名或解析器,因此只继承 import-x 的推荐能力,
|
|
156
|
+
* 与 resolver 强耦合且容易误报的规则会在本地规则记录中显式关闭。
|
|
157
|
+
*/
|
|
158
|
+
const createImportConfigs = (files = GLOBS_CODE) => defineConfig([{
|
|
159
|
+
name: "@fast-china/import",
|
|
160
|
+
files: [...files],
|
|
161
|
+
extends: [eslintPluginImportX.flatConfigs.recommended],
|
|
162
|
+
rules: importRules
|
|
163
|
+
}]);
|
|
164
|
+
//#endregion
|
|
165
|
+
//#region src/configs/javascript.ts
|
|
166
|
+
/**
|
|
167
|
+
* 创建 JavaScript/JSX 配置。
|
|
168
|
+
*
|
|
169
|
+
* `@eslint/js` 提供基础正确性规则,本仓库只在其后补充有明确维护理由的规则。
|
|
170
|
+
*/
|
|
171
|
+
const createJavaScriptConfigs = (files = GLOBS_JAVASCRIPT) => defineConfig([{
|
|
172
|
+
name: "@fast-china/javascript",
|
|
173
|
+
files: [...files],
|
|
174
|
+
extends: [eslint.configs.recommended],
|
|
175
|
+
languageOptions: {
|
|
176
|
+
ecmaVersion: "latest",
|
|
177
|
+
parserOptions: { ecmaFeatures: { jsx: true } }
|
|
178
|
+
},
|
|
179
|
+
rules: javascriptRules
|
|
180
|
+
}]);
|
|
181
|
+
//#endregion
|
|
182
|
+
//#region src/configs/json.ts
|
|
183
|
+
/**
|
|
184
|
+
* 创建 JSON、JSONC 与 JSON5 配置。
|
|
185
|
+
*
|
|
186
|
+
* 三种方言使用各自的官方推荐预置,避免严格 JSON 规则错误覆盖允许注释或尾随逗号的文件。
|
|
187
|
+
*/
|
|
188
|
+
const createJsonConfigs = () => defineConfig([
|
|
189
|
+
{
|
|
190
|
+
name: "@fast-china/json/json",
|
|
191
|
+
files: [GLOB_JSON],
|
|
192
|
+
extends: [eslintPluginJsonc.configs["flat/recommended-with-json"]]
|
|
193
|
+
},
|
|
194
|
+
{
|
|
195
|
+
name: "@fast-china/json/jsonc",
|
|
196
|
+
files: [GLOB_JSONC],
|
|
197
|
+
extends: [eslintPluginJsonc.configs["flat/recommended-with-jsonc"]]
|
|
198
|
+
},
|
|
199
|
+
{
|
|
200
|
+
name: "@fast-china/json/json5",
|
|
201
|
+
files: [GLOB_JSON5],
|
|
202
|
+
extends: [eslintPluginJsonc.configs["flat/recommended-with-json5"]]
|
|
203
|
+
},
|
|
204
|
+
{
|
|
205
|
+
name: "@fast-china/json/vscode-settings",
|
|
206
|
+
files: ["**/.vscode/settings.json"],
|
|
207
|
+
rules: { "jsonc/no-comments": "off" }
|
|
208
|
+
}
|
|
209
|
+
]);
|
|
210
|
+
//#endregion
|
|
211
|
+
//#region src/configs/lodash.ts
|
|
212
|
+
/**
|
|
213
|
+
* 创建 Lodash 静态导入约束。
|
|
214
|
+
*
|
|
215
|
+
* 该配置使用 ESLint 核心规则,因此不依赖 import-x 开关或额外插件。
|
|
216
|
+
*/
|
|
217
|
+
const createLodashConfigs = (preference, files = GLOBS_CODE) => defineConfig([{
|
|
218
|
+
name: `@fast-china/lodash/${preference}`,
|
|
219
|
+
files: [...files],
|
|
220
|
+
rules: preference === "lodash" ? preferLodashRules : preferLodashUnifiedRules
|
|
221
|
+
}]);
|
|
222
|
+
//#endregion
|
|
223
|
+
//#region src/configs/markdown.ts
|
|
224
|
+
/**
|
|
225
|
+
* 创建 Markdown 结构与语法检查配置。
|
|
226
|
+
*
|
|
227
|
+
* 该配置检查 Markdown 文档本身;代码块是否接受额外语言规则由项目覆盖配置决定。
|
|
228
|
+
*/
|
|
229
|
+
const createMarkdownConfigs = () => defineConfig([{
|
|
230
|
+
name: "@fast-china/markdown",
|
|
231
|
+
files: [GLOB_MARKDOWN],
|
|
232
|
+
extends: [eslintMarkdown.configs.recommended]
|
|
233
|
+
}]);
|
|
234
|
+
//#endregion
|
|
235
|
+
//#region src/configs/prettier.ts
|
|
236
|
+
/**
|
|
237
|
+
* 创建 Prettier 兼容层。
|
|
238
|
+
*
|
|
239
|
+
* 它只关闭与 Prettier 冲突的 ESLint 格式规则,不会在 ESLint 进程中执行 Prettier。
|
|
240
|
+
* 工厂始终把它放在内置配置之后,使上游预置的格式规则能够被正确覆盖。
|
|
241
|
+
*/
|
|
242
|
+
const createPrettierConfigs = () => defineConfig([{
|
|
243
|
+
...eslintConfigPrettierFlat,
|
|
244
|
+
name: "@fast-china/prettier"
|
|
245
|
+
}]);
|
|
246
|
+
//#endregion
|
|
247
|
+
//#region src/configs/react.ts
|
|
248
|
+
/**
|
|
249
|
+
* 创建 React、JSX/TSX 与 Hooks 配置。
|
|
250
|
+
*
|
|
251
|
+
* JavaScript 和 TypeScript 分别继承对应的 @eslint-react 推荐预置;Hooks 使用
|
|
252
|
+
* React 官方 Flat Config。组件、Hooks 即使不返回 JSX 也能在普通 `.js`/`.ts` 中
|
|
253
|
+
* 定义,因此规则覆盖全部已启用脚本扩展名,而不仅是 `.jsx`/`.tsx`。
|
|
254
|
+
*/
|
|
255
|
+
const createReactConfigs = ({ importSource = "react", polymorphicPropName = "as", version = "detect" } = {}, { javascript = true, typeChecked = false, typescript = true } = {}) => {
|
|
256
|
+
const createConfig = (name, files, preset) => ({
|
|
257
|
+
name,
|
|
258
|
+
files: [...files],
|
|
259
|
+
extends: [preset, eslintPluginReactHooks.configs.flat.recommended],
|
|
260
|
+
settings: { "react-x": {
|
|
261
|
+
importSource,
|
|
262
|
+
polymorphicPropName,
|
|
263
|
+
version
|
|
264
|
+
} },
|
|
265
|
+
rules: reactRules
|
|
266
|
+
});
|
|
267
|
+
return defineConfig([...javascript ? [createConfig("@fast-china/react/javascript", GLOBS_JAVASCRIPT, eslintReact.configs.recommended)] : [], ...typescript ? [createConfig(typeChecked ? "@fast-china/react/typescript-type-checked" : "@fast-china/react/typescript", GLOBS_TYPESCRIPT, typeChecked ? eslintReact.configs["recommended-type-checked"] : eslintReact.configs["recommended-typescript"])] : []]);
|
|
268
|
+
};
|
|
269
|
+
//#endregion
|
|
270
|
+
//#region src/configs/regexp.ts
|
|
271
|
+
/**
|
|
272
|
+
* 创建正则表达式正确性配置。
|
|
273
|
+
*
|
|
274
|
+
* 插件推荐规则会检查无效、冗余或容易产生回溯问题的正则结构;部分规则可修复,
|
|
275
|
+
* 批量修复后仍需运行覆盖真实输入的项目测试。
|
|
276
|
+
*/
|
|
277
|
+
const createRegexpConfigs = (files = GLOBS_CODE) => defineConfig([{
|
|
278
|
+
name: "@fast-china/regexp",
|
|
279
|
+
files: [...files],
|
|
280
|
+
extends: [eslintPluginRegexp.configs["flat/recommended"]]
|
|
281
|
+
}]);
|
|
282
|
+
//#endregion
|
|
283
|
+
//#region src/configs/sort-package.ts
|
|
284
|
+
/**
|
|
285
|
+
* 创建 package.json 排序配置。
|
|
286
|
+
*
|
|
287
|
+
* 该能力会产生较大的可修复 diff,因此必须显式启用;规则不会进入顺序具有
|
|
288
|
+
* 条件导出语义的 `exports` 对象内部。
|
|
289
|
+
*/
|
|
290
|
+
const createPackageJsonSortConfigs = () => defineConfig([{
|
|
291
|
+
name: "@fast-china/sort/package-json",
|
|
292
|
+
files: ["**/package.json"],
|
|
293
|
+
rules: packageJsonSortRules
|
|
294
|
+
}]);
|
|
295
|
+
//#endregion
|
|
296
|
+
//#region src/configs/sort-tsconfig.ts
|
|
297
|
+
/**
|
|
298
|
+
* 创建 tsconfig.json 排序配置。
|
|
299
|
+
*
|
|
300
|
+
* 排序只改变字段阅读顺序,不改变编译选项值;由于首次修复 diff 较大,默认关闭。
|
|
301
|
+
*/
|
|
302
|
+
const createTsconfigSortConfigs = () => defineConfig([{
|
|
303
|
+
name: "@fast-china/sort/tsconfig",
|
|
304
|
+
files: [...GLOBS_TSCONFIG],
|
|
305
|
+
rules: tsconfigJsonSortRules
|
|
306
|
+
}]);
|
|
307
|
+
//#endregion
|
|
308
|
+
//#region src/configs/typescript.ts
|
|
309
|
+
/**
|
|
310
|
+
* 返回 typescript-eslint 推荐预置。
|
|
311
|
+
*
|
|
312
|
+
* Vue SFC 需要移除上游仅匹配 `.ts` 的文件范围,否则这些关闭核心规则的配置会与
|
|
313
|
+
* `.vue` 外层范围形成不可能命中的 AND 条件。
|
|
314
|
+
*/
|
|
315
|
+
const getTypeScriptPresetConfigs = (typeChecked, removeFileScopes = false) => {
|
|
316
|
+
const configs = [...typeChecked ? tseslint.configs.recommendedTypeChecked : tseslint.configs.recommended, ...typeChecked ? tseslint.configs.stylisticTypeChecked : tseslint.configs.stylistic];
|
|
317
|
+
if (!removeFileScopes) return configs;
|
|
318
|
+
return configs.map((config) => {
|
|
319
|
+
const { files: _files, ...configWithoutFiles } = config;
|
|
320
|
+
return configWithoutFiles;
|
|
321
|
+
});
|
|
322
|
+
};
|
|
323
|
+
/** 创建启用 Project Service 时需要的解析器选项。 */
|
|
324
|
+
const createTypeScriptParserOptions = ({ typeChecked = false, tsconfigRootDir } = {}) => ({
|
|
325
|
+
...typeChecked ? { projectService: true } : {},
|
|
326
|
+
...typeChecked && tsconfigRootDir ? { tsconfigRootDir } : {}
|
|
327
|
+
});
|
|
328
|
+
/**
|
|
329
|
+
* 创建 TypeScript 配置。
|
|
330
|
+
*
|
|
331
|
+
* 默认采用无需类型信息的 recommended + stylistic 预置;`typeChecked: true` 会切换为
|
|
332
|
+
* 对应的类型感知预置并启动 Project Service。
|
|
333
|
+
*/
|
|
334
|
+
const createTypeScriptConfigs = (options = {}, files = GLOBS_TYPESCRIPT) => defineConfig([{
|
|
335
|
+
name: options.typeChecked ? "@fast-china/typescript/type-checked" : "@fast-china/typescript",
|
|
336
|
+
files: [...files],
|
|
337
|
+
extends: getTypeScriptPresetConfigs(options.typeChecked ?? false),
|
|
338
|
+
languageOptions: {
|
|
339
|
+
ecmaVersion: "latest",
|
|
340
|
+
parserOptions: createTypeScriptParserOptions(options)
|
|
341
|
+
},
|
|
342
|
+
rules: typescriptRules
|
|
343
|
+
}]);
|
|
344
|
+
//#endregion
|
|
345
|
+
//#region src/configs/vue.ts
|
|
346
|
+
/**
|
|
347
|
+
* 创建 Vue 3 单文件组件配置。
|
|
348
|
+
*
|
|
349
|
+
* 本包只处理 Vue 3。启用 TypeScript 时,Vue 模板解析器通过 `parserOptions.parser`
|
|
350
|
+
* 委托给 typescript-eslint;这是 Vue 官方推荐的自定义脚本解析器接入方式。
|
|
351
|
+
*/
|
|
352
|
+
const createVueConfigs = ({ typescript = true, typescriptOptions = {} } = {}) => {
|
|
353
|
+
const typeChecked = typescriptOptions.typeChecked ?? false;
|
|
354
|
+
const typeScriptConfigs = typescript ? getTypeScriptPresetConfigs(typeChecked, true) : [];
|
|
355
|
+
return defineConfig([{
|
|
356
|
+
name: typeChecked ? "@fast-china/vue/type-checked" : "@fast-china/vue",
|
|
357
|
+
files: [GLOB_VUE],
|
|
358
|
+
extends: [
|
|
359
|
+
eslint.configs.recommended,
|
|
360
|
+
...typeScriptConfigs,
|
|
361
|
+
...eslintPluginVue.configs["flat/recommended"]
|
|
362
|
+
],
|
|
363
|
+
languageOptions: {
|
|
364
|
+
ecmaVersion: "latest",
|
|
365
|
+
parser: vueEslintParser,
|
|
366
|
+
parserOptions: {
|
|
367
|
+
...typescript ? {
|
|
368
|
+
parser: tseslint.parser,
|
|
369
|
+
extraFileExtensions: [".vue"]
|
|
370
|
+
} : {},
|
|
371
|
+
ecmaFeatures: { jsx: true },
|
|
372
|
+
sourceType: "module",
|
|
373
|
+
...createTypeScriptParserOptions(typescriptOptions)
|
|
374
|
+
}
|
|
375
|
+
},
|
|
376
|
+
rules: {
|
|
377
|
+
...typescript ? typescriptRules : {},
|
|
378
|
+
...vueRules
|
|
379
|
+
}
|
|
380
|
+
}]);
|
|
381
|
+
};
|
|
382
|
+
//#endregion
|
|
383
|
+
//#region src/factory.ts
|
|
384
|
+
/** `fastConfig()` 使用的稳定默认值;对象被冻结,避免运行时被意外修改。 */
|
|
385
|
+
const defaultConfigOptions = Object.freeze({
|
|
386
|
+
angular: false,
|
|
387
|
+
environment: "browser",
|
|
388
|
+
gitignore: true,
|
|
389
|
+
imports: true,
|
|
390
|
+
javascript: true,
|
|
391
|
+
json: true,
|
|
392
|
+
lodash: false,
|
|
393
|
+
markdown: true,
|
|
394
|
+
prettier: true,
|
|
395
|
+
react: false,
|
|
396
|
+
regexp: true,
|
|
397
|
+
sortPackageJson: false,
|
|
398
|
+
sortTsconfig: false,
|
|
399
|
+
typescript: true,
|
|
400
|
+
vue: true
|
|
401
|
+
});
|
|
402
|
+
/**
|
|
403
|
+
* 创建面向 Vue 3、React、Angular、Vite、TypeScript、JavaScript 与 Node.js 项目的 ESLint Flat Config。
|
|
404
|
+
*
|
|
405
|
+
* 默认导出就是此函数。额外配置参数会放在内置配置之后,因此项目可以按文件范围
|
|
406
|
+
* 覆盖任何默认规则,而无需再次调用 ESLint 的 `defineConfig()`。
|
|
407
|
+
*/
|
|
408
|
+
const fastConfig = (options = {}, ...overrides) => {
|
|
409
|
+
const angular = options.angular ?? defaultConfigOptions.angular;
|
|
410
|
+
const environment = options.environment ?? defaultConfigOptions.environment;
|
|
411
|
+
const gitignore = options.gitignore ?? defaultConfigOptions.gitignore;
|
|
412
|
+
const imports = options.imports ?? defaultConfigOptions.imports;
|
|
413
|
+
const javascript = options.javascript ?? defaultConfigOptions.javascript;
|
|
414
|
+
const json = options.json ?? defaultConfigOptions.json;
|
|
415
|
+
const lodash = options.lodash ?? defaultConfigOptions.lodash;
|
|
416
|
+
const markdown = options.markdown ?? defaultConfigOptions.markdown;
|
|
417
|
+
const prettier = options.prettier ?? defaultConfigOptions.prettier;
|
|
418
|
+
const react = options.react ?? defaultConfigOptions.react;
|
|
419
|
+
const regexp = options.regexp ?? defaultConfigOptions.regexp;
|
|
420
|
+
const sortPackageJson = options.sortPackageJson ?? defaultConfigOptions.sortPackageJson;
|
|
421
|
+
const sortTsconfig = options.sortTsconfig ?? defaultConfigOptions.sortTsconfig;
|
|
422
|
+
const typescript = options.typescript ?? defaultConfigOptions.typescript;
|
|
423
|
+
const vue = options.vue ?? defaultConfigOptions.vue;
|
|
424
|
+
const typeScriptEnabled = typescript !== false;
|
|
425
|
+
const typeScriptOptions = typeof typescript === "object" ? typescript : {};
|
|
426
|
+
const angularEnabled = angular !== false;
|
|
427
|
+
const angularOptions = typeof angular === "object" ? angular : {};
|
|
428
|
+
const reactEnabled = react !== false;
|
|
429
|
+
const reactOptions = typeof react === "object" ? react : {};
|
|
430
|
+
if (angularEnabled && !typeScriptEnabled) throw new TypeError("Angular support requires TypeScript. Remove `typescript: false` or disable `angular`.");
|
|
431
|
+
const projectRules = options.rules;
|
|
432
|
+
const scriptFiles = [...javascript ? GLOBS_JAVASCRIPT : [], ...typeScriptEnabled ? GLOBS_TYPESCRIPT : []];
|
|
433
|
+
const codeFiles = [...scriptFiles, ...vue ? [GLOB_VUE] : []];
|
|
434
|
+
const jsonEnabled = json || sortPackageJson || sortTsconfig;
|
|
435
|
+
return defineConfig([
|
|
436
|
+
createGlobalIgnores(options.ignores),
|
|
437
|
+
...gitignore ? createGitignoreConfigs() : [],
|
|
438
|
+
...codeFiles.length ? [...createEnvironmentConfigs({
|
|
439
|
+
environment,
|
|
440
|
+
files: codeFiles,
|
|
441
|
+
globals: options.globals,
|
|
442
|
+
nodeFiles: scriptFiles
|
|
443
|
+
}), ...createBaseConfigs(codeFiles)] : [],
|
|
444
|
+
...javascript ? createJavaScriptConfigs() : [],
|
|
445
|
+
...imports && codeFiles.length ? createImportConfigs(codeFiles) : [],
|
|
446
|
+
...lodash && codeFiles.length ? createLodashConfigs(lodash, codeFiles) : [],
|
|
447
|
+
...regexp && codeFiles.length ? createRegexpConfigs(codeFiles) : [],
|
|
448
|
+
...typeScriptEnabled ? createTypeScriptConfigs(typeScriptOptions) : [],
|
|
449
|
+
...jsonEnabled ? createJsonConfigs() : [],
|
|
450
|
+
...sortPackageJson ? createPackageJsonSortConfigs() : [],
|
|
451
|
+
...sortTsconfig ? createTsconfigSortConfigs() : [],
|
|
452
|
+
...vue ? createVueConfigs({
|
|
453
|
+
typescript: typeScriptEnabled,
|
|
454
|
+
typescriptOptions: typeScriptOptions
|
|
455
|
+
}) : [],
|
|
456
|
+
...reactEnabled ? createReactConfigs(reactOptions, {
|
|
457
|
+
javascript,
|
|
458
|
+
typeChecked: typeScriptOptions.typeChecked ?? false,
|
|
459
|
+
typescript: typeScriptEnabled
|
|
460
|
+
}) : [],
|
|
461
|
+
...angularEnabled ? createAngularConfigs(angularOptions) : [],
|
|
462
|
+
...markdown ? createMarkdownConfigs() : [],
|
|
463
|
+
...prettier ? createPrettierConfigs() : [],
|
|
464
|
+
...projectRules && codeFiles.length ? [{
|
|
465
|
+
name: "@fast-china/project/rules",
|
|
466
|
+
files: codeFiles,
|
|
467
|
+
rules: projectRules
|
|
468
|
+
}] : [],
|
|
469
|
+
...overrides
|
|
470
|
+
]);
|
|
471
|
+
};
|
|
472
|
+
//#endregion
|
|
473
|
+
export { fastConfig as default, fastConfig, defaultConfigOptions, defineRules };
|
|
474
|
+
|
|
475
|
+
//# sourceMappingURL=index.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.mjs","names":[],"sources":["../src/constants/index.ts","../src/configs/angular.ts","../src/configs/common.ts","../src/configs/environment.ts","../src/configs/ignores.ts","../src/configs/import.ts","../src/configs/javascript.ts","../src/configs/json.ts","../src/configs/lodash.ts","../src/configs/markdown.ts","../src/configs/prettier.ts","../src/configs/react.ts","../src/configs/regexp.ts","../src/configs/sort-package.ts","../src/configs/sort-tsconfig.ts","../src/configs/typescript.ts","../src/configs/vue.ts","../src/factory.ts"],"sourcesContent":["/** JavaScript 与 JSX 文件;扩展名列表与 Node.js ESM/CJS 约定保持一致。 */\nexport const GLOBS_JAVASCRIPT = [\"**/*.{js,cjs,mjs,jsx}\"] as const;\n\n/** TypeScript 与 TSX 文件;包含 TypeScript 的 ESM/CJS 专用扩展名。 */\nexport const GLOBS_TYPESCRIPT = [\"**/*.{ts,cts,mts,tsx}\"] as const;\n\n/** Vue 3 单文件组件。 */\nexport const GLOB_VUE = \"**/*.vue\";\n\n/** Angular 组件、指令、服务等框架源码;Angular CLI 项目以 `.ts` 为标准源码扩展名。 */\nexport const GLOB_ANGULAR_TYPESCRIPT = \"**/*.ts\";\n\n/** Angular 外部模板;内联模板由 Angular 处理器提取后复用同一模板配置。 */\nexport const GLOB_ANGULAR_TEMPLATE = \"**/*.html\";\n\n/** ESLint JSON language 支持的三种 JSON 方言。 */\nexport const GLOB_JSON = \"**/*.json\";\nexport const GLOB_JSONC = \"**/*.jsonc\";\nexport const GLOB_JSON5 = \"**/*.json5\";\n\n/** Markdown 文档。 */\nexport const GLOB_MARKDOWN = \"**/*.md\";\n\n/** 默认由 JavaScript、TypeScript 和 Vue 规则处理的全部代码文件。 */\nexport const GLOBS_CODE = [...GLOBS_JAVASCRIPT, ...GLOBS_TYPESCRIPT, GLOB_VUE] as const;\n\n/**\n * 应额外获得 Node.js 全局变量的工程文件。\n *\n * 这些模式还会与当前已启用的 JavaScript/TypeScript 文件模式做 AND 匹配,\n * 因而关闭 TypeScript 后不会意外让 ESLint 接管 `.ts` 文件。\n */\nexport const GLOBS_NODE_TOOLING = [\n\t\"**/*.{config,setup}.{js,cjs,mjs,jsx,ts,cts,mts,tsx}\",\n\t\"**/{scripts,bin}/**/*.{js,cjs,mjs,jsx,ts,cts,mts,tsx}\",\n\t\"**/{test,tests}/**/*.{js,cjs,mjs,jsx,ts,cts,mts,tsx}\",\n\t\"**/*.{test,spec}.{js,cjs,mjs,jsx,ts,cts,mts,tsx}\",\n\t\"**/cli.{js,cjs,mjs,ts,cts,mts}\",\n] as const;\n\n/** TypeScript 配置文件;它们使用 JSONC 语法并允许注释。 */\nexport const GLOBS_TSCONFIG = [\"**/tsconfig.json\", \"**/tsconfig.*.json\"] as const;\n\n/** 不应交给 JSON/Markdown 解析器处理的包管理器锁文件。 */\nexport const GLOBS_LOCKFILES = [\"**/package-lock.json\", \"**/yarn.lock\", \"**/pnpm-lock.yaml\", \"**/bun.lock\", \"**/bun.lockb\", \"**/deno.lock\"] as const;\n","import angularPlugin from \"@angular-eslint/eslint-plugin\";\nimport angularTemplatePlugin from \"@angular-eslint/eslint-plugin-template\";\nimport angularTemplateParser from \"@angular-eslint/template-parser\";\nimport { defineConfig } from \"eslint/config\";\n\nimport { GLOB_ANGULAR_TEMPLATE, GLOB_ANGULAR_TYPESCRIPT } from \"../constants\";\nimport { angularRules, angularTemplateAccessibilityRules, angularTemplateRules } from \"../rules\";\n\nimport type { ESLint, Linter } from \"eslint\";\n\nexport interface AngularConfigOptions {\n\t/**\n\t * 是否从 `@Component({ template: ... })` 中提取并检查内联模板。\n\t * @default true\n\t */\n\tinlineTemplates?: boolean;\n\t/**\n\t * 是否启用 Angular 官方模板无障碍规则集。\n\t * @default true\n\t */\n\ttemplateAccessibility?: boolean;\n}\n\n/**\n * 创建 Angular TypeScript、外部 HTML 模板与内联模板配置。\n *\n * Angular 支持依赖工厂的 TypeScript 配置先注册 typescript-eslint 解析器;模板由\n * Angular 专用 parser 解析,内联模板通过官方 processor 复用同一套 HTML 规则。\n */\nexport const createAngularConfigs = ({ inlineTemplates = true, templateAccessibility = true }: AngularConfigOptions = {}) =>\n\tdefineConfig([\n\t\t{\n\t\t\tname: inlineTemplates ? \"@fast-china/angular/typescript-with-inline-templates\" : \"@fast-china/angular/typescript\",\n\t\t\tfiles: [GLOB_ANGULAR_TYPESCRIPT],\n\t\t\tplugins: {\n\t\t\t\t\"@angular-eslint\": angularPlugin as unknown as ESLint.Plugin,\n\t\t\t},\n\t\t\t...(inlineTemplates\n\t\t\t\t? {\n\t\t\t\t\t\tprocessor: angularTemplatePlugin.processors[\"extract-inline-html\"] as Linter.Processor,\n\t\t\t\t\t}\n\t\t\t\t: {}),\n\t\t\trules: angularRules,\n\t\t},\n\t\t{\n\t\t\tname: templateAccessibility ? \"@fast-china/angular/template-accessibility\" : \"@fast-china/angular/template\",\n\t\t\tfiles: [GLOB_ANGULAR_TEMPLATE],\n\t\t\tlanguageOptions: {\n\t\t\t\tparser: angularTemplateParser as unknown as Linter.Parser,\n\t\t\t},\n\t\t\tplugins: {\n\t\t\t\t\"@angular-eslint/template\": angularTemplatePlugin as unknown as ESLint.Plugin,\n\t\t\t},\n\t\t\trules: {\n\t\t\t\t...angularTemplateRules,\n\t\t\t\t...(templateAccessibility ? angularTemplateAccessibilityRules : {}),\n\t\t\t},\n\t\t},\n\t]);\n","import { defineConfig } from \"eslint/config\";\n\nimport { GLOBS_CODE } from \"../constants\";\nimport { commonRules } from \"../rules\";\n\n/**\n * 创建跨 JavaScript、TypeScript 与 Vue 脚本生效的基础配置。\n *\n * 除公共规则外,这里还把无效的 `eslint-disable` 指令提升为错误,避免规则被移除后\n * 留下长期失效的抑制注释。\n */\nexport const createBaseConfigs = (files: readonly string[] = GLOBS_CODE) =>\n\tdefineConfig([\n\t\t{\n\t\t\tname: \"@fast-china/common\",\n\t\t\tfiles: [...files],\n\t\t\tlinterOptions: {\n\t\t\t\treportUnusedDisableDirectives: \"error\",\n\t\t\t},\n\t\t\trules: commonRules,\n\t\t},\n\t]);\n","import { defineConfig } from \"eslint/config\";\nimport globals from \"globals\";\n\nimport { GLOBS_CODE, GLOBS_JAVASCRIPT, GLOBS_NODE_TOOLING } from \"../constants\";\n\nimport type { Linter } from \"eslint\";\n\nexport type RuntimeEnvironment = \"browser\" | \"node\" | \"universal\";\n\n/**\n * 创建运行时环境相关的 ESLint 配置。\n *\n * 用于为应用源码配置对应运行环境的全局变量,\n * 同时为 Node.js 工程脚本单独启用 Node.js 全局变量。\n *\n * @param environment 运行时环境,默认为浏览器环境\n * @param files 应用源码匹配规则,默认为所有代码文件\n * @returns ESLint Flat Config 配置数组\n */\nexport interface EnvironmentConfigOptions {\n\t/** 应用代码实际运行的环境,默认是浏览器。 */\n\tenvironment?: RuntimeEnvironment;\n\t/** 需要获得运行时全局变量的代码文件。 */\n\tfiles?: readonly string[];\n\t/** 当前启用且可能作为 Node.js 工程文件执行的脚本类型。 */\n\tnodeFiles?: readonly string[];\n\t/** 项目额外提供的只读、可写或禁写全局变量。 */\n\tglobals?: Linter.Globals;\n}\n\nexport const createEnvironmentConfigs = ({\n\tenvironment = \"browser\",\n\tfiles = GLOBS_CODE,\n\tnodeFiles = GLOBS_JAVASCRIPT,\n\tglobals: projectGlobals = {},\n}: EnvironmentConfigOptions = {}) => {\n\tconst runtimeGlobals = {\n\t\t...(environment !== \"node\" ? globals.browser : {}),\n\t\t...(environment !== \"browser\" ? globals.node : {}),\n\t\t...projectGlobals,\n\t};\n\tconst nodeToolingFiles = GLOBS_NODE_TOOLING.flatMap((nodeGlob) => nodeFiles.map((fileGlob) => [nodeGlob, fileGlob]));\n\n\treturn defineConfig([\n\t\t{\n\t\t\tname: `@fast-china/globals/${environment}`,\n\t\t\tfiles: [...files],\n\t\t\tlanguageOptions: {\n\t\t\t\tglobals: runtimeGlobals,\n\t\t\t},\n\t\t},\n\t\t{\n\t\t\tname: \"@fast-china/globals/node-tooling\",\n\t\t\tfiles: nodeToolingFiles,\n\t\t\tlanguageOptions: {\n\t\t\t\tglobals: globals.node,\n\t\t\t},\n\t\t\trules: {\n\t\t\t\t\"no-console\": \"off\",\n\t\t\t},\n\t\t},\n\t]);\n};\n","import { defineConfig, globalIgnores } from \"eslint/config\";\nimport eslintConfigFlatGitignore from \"eslint-config-flat-gitignore\";\n\nimport { GLOBS_LOCKFILES } from \"../constants\";\n\n/**\n * 默认忽略依赖、构建结果、缓存、生成文件和包管理器锁文件。\n *\n * 不忽略 `src`、`public`、测试夹具或普通 Markdown 文档,避免共享配置静默漏检\n * 应由项目维护的文件。\n */\nexport const DEFAULT_IGNORE_PATTERNS = Object.freeze([\n\t\"**/node_modules/**\",\n\t\"**/{dist,build,coverage,output,temp,tmp}/**\",\n\t\"**/{.cache,.nuxt,.output,.vercel,.nitro}/**\",\n\t\"**/{.vitepress/cache,.vite-inspect}/**\",\n\t\"**/__snapshots__/**\",\n\t\"**/*.min.*\",\n\t\"**/auto-import?(s).d.ts\",\n\t\"**/components.d.ts\",\n\t...GLOBS_LOCKFILES,\n]);\n\n/** 创建全局忽略配置,并在默认集合之后追加项目自定义模式。 */\nexport const createGlobalIgnores = (additionalPatterns: readonly string[] = []) =>\n\tglobalIgnores([...DEFAULT_IGNORE_PATTERNS, ...additionalPatterns], \"@fast-china/ignores/global\");\n\n/** 读取运行 ESLint 的项目根目录中的 `.gitignore`。 */\nexport const createGitignoreConfigs = () =>\n\tdefineConfig([\n\t\t{\n\t\t\tname: \"@fast-china/ignores/git\",\n\t\t\t...eslintConfigFlatGitignore({ strict: false }),\n\t\t},\n\t]);\n","import { defineConfig } from \"eslint/config\";\nimport eslintPluginImportX from \"eslint-plugin-import-x\";\n\nimport { GLOBS_CODE } from \"../constants\";\nimport { importRules } from \"../rules\";\n\n/**\n * 创建模块导入规则配置。\n *\n * 共享库不猜测项目的路径别名或解析器,因此只继承 import-x 的推荐能力,\n * 与 resolver 强耦合且容易误报的规则会在本地规则记录中显式关闭。\n */\nexport const createImportConfigs = (files: readonly string[] = GLOBS_CODE) =>\n\tdefineConfig([\n\t\t{\n\t\t\tname: \"@fast-china/import\",\n\t\t\tfiles: [...files],\n\t\t\textends: [eslintPluginImportX.flatConfigs.recommended],\n\t\t\trules: importRules,\n\t\t},\n\t]);\n","import eslint from \"@eslint/js\";\nimport { defineConfig } from \"eslint/config\";\n\nimport { GLOBS_JAVASCRIPT } from \"../constants\";\nimport { javascriptRules } from \"../rules\";\n\n/**\n * 创建 JavaScript/JSX 配置。\n *\n * `@eslint/js` 提供基础正确性规则,本仓库只在其后补充有明确维护理由的规则。\n */\nexport const createJavaScriptConfigs = (files: readonly string[] = GLOBS_JAVASCRIPT) =>\n\tdefineConfig([\n\t\t{\n\t\t\tname: \"@fast-china/javascript\",\n\t\t\tfiles: [...files],\n\t\t\textends: [eslint.configs.recommended],\n\t\t\tlanguageOptions: {\n\t\t\t\tecmaVersion: \"latest\",\n\t\t\t\tparserOptions: {\n\t\t\t\t\tecmaFeatures: {\n\t\t\t\t\t\t// 普通 `.jsx` 文件需要显式开启 JSX 语法解析。\n\t\t\t\t\t\tjsx: true,\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t},\n\t\t\trules: javascriptRules,\n\t\t},\n\t]);\n","import { defineConfig } from \"eslint/config\";\nimport eslintPluginJsonc from \"eslint-plugin-jsonc\";\n\nimport { GLOB_JSON, GLOB_JSON5, GLOB_JSONC } from \"../constants\";\n\n/**\n * 创建 JSON、JSONC 与 JSON5 配置。\n *\n * 三种方言使用各自的官方推荐预置,避免严格 JSON 规则错误覆盖允许注释或尾随逗号的文件。\n */\nexport const createJsonConfigs = () =>\n\tdefineConfig([\n\t\t{\n\t\t\tname: \"@fast-china/json/json\",\n\t\t\tfiles: [GLOB_JSON],\n\t\t\textends: [eslintPluginJsonc.configs[\"flat/recommended-with-json\"]],\n\t\t},\n\t\t{\n\t\t\tname: \"@fast-china/json/jsonc\",\n\t\t\tfiles: [GLOB_JSONC],\n\t\t\textends: [eslintPluginJsonc.configs[\"flat/recommended-with-jsonc\"]],\n\t\t},\n\t\t{\n\t\t\tname: \"@fast-china/json/json5\",\n\t\t\tfiles: [GLOB_JSON5],\n\t\t\textends: [eslintPluginJsonc.configs[\"flat/recommended-with-json5\"]],\n\t\t},\n\t\t{\n\t\t\tname: \"@fast-china/json/vscode-settings\",\n\t\t\tfiles: [\"**/.vscode/settings.json\"],\n\t\t\trules: {\n\t\t\t\t// VS Code 的 settings.json 使用带注释的 JSONC 方言。\n\t\t\t\t\"jsonc/no-comments\": \"off\",\n\t\t\t},\n\t\t},\n\t]);\n","import { defineConfig } from \"eslint/config\";\n\nimport { GLOBS_CODE } from \"../constants\";\nimport { preferLodashRules, preferLodashUnifiedRules } from \"../rules\";\n\n/** 项目允许使用的 Lodash 导入来源。 */\nexport type LodashPreference = \"lodash\" | \"lodash-unified\";\n\n/**\n * 创建 Lodash 静态导入约束。\n *\n * 该配置使用 ESLint 核心规则,因此不依赖 import-x 开关或额外插件。\n */\nexport const createLodashConfigs = (preference: LodashPreference, files: readonly string[] = GLOBS_CODE) =>\n\tdefineConfig([\n\t\t{\n\t\t\tname: `@fast-china/lodash/${preference}`,\n\t\t\tfiles: [...files],\n\t\t\trules: preference === \"lodash\" ? preferLodashRules : preferLodashUnifiedRules,\n\t\t},\n\t]);\n","import eslintMarkdown from \"@eslint/markdown\";\nimport { defineConfig } from \"eslint/config\";\n\nimport { GLOB_MARKDOWN } from \"../constants\";\n\n/**\n * 创建 Markdown 结构与语法检查配置。\n *\n * 该配置检查 Markdown 文档本身;代码块是否接受额外语言规则由项目覆盖配置决定。\n */\nexport const createMarkdownConfigs = () =>\n\tdefineConfig([\n\t\t{\n\t\t\tname: \"@fast-china/markdown\",\n\t\t\tfiles: [GLOB_MARKDOWN],\n\t\t\textends: [eslintMarkdown.configs.recommended],\n\t\t},\n\t]);\n","import { defineConfig } from \"eslint/config\";\nimport eslintConfigPrettierFlat from \"eslint-config-prettier/flat\";\n\n/**\n * 创建 Prettier 兼容层。\n *\n * 它只关闭与 Prettier 冲突的 ESLint 格式规则,不会在 ESLint 进程中执行 Prettier。\n * 工厂始终把它放在内置配置之后,使上游预置的格式规则能够被正确覆盖。\n */\nexport const createPrettierConfigs = () =>\n\tdefineConfig([\n\t\t{\n\t\t\t...eslintConfigPrettierFlat,\n\t\t\tname: \"@fast-china/prettier\",\n\t\t},\n\t]);\n","import eslintReact from \"@eslint-react/eslint-plugin\";\nimport { defineConfig } from \"eslint/config\";\nimport eslintPluginReactHooks from \"eslint-plugin-react-hooks\";\n\nimport { GLOBS_JAVASCRIPT, GLOBS_TYPESCRIPT } from \"../constants\";\nimport { reactRules } from \"../rules\";\n\nimport type { Linter } from \"eslint\";\n\nexport interface ReactConfigOptions {\n\t/**\n\t * JSX 运行时的包入口;Preact 等 React 兼容运行时可传入自己的包名。\n\t * @default \"react\"\n\t */\n\timportSource?: string;\n\t/**\n\t * 用于多态组件底层元素切换的属性名。\n\t * @default \"as\"\n\t */\n\tpolymorphicPropName?: string;\n\t/**\n\t * React 版本;默认从项目依赖自动检测,无法检测时可显式传入版本号。\n\t * @default \"detect\"\n\t */\n\tversion?: string;\n}\n\ninterface ReactLanguageOptions {\n\tjavascript?: boolean;\n\ttypeChecked?: boolean;\n\ttypescript?: boolean;\n}\n\n/**\n * 创建 React、JSX/TSX 与 Hooks 配置。\n *\n * JavaScript 和 TypeScript 分别继承对应的 @eslint-react 推荐预置;Hooks 使用\n * React 官方 Flat Config。组件、Hooks 即使不返回 JSX 也能在普通 `.js`/`.ts` 中\n * 定义,因此规则覆盖全部已启用脚本扩展名,而不仅是 `.jsx`/`.tsx`。\n */\nexport const createReactConfigs = (\n\t{ importSource = \"react\", polymorphicPropName = \"as\", version = \"detect\" }: ReactConfigOptions = {},\n\t{ javascript = true, typeChecked = false, typescript = true }: ReactLanguageOptions = {}\n) => {\n\tconst createConfig = (name: string, files: readonly string[], preset: Linter.Config) => ({\n\t\tname,\n\t\tfiles: [...files],\n\t\textends: [preset, eslintPluginReactHooks.configs.flat.recommended],\n\t\tsettings: {\n\t\t\t\"react-x\": {\n\t\t\t\timportSource,\n\t\t\t\tpolymorphicPropName,\n\t\t\t\tversion,\n\t\t\t},\n\t\t},\n\t\trules: reactRules,\n\t});\n\n\treturn defineConfig([\n\t\t...(javascript ? [createConfig(\"@fast-china/react/javascript\", GLOBS_JAVASCRIPT, eslintReact.configs.recommended)] : []),\n\t\t...(typescript\n\t\t\t? [\n\t\t\t\t\tcreateConfig(\n\t\t\t\t\t\ttypeChecked ? \"@fast-china/react/typescript-type-checked\" : \"@fast-china/react/typescript\",\n\t\t\t\t\t\tGLOBS_TYPESCRIPT,\n\t\t\t\t\t\ttypeChecked ? eslintReact.configs[\"recommended-type-checked\"] : eslintReact.configs[\"recommended-typescript\"]\n\t\t\t\t\t),\n\t\t\t\t]\n\t\t\t: []),\n\t]);\n};\n","import { defineConfig } from \"eslint/config\";\nimport eslintPluginRegexp from \"eslint-plugin-regexp\";\n\nimport { GLOBS_CODE } from \"../constants\";\n\n/**\n * 创建正则表达式正确性配置。\n *\n * 插件推荐规则会检查无效、冗余或容易产生回溯问题的正则结构;部分规则可修复,\n * 批量修复后仍需运行覆盖真实输入的项目测试。\n */\nexport const createRegexpConfigs = (files: readonly string[] = GLOBS_CODE) =>\n\tdefineConfig([\n\t\t{\n\t\t\tname: \"@fast-china/regexp\",\n\t\t\tfiles: [...files],\n\t\t\textends: [eslintPluginRegexp.configs[\"flat/recommended\"]],\n\t\t},\n\t]);\n","import { defineConfig } from \"eslint/config\";\n\nimport { packageJsonSortRules } from \"../rules\";\n\n/**\n * 创建 package.json 排序配置。\n *\n * 该能力会产生较大的可修复 diff,因此必须显式启用;规则不会进入顺序具有\n * 条件导出语义的 `exports` 对象内部。\n */\nexport const createPackageJsonSortConfigs = () =>\n\tdefineConfig([\n\t\t{\n\t\t\tname: \"@fast-china/sort/package-json\",\n\t\t\tfiles: [\"**/package.json\"],\n\t\t\trules: packageJsonSortRules,\n\t\t},\n\t]);\n","import { defineConfig } from \"eslint/config\";\n\nimport { GLOBS_TSCONFIG } from \"../constants\";\nimport { tsconfigJsonSortRules } from \"../rules\";\n\n/**\n * 创建 tsconfig.json 排序配置。\n *\n * 排序只改变字段阅读顺序,不改变编译选项值;由于首次修复 diff 较大,默认关闭。\n */\nexport const createTsconfigSortConfigs = () =>\n\tdefineConfig([\n\t\t{\n\t\t\tname: \"@fast-china/sort/tsconfig\",\n\t\t\tfiles: [...GLOBS_TSCONFIG],\n\t\t\trules: tsconfigJsonSortRules,\n\t\t},\n\t]);\n","import { defineConfig } from \"eslint/config\";\nimport tseslint from \"typescript-eslint\";\n\nimport { GLOBS_TYPESCRIPT } from \"../constants\";\nimport { typescriptRules } from \"../rules\";\n\nimport type { Linter } from \"eslint\";\n\nexport interface TypeScriptConfigOptions {\n\t/**\n\t * 是否启用依赖 TypeScript 类型信息的规则;开启后会增加启动和检查成本。\n\t * @default false\n\t */\n\ttypeChecked?: boolean;\n\t/**\n\t * 查找 tsconfig.json 的根目录。\n\t *\n\t * typescript-eslint 通常可从 `eslint.config.*` 调用栈推断;复杂 monorepo 可显式传入\n\t * `import.meta.dirname`,避免从错误目录启动 Project Service。\n\t * @default undefined\n\t */\n\ttsconfigRootDir?: string;\n}\n\n/**\n * 返回 typescript-eslint 推荐预置。\n *\n * Vue SFC 需要移除上游仅匹配 `.ts` 的文件范围,否则这些关闭核心规则的配置会与\n * `.vue` 外层范围形成不可能命中的 AND 条件。\n */\nexport const getTypeScriptPresetConfigs = (typeChecked: boolean, removeFileScopes = false): Linter.Config[] => {\n\tconst configs = [\n\t\t...(typeChecked ? tseslint.configs.recommendedTypeChecked : tseslint.configs.recommended),\n\t\t...(typeChecked ? tseslint.configs.stylisticTypeChecked : tseslint.configs.stylistic),\n\t] as Linter.Config[];\n\n\tif (!removeFileScopes) return configs;\n\n\treturn configs.map((config) => {\n\t\tconst { files: _files, ...configWithoutFiles } = config;\n\t\treturn configWithoutFiles;\n\t});\n};\n\n/** 创建启用 Project Service 时需要的解析器选项。 */\nexport const createTypeScriptParserOptions = ({ typeChecked = false, tsconfigRootDir }: TypeScriptConfigOptions = {}) => ({\n\t...(typeChecked ? { projectService: true } : {}),\n\t...(typeChecked && tsconfigRootDir ? { tsconfigRootDir } : {}),\n});\n\n/**\n * 创建 TypeScript 配置。\n *\n * 默认采用无需类型信息的 recommended + stylistic 预置;`typeChecked: true` 会切换为\n * 对应的类型感知预置并启动 Project Service。\n */\nexport const createTypeScriptConfigs = (options: TypeScriptConfigOptions = {}, files: readonly string[] = GLOBS_TYPESCRIPT) =>\n\tdefineConfig([\n\t\t{\n\t\t\tname: options.typeChecked ? \"@fast-china/typescript/type-checked\" : \"@fast-china/typescript\",\n\t\t\tfiles: [...files],\n\t\t\textends: getTypeScriptPresetConfigs(options.typeChecked ?? false),\n\t\t\tlanguageOptions: {\n\t\t\t\tecmaVersion: \"latest\",\n\t\t\t\tparserOptions: createTypeScriptParserOptions(options),\n\t\t\t},\n\t\t\trules: typescriptRules,\n\t\t},\n\t]);\n","import eslint from \"@eslint/js\";\nimport { defineConfig } from \"eslint/config\";\nimport eslintPluginVue from \"eslint-plugin-vue\";\nimport tseslint from \"typescript-eslint\";\nimport vueEslintParser from \"vue-eslint-parser\";\n\nimport { GLOB_VUE } from \"../constants\";\nimport { typescriptRules, vueRules } from \"../rules\";\n\nimport { type TypeScriptConfigOptions, createTypeScriptParserOptions, getTypeScriptPresetConfigs } from \"./typescript\";\n\nexport interface VueConfigOptions {\n\t/** 是否使用 typescript-eslint 解析 `<script>`;关闭后仅支持 JavaScript。 */\n\ttypescript?: boolean;\n\t/** 与独立 TypeScript 文件共享的类型感知选项。 */\n\ttypescriptOptions?: TypeScriptConfigOptions;\n}\n\n/**\n * 创建 Vue 3 单文件组件配置。\n *\n * 本包只处理 Vue 3。启用 TypeScript 时,Vue 模板解析器通过 `parserOptions.parser`\n * 委托给 typescript-eslint;这是 Vue 官方推荐的自定义脚本解析器接入方式。\n */\nexport const createVueConfigs = ({ typescript = true, typescriptOptions = {} }: VueConfigOptions = {}) => {\n\tconst typeChecked = typescriptOptions.typeChecked ?? false;\n\tconst typeScriptConfigs = typescript ? getTypeScriptPresetConfigs(typeChecked, true) : [];\n\n\treturn defineConfig([\n\t\t{\n\t\t\tname: typeChecked ? \"@fast-china/vue/type-checked\" : \"@fast-china/vue\",\n\t\t\tfiles: [GLOB_VUE],\n\t\t\textends: [eslint.configs.recommended, ...typeScriptConfigs, ...eslintPluginVue.configs[\"flat/recommended\"]],\n\t\t\tlanguageOptions: {\n\t\t\t\tecmaVersion: \"latest\",\n\t\t\t\tparser: vueEslintParser,\n\t\t\t\tparserOptions: {\n\t\t\t\t\t...(typescript ? { parser: tseslint.parser, extraFileExtensions: [\".vue\"] } : {}),\n\t\t\t\t\tecmaFeatures: {\n\t\t\t\t\t\tjsx: true,\n\t\t\t\t\t},\n\t\t\t\t\tsourceType: \"module\",\n\t\t\t\t\t...createTypeScriptParserOptions(typescriptOptions),\n\t\t\t\t},\n\t\t\t},\n\t\t\trules: {\n\t\t\t\t...(typescript ? typescriptRules : {}),\n\t\t\t\t...vueRules,\n\t\t\t},\n\t\t},\n\t]);\n};\n","import { type Config, defineConfig } from \"eslint/config\";\n\nimport { type AngularConfigOptions, createAngularConfigs } from \"./configs/angular\";\nimport { createBaseConfigs } from \"./configs/common\";\nimport { type RuntimeEnvironment, createEnvironmentConfigs } from \"./configs/environment\";\nimport { createGitignoreConfigs, createGlobalIgnores } from \"./configs/ignores\";\nimport { createImportConfigs } from \"./configs/import\";\nimport { createJavaScriptConfigs } from \"./configs/javascript\";\nimport { createJsonConfigs } from \"./configs/json\";\nimport { type LodashPreference, createLodashConfigs } from \"./configs/lodash\";\nimport { createMarkdownConfigs } from \"./configs/markdown\";\nimport { createPrettierConfigs } from \"./configs/prettier\";\nimport { type ReactConfigOptions, createReactConfigs } from \"./configs/react\";\nimport { createRegexpConfigs } from \"./configs/regexp\";\nimport { createPackageJsonSortConfigs } from \"./configs/sort-package\";\nimport { createTsconfigSortConfigs } from \"./configs/sort-tsconfig\";\nimport { type TypeScriptConfigOptions, createTypeScriptConfigs } from \"./configs/typescript\";\nimport { createVueConfigs } from \"./configs/vue\";\nimport { GLOBS_JAVASCRIPT, GLOBS_TYPESCRIPT, GLOB_VUE } from \"./constants\";\n\nimport type { RuleOptions } from \"./typegen\";\nimport type { Linter } from \"eslint\";\n\nexport interface FastConfigOptions {\n\t/**\n\t * Angular 支持;启用后检查 TypeScript、外部 HTML 模板和内联模板。\n\t * @default false\n\t */\n\tangular?: boolean | AngularConfigOptions;\n\t/**\n\t * 应用代码的运行环境;Vue/Vite 项目通常使用 `browser`。\n\t * @default \"browser\"\n\t */\n\tenvironment?: RuntimeEnvironment;\n\t/**\n\t * 项目额外提供的全局变量,例如测试运行器或宿主平台 API。\n\t * @default undefined\n\t */\n\tglobals?: Linter.Globals;\n\t/**\n\t * 是否读取项目根目录的 .gitignore。\n\t * @default true\n\t */\n\tgitignore?: boolean;\n\t/**\n\t * 追加到内置集合的全局忽略模式。\n\t * @default []\n\t */\n\tignores?: readonly string[];\n\t/**\n\t * 是否启用 import-x 规则。\n\t * @default true\n\t */\n\timports?: boolean;\n\t/**\n\t * 是否处理 JavaScript 与 JSX 文件。\n\t * @default true\n\t */\n\tjavascript?: boolean;\n\t/**\n\t * 是否启用 JSON、JSONC 与 JSON5 推荐规则;清单排序由独立选项控制。\n\t * @default true\n\t */\n\tjson?: boolean;\n\t/**\n\t * 统一项目使用的 Lodash 包;`false` 表示不限制 `lodash`、`lodash-es` 或 `lodash-unified`。\n\t * @default false\n\t */\n\tlodash?: false | LodashPreference;\n\t/**\n\t * 是否启用 Markdown 规则。\n\t * @default true\n\t */\n\tmarkdown?: boolean;\n\t/**\n\t * 是否在末尾关闭与 Prettier 冲突的格式规则。\n\t * @default true\n\t */\n\tprettier?: boolean;\n\t/**\n\t * 是否启用正则表达式规则。\n\t * @default true\n\t */\n\tregexp?: boolean;\n\t/**\n\t * React 支持;传入对象可配置 React 版本、JSX 运行时和多态组件属性。\n\t * @default false\n\t */\n\treact?: boolean | ReactConfigOptions;\n\t/**\n\t * 应用于全部已启用代码文件的项目级规则,提供精确规则名与选项类型。\n\t * @default undefined\n\t */\n\trules?: RuleOptions;\n\t/**\n\t * 是否按安全的固定顺序整理 package.json;启用后首次运行可能产生较大 diff。\n\t * @default false\n\t */\n\tsortPackageJson?: boolean;\n\t/**\n\t * 是否按 TypeScript 文档主题整理 tsconfig*.json。\n\t * @default false\n\t */\n\tsortTsconfig?: boolean;\n\t/**\n\t * TypeScript 支持;传入对象可开启类型感知规则。\n\t * @default true\n\t */\n\ttypescript?: boolean | TypeScriptConfigOptions;\n\t/**\n\t * 是否启用 Vue 3 单文件组件支持。\n\t * @default true\n\t */\n\tvue?: boolean;\n}\n\n/** `fastConfig()` 使用的稳定默认值;对象被冻结,避免运行时被意外修改。 */\nexport const defaultConfigOptions = Object.freeze({\n\tangular: false,\n\tenvironment: \"browser\",\n\tgitignore: true,\n\timports: true,\n\tjavascript: true,\n\tjson: true,\n\tlodash: false,\n\tmarkdown: true,\n\tprettier: true,\n\treact: false,\n\tregexp: true,\n\tsortPackageJson: false,\n\tsortTsconfig: false,\n\ttypescript: true,\n\tvue: true,\n} as const satisfies Required<Omit<FastConfigOptions, \"globals\" | \"ignores\" | \"rules\">>);\n\n/**\n * 创建面向 Vue 3、React、Angular、Vite、TypeScript、JavaScript 与 Node.js 项目的 ESLint Flat Config。\n *\n * 默认导出就是此函数。额外配置参数会放在内置配置之后,因此项目可以按文件范围\n * 覆盖任何默认规则,而无需再次调用 ESLint 的 `defineConfig()`。\n */\nexport const fastConfig = (options: FastConfigOptions = {}, ...overrides: Config[]): Config[] => {\n\tconst angular = options.angular ?? defaultConfigOptions.angular;\n\tconst environment = options.environment ?? defaultConfigOptions.environment;\n\tconst gitignore = options.gitignore ?? defaultConfigOptions.gitignore;\n\tconst imports = options.imports ?? defaultConfigOptions.imports;\n\tconst javascript = options.javascript ?? defaultConfigOptions.javascript;\n\tconst json = options.json ?? defaultConfigOptions.json;\n\tconst lodash = options.lodash ?? defaultConfigOptions.lodash;\n\tconst markdown = options.markdown ?? defaultConfigOptions.markdown;\n\tconst prettier = options.prettier ?? defaultConfigOptions.prettier;\n\tconst react = options.react ?? defaultConfigOptions.react;\n\tconst regexp = options.regexp ?? defaultConfigOptions.regexp;\n\tconst sortPackageJson = options.sortPackageJson ?? defaultConfigOptions.sortPackageJson;\n\tconst sortTsconfig = options.sortTsconfig ?? defaultConfigOptions.sortTsconfig;\n\tconst typescript = options.typescript ?? defaultConfigOptions.typescript;\n\tconst vue = options.vue ?? defaultConfigOptions.vue;\n\n\tconst typeScriptEnabled = typescript !== false;\n\tconst typeScriptOptions = typeof typescript === \"object\" ? typescript : {};\n\tconst angularEnabled = angular !== false;\n\tconst angularOptions = typeof angular === \"object\" ? angular : {};\n\tconst reactEnabled = react !== false;\n\tconst reactOptions = typeof react === \"object\" ? react : {};\n\n\tif (angularEnabled && !typeScriptEnabled) {\n\t\tthrow new TypeError(\"Angular support requires TypeScript. Remove `typescript: false` or disable `angular`.\");\n\t}\n\t// RuleOptions 是无字符串索引签名的精确映射;运行时形状仍完全符合 ESLint RulesRecord。\n\tconst projectRules = options.rules as Linter.RulesRecord | undefined;\n\tconst scriptFiles = [...(javascript ? GLOBS_JAVASCRIPT : []), ...(typeScriptEnabled ? GLOBS_TYPESCRIPT : [])];\n\tconst codeFiles = [...scriptFiles, ...(vue ? [GLOB_VUE] : [])];\n\tconst jsonEnabled = json || sortPackageJson || sortTsconfig;\n\n\treturn defineConfig([\n\t\tcreateGlobalIgnores(options.ignores),\n\t\t...(gitignore ? createGitignoreConfigs() : []),\n\t\t...(codeFiles.length\n\t\t\t? [\n\t\t\t\t\t...createEnvironmentConfigs({\n\t\t\t\t\t\tenvironment,\n\t\t\t\t\t\tfiles: codeFiles,\n\t\t\t\t\t\tglobals: options.globals,\n\t\t\t\t\t\tnodeFiles: scriptFiles,\n\t\t\t\t\t}),\n\t\t\t\t\t...createBaseConfigs(codeFiles),\n\t\t\t\t]\n\t\t\t: []),\n\t\t...(javascript ? createJavaScriptConfigs() : []),\n\t\t...(imports && codeFiles.length ? createImportConfigs(codeFiles) : []),\n\t\t...(lodash && codeFiles.length ? createLodashConfigs(lodash, codeFiles) : []),\n\t\t...(regexp && codeFiles.length ? createRegexpConfigs(codeFiles) : []),\n\t\t...(typeScriptEnabled ? createTypeScriptConfigs(typeScriptOptions) : []),\n\t\t...(jsonEnabled ? createJsonConfigs() : []),\n\t\t...(sortPackageJson ? createPackageJsonSortConfigs() : []),\n\t\t...(sortTsconfig ? createTsconfigSortConfigs() : []),\n\t\t...(vue ? createVueConfigs({ typescript: typeScriptEnabled, typescriptOptions: typeScriptOptions }) : []),\n\t\t...(reactEnabled\n\t\t\t? createReactConfigs(reactOptions, {\n\t\t\t\t\tjavascript,\n\t\t\t\t\ttypeChecked: typeScriptOptions.typeChecked ?? false,\n\t\t\t\t\ttypescript: typeScriptEnabled,\n\t\t\t\t})\n\t\t\t: []),\n\t\t...(angularEnabled ? createAngularConfigs(angularOptions) : []),\n\t\t...(markdown ? createMarkdownConfigs() : []),\n\t\t...(prettier ? createPrettierConfigs() : []),\n\t\t...(projectRules && codeFiles.length\n\t\t\t? [\n\t\t\t\t\t{\n\t\t\t\t\t\tname: \"@fast-china/project/rules\",\n\t\t\t\t\t\tfiles: codeFiles,\n\t\t\t\t\t\trules: projectRules,\n\t\t\t\t\t},\n\t\t\t\t]\n\t\t\t: []),\n\t\t...overrides,\n\t]);\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AACA,MAAa,mBAAmB,CAAC,uBAAuB;;AAGxD,MAAa,mBAAmB,CAAC,uBAAuB;;AAGxD,MAAa,WAAW;;AAGxB,MAAa,0BAA0B;;AAGvC,MAAa,wBAAwB;;AAGrC,MAAa,YAAY;AACzB,MAAa,aAAa;AAC1B,MAAa,aAAa;;AAG1B,MAAa,gBAAgB;;AAG7B,MAAa,aAAa;CAAC,GAAG;CAAkB,GAAG;CAAkB;AAAQ;;;;;;;AAQ7E,MAAa,qBAAqB;CACjC;CACA;CACA;CACA;CACA;AACD;;AAGA,MAAa,iBAAiB,CAAC,oBAAoB,oBAAoB;;AAGvE,MAAa,kBAAkB;CAAC;CAAwB;CAAgB;CAAqB;CAAe;CAAgB;AAAc;;;;;;;;;ACf1I,MAAa,wBAAwB,EAAE,kBAAkB,MAAM,wBAAwB,SAA+B,CAAC,MACtH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