@fast-china/eslint-config 2.1.3 → 2.1.5

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 CHANGED
@@ -6,6 +6,18 @@ The format follows [Keep a Changelog](https://keepachangelog.com/en/1.1.0/), and
6
6
 
7
7
  ## Unreleased
8
8
 
9
+ ## 2.1.5 - 2026-09-01
10
+
11
+ ### Changed
12
+
13
+ - Unified `extraFileExtensions: [".vue", ".nvue"]` across type-aware TypeScript, TSX, Vue, and NVue parsing so Project Service does not reload the project while linting mixed file types.
14
+
15
+ ## 2.1.4 - 2026-08-30
16
+
17
+ ### Changed
18
+
19
+ - Classified `@/**` root aliases as leading internal imports and moved the `type` group after every other non-style import group, while styles remain in their final stable group.
20
+
9
21
  ## 2.1.3 - 2026-08-29
10
22
 
11
23
  ### Changed
package/README.md CHANGED
@@ -113,10 +113,11 @@ Trailing configs have the highest precedence. `defineRules()` leaves the object
113
113
  ```js
114
114
  parserOptions: {
115
115
  projectService: true,
116
+ extraFileExtensions: [".vue", ".nvue"],
116
117
  }
117
118
  ```
118
119
 
119
- Linted files must belong to a discoverable `tsconfig.json`. The `typeChecked` and `tsconfigRootDir` wrapper options have been removed. Complex monorepos can override `languageOptions.parserOptions` in a trailing Flat Config when necessary.
120
+ Linted files must belong to a discoverable `tsconfig.json`. The same `extraFileExtensions` list is applied to TypeScript, TSX, Vue, and NVue files so Project Service does not reload the project while linting mixed file types. The `typeChecked` and `tsconfigRootDir` wrapper options have been removed. Complex monorepos can override `languageOptions.parserOptions` in a trailing Flat Config when necessary, but every type-aware file override in the same project must keep `extraFileExtensions` identical.
120
121
 
121
122
  ## React
122
123
 
package/README.zh.md CHANGED
@@ -115,10 +115,11 @@ export default fastConfig(
115
115
  ```js
116
116
  parserOptions: {
117
117
  projectService: true,
118
+ extraFileExtensions: [".vue", ".nvue"],
118
119
  }
119
120
  ```
120
121
 
121
- 被检查文件必须属于可发现的 `tsconfig.json`。不再提供 `typeChecked` 和 `tsconfigRootDir` 包装选项;复杂 monorepo 如需指定根目录,可在后置 Flat Config 中直接覆盖 `languageOptions.parserOptions`。
122
+ 被检查文件必须属于可发现的 `tsconfig.json`。TypeScript、TSX、Vue 与 NVue 统一使用相同的 `extraFileExtensions`,避免混合检查文件时 Project Service 重载项目。不再提供 `typeChecked` 和 `tsconfigRootDir` 包装选项;复杂 monorepo 如需指定根目录,可在后置 Flat Config 中直接覆盖 `languageOptions.parserOptions`,但同一项目中所有类型感知文件覆盖必须保持 `extraFileExtensions` 完全一致。
122
123
 
123
124
  ## React
124
125
 
@@ -10,7 +10,11 @@ declare const getTypeScriptPresetConfigs: () => Linter.Config[];
10
10
  /**
11
11
  * 创建 TypeScript 解析器的 Project Service 选项。
12
12
  *
13
- * @returns 始终启用 `projectService` 的解析器选项。
13
+ * @remarks
14
+ * TypeScript、TSX、Vue 与 NVue 必须使用完全一致的 `extraFileExtensions`。否则混合检查文件时,
15
+ * TypeScript Server 会因扩展名集合变化而反复重载整个项目。
16
+ *
17
+ * @returns 始终启用 `projectService`,并统一声明 Vue 扩展名的解析器选项。
14
18
  */
15
19
  declare const createTypeScriptParserOptions: () => Linter.ParserOptions;
16
20
  /**
@@ -21,9 +21,16 @@ const getTypeScriptPresetConfigs = () => [
21
21
  /**
22
22
  * 创建 TypeScript 解析器的 Project Service 选项。
23
23
  *
24
- * @returns 始终启用 `projectService` 的解析器选项。
24
+ * @remarks
25
+ * TypeScript、TSX、Vue 与 NVue 必须使用完全一致的 `extraFileExtensions`。否则混合检查文件时,
26
+ * TypeScript Server 会因扩展名集合变化而反复重载整个项目。
27
+ *
28
+ * @returns 始终启用 `projectService`,并统一声明 Vue 扩展名的解析器选项。
25
29
  */
26
- const createTypeScriptParserOptions = () => ({ projectService: true });
30
+ const createTypeScriptParserOptions = () => ({
31
+ projectService: true,
32
+ extraFileExtensions: [".vue", ".nvue"]
33
+ });
27
34
  /**
28
35
  * 创建 TypeScript 配置。
29
36
  *
@@ -1 +1 @@
1
- {"version":3,"file":"typescript.mjs","names":[],"sources":["../../src/configs/typescript.ts"],"sourcesContent":["import eslint from \"@eslint/js\";\nimport { defineConfig } from \"eslint/config\";\nimport tseslint from \"typescript-eslint\";\nimport { GLOBS_TYPESCRIPT } from \"../constants\";\nimport { javascriptRules, typescriptRules, typescriptTypeCheckedRules } from \"../rules\";\nimport type { Linter } from \"eslint\";\n\n/**\n * 返回 typescript-eslint 推荐预置。\n *\n * @returns ESLint 核心推荐规则与对应的 typescript-eslint 推荐预置。\n */\nexport const getTypeScriptPresetConfigs = (): Linter.Config[] =>\n\t[\n\t\teslint.configs.recommended,\n\t\t{\n\t\t\tname: \"@fast-china/typescript/javascript-rules\",\n\t\t\trules: javascriptRules,\n\t\t},\n\t\t...tseslint.configs.recommendedTypeChecked,\n\t] as Linter.Config[];\n\n/**\n * 创建 TypeScript 解析器的 Project Service 选项。\n *\n * @returns 始终启用 `projectService` 的解析器选项。\n */\nexport const createTypeScriptParserOptions = (): Linter.ParserOptions => ({ projectService: true });\n\n/**\n * 创建 TypeScript 配置。\n *\n * @remarks\n * 始终采用 ESLint 与 typescript-eslint 的 `recommendedTypeChecked` 预置并启动 Project Service。\n * 被检查文件必须属于可发现的 tsconfig。特殊项目可在后置 Flat Config 中覆盖解析器选项。\n *\n * @param files - 应用 TypeScript 配置的 ESLint glob 列表。\n * @returns 包含 TypeScript 预置、解析器选项与本地规则的 Flat Config 数组。\n */\nexport const createTypeScriptConfigs = (files: readonly string[] = GLOBS_TYPESCRIPT): ReturnType<typeof defineConfig> =>\n\tdefineConfig([\n\t\t{\n\t\t\tname: \"@fast-china/typescript/type-checked\",\n\t\t\tfiles: [...files],\n\t\t\textends: getTypeScriptPresetConfigs(),\n\t\t\tlanguageOptions: {\n\t\t\t\tecmaVersion: \"latest\",\n\t\t\t\tparserOptions: createTypeScriptParserOptions(),\n\t\t\t},\n\t\t\trules: {\n\t\t\t\t...typescriptRules,\n\t\t\t\t...typescriptTypeCheckedRules,\n\t\t\t},\n\t\t},\n\t]);\n"],"mappings":";;;;;;;;;;;;AAYA,MAAa,mCACZ;CACC,OAAO,QAAQ;CACf;EACC,MAAM;EACN,OAAO;CACR;CACA,GAAG,SAAS,QAAQ;AACrB;;;;;;AAOD,MAAa,uCAA6D,EAAE,gBAAgB,KAAK;;;;;;;;;;;AAYjG,MAAa,2BAA2B,QAA2B,qBAClE,aAAa,CACZ;CACC,MAAM;CACN,OAAO,CAAC,GAAG,KAAK;CAChB,SAAS,2BAA2B;CACpC,iBAAiB;EAChB,aAAa;EACb,eAAe,8BAA8B;CAC9C;CACA,OAAO;EACN,GAAG;EACH,GAAG;CACJ;AACD,CACD,CAAC"}
1
+ {"version":3,"file":"typescript.mjs","names":[],"sources":["../../src/configs/typescript.ts"],"sourcesContent":["import eslint from \"@eslint/js\";\nimport { defineConfig } from \"eslint/config\";\nimport tseslint from \"typescript-eslint\";\nimport { GLOBS_TYPESCRIPT } from \"../constants\";\nimport { javascriptRules, typescriptRules, typescriptTypeCheckedRules } from \"../rules\";\nimport type { Linter } from \"eslint\";\n\n/**\n * 返回 typescript-eslint 推荐预置。\n *\n * @returns ESLint 核心推荐规则与对应的 typescript-eslint 推荐预置。\n */\nexport const getTypeScriptPresetConfigs = (): Linter.Config[] =>\n\t[\n\t\teslint.configs.recommended,\n\t\t{\n\t\t\tname: \"@fast-china/typescript/javascript-rules\",\n\t\t\trules: javascriptRules,\n\t\t},\n\t\t...tseslint.configs.recommendedTypeChecked,\n\t] as Linter.Config[];\n\n/**\n * 创建 TypeScript 解析器的 Project Service 选项。\n *\n * @remarks\n * TypeScript、TSX、Vue 与 NVue 必须使用完全一致的 `extraFileExtensions`。否则混合检查文件时,\n * TypeScript Server 会因扩展名集合变化而反复重载整个项目。\n *\n * @returns 始终启用 `projectService`,并统一声明 Vue 扩展名的解析器选项。\n */\nexport const createTypeScriptParserOptions = (): Linter.ParserOptions => ({\n\tprojectService: true,\n\textraFileExtensions: [\".vue\", \".nvue\"],\n});\n\n/**\n * 创建 TypeScript 配置。\n *\n * @remarks\n * 始终采用 ESLint 与 typescript-eslint 的 `recommendedTypeChecked` 预置并启动 Project Service。\n * 被检查文件必须属于可发现的 tsconfig。特殊项目可在后置 Flat Config 中覆盖解析器选项。\n *\n * @param files - 应用 TypeScript 配置的 ESLint glob 列表。\n * @returns 包含 TypeScript 预置、解析器选项与本地规则的 Flat Config 数组。\n */\nexport const createTypeScriptConfigs = (files: readonly string[] = GLOBS_TYPESCRIPT): ReturnType<typeof defineConfig> =>\n\tdefineConfig([\n\t\t{\n\t\t\tname: \"@fast-china/typescript/type-checked\",\n\t\t\tfiles: [...files],\n\t\t\textends: getTypeScriptPresetConfigs(),\n\t\t\tlanguageOptions: {\n\t\t\t\tecmaVersion: \"latest\",\n\t\t\t\tparserOptions: createTypeScriptParserOptions(),\n\t\t\t},\n\t\t\trules: {\n\t\t\t\t...typescriptRules,\n\t\t\t\t...typescriptTypeCheckedRules,\n\t\t\t},\n\t\t},\n\t]);\n"],"mappings":";;;;;;;;;;;;AAYA,MAAa,mCACZ;CACC,OAAO,QAAQ;CACf;EACC,MAAM;EACN,OAAO;CACR;CACA,GAAG,SAAS,QAAQ;AACrB;;;;;;;;;;AAWD,MAAa,uCAA6D;CACzE,gBAAgB;CAChB,qBAAqB,CAAC,QAAQ,OAAO;AACtC;;;;;;;;;;;AAYA,MAAa,2BAA2B,QAA2B,qBAClE,aAAa,CACZ;CACC,MAAM;CACN,OAAO,CAAC,GAAG,KAAK;CAChB,SAAS,2BAA2B;CACpC,iBAAiB;EAChB,aAAa;EACb,eAAe,8BAA8B;CAC9C;CACA,OAAO;EACN,GAAG;EACH,GAAG;CACJ;AACD,CACD,CAAC"}
@@ -25,7 +25,6 @@ const createVueConfigs = () => defineConfig([{
25
25
  parser: vueEslintParser,
26
26
  parserOptions: {
27
27
  parser: tseslint.parser,
28
- extraFileExtensions: [".vue", ".nvue"],
29
28
  ecmaFeatures: { jsx: true },
30
29
  sourceType: "module",
31
30
  ...createTypeScriptParserOptions()
@@ -1 +1 @@
1
- {"version":3,"file":"vue.mjs","names":[],"sources":["../../src/configs/vue.ts"],"sourcesContent":["import { defineConfig } from \"eslint/config\";\nimport eslintPluginVue from \"eslint-plugin-vue\";\nimport tseslint from \"typescript-eslint\";\nimport vueEslintParser from \"vue-eslint-parser\";\nimport { GLOB_NVUE, GLOB_VUE } from \"../constants\";\nimport { typescriptRules, typescriptTypeCheckedRules, vueRules } from \"../rules\";\nimport { createTypeScriptParserOptions, getTypeScriptPresetConfigs } from \"./typescript\";\n\n/**\n * 创建 Vue 3 单文件组件配置。\n *\n * @remarks\n * 本包只处理 Vue 3,并默认同时接管 UniApp 原生渲染页面使用的 `.nvue`。Vue 模板解析器\n * 通过 `parserOptions.parser` 委托给 typescript-eslint,统一使用类型感知检查。\n *\n * @returns 包含 Vue 模板、脚本解析器、推荐预置与本地规则的 Flat Config 数组。\n */\nexport const createVueConfigs = (): ReturnType<typeof defineConfig> =>\n\tdefineConfig([\n\t\t{\n\t\t\tname: \"@fast-china/vue/type-checked\",\n\t\t\tfiles: [GLOB_VUE, GLOB_NVUE],\n\t\t\textends: [...getTypeScriptPresetConfigs(), ...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\tparser: tseslint.parser,\n\t\t\t\t\textraFileExtensions: [\".vue\", \".nvue\"],\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(),\n\t\t\t\t},\n\t\t\t},\n\t\t\trules: {\n\t\t\t\t...typescriptRules,\n\t\t\t\t...typescriptTypeCheckedRules,\n\t\t\t\t// Vue SFC 继承的 TypeScript 预置保留自身 files 范围,因此显式关闭容易误判 TS AST 的核心规则。\n\t\t\t\t...(tseslint.configs.recommendedTypeChecked[1]?.rules ?? {}),\n\t\t\t\t// SFC 内部函数依赖上下文推断返回类型,只要求模块导出边界显式声明。\n\t\t\t\t\"@typescript-eslint/explicit-function-return-type\": \"off\",\n\t\t\t\t...vueRules,\n\t\t\t},\n\t\t},\n\t]);\n"],"mappings":";;;;;;;;;;;;;;;;;;AAiBA,MAAa,yBACZ,aAAa,CACZ;CACC,MAAM;CACN,OAAO,CAAC,UAAU,SAAS;CAC3B,SAAS,CAAC,GAAG,2BAA2B,GAAG,GAAG,gBAAgB,QAAQ,mBAAmB;CACzF,iBAAiB;EAChB,aAAa;EACb,QAAQ;EACR,eAAe;GACd,QAAQ,SAAS;GACjB,qBAAqB,CAAC,QAAQ,OAAO;GACrC,cAAc,EACb,KAAK,KACN;GACA,YAAY;GACZ,GAAG,8BAA8B;EAClC;CACD;CACA,OAAO;EACN,GAAG;EACH,GAAG;EAEH,GAAI,SAAS,QAAQ,uBAAuB,EAAE,EAAE,SAAS,CAAC;EAE1D,oDAAoD;EACpD,GAAG;CACJ;AACD,CACD,CAAC"}
1
+ {"version":3,"file":"vue.mjs","names":[],"sources":["../../src/configs/vue.ts"],"sourcesContent":["import { defineConfig } from \"eslint/config\";\nimport eslintPluginVue from \"eslint-plugin-vue\";\nimport tseslint from \"typescript-eslint\";\nimport vueEslintParser from \"vue-eslint-parser\";\nimport { GLOB_NVUE, GLOB_VUE } from \"../constants\";\nimport { typescriptRules, typescriptTypeCheckedRules, vueRules } from \"../rules\";\nimport { createTypeScriptParserOptions, getTypeScriptPresetConfigs } from \"./typescript\";\n\n/**\n * 创建 Vue 3 单文件组件配置。\n *\n * @remarks\n * 本包只处理 Vue 3,并默认同时接管 UniApp 原生渲染页面使用的 `.nvue`。Vue 模板解析器\n * 通过 `parserOptions.parser` 委托给 typescript-eslint,统一使用类型感知检查。\n *\n * @returns 包含 Vue 模板、脚本解析器、推荐预置与本地规则的 Flat Config 数组。\n */\nexport const createVueConfigs = (): ReturnType<typeof defineConfig> =>\n\tdefineConfig([\n\t\t{\n\t\t\tname: \"@fast-china/vue/type-checked\",\n\t\t\tfiles: [GLOB_VUE, GLOB_NVUE],\n\t\t\textends: [...getTypeScriptPresetConfigs(), ...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\tparser: tseslint.parser,\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(),\n\t\t\t\t},\n\t\t\t},\n\t\t\trules: {\n\t\t\t\t...typescriptRules,\n\t\t\t\t...typescriptTypeCheckedRules,\n\t\t\t\t// Vue SFC 继承的 TypeScript 预置保留自身 files 范围,因此显式关闭容易误判 TS AST 的核心规则。\n\t\t\t\t...(tseslint.configs.recommendedTypeChecked[1]?.rules ?? {}),\n\t\t\t\t// SFC 内部函数依赖上下文推断返回类型,只要求模块导出边界显式声明。\n\t\t\t\t\"@typescript-eslint/explicit-function-return-type\": \"off\",\n\t\t\t\t...vueRules,\n\t\t\t},\n\t\t},\n\t]);\n"],"mappings":";;;;;;;;;;;;;;;;;;AAiBA,MAAa,yBACZ,aAAa,CACZ;CACC,MAAM;CACN,OAAO,CAAC,UAAU,SAAS;CAC3B,SAAS,CAAC,GAAG,2BAA2B,GAAG,GAAG,gBAAgB,QAAQ,mBAAmB;CACzF,iBAAiB;EAChB,aAAa;EACb,QAAQ;EACR,eAAe;GACd,QAAQ,SAAS;GACjB,cAAc,EACb,KAAK,KACN;GACA,YAAY;GACZ,GAAG,8BAA8B;EAClC;CACD;CACA,OAAO;EACN,GAAG;EACH,GAAG;EAEH,GAAI,SAAS,QAAQ,uBAAuB,EAAE,EAAE,SAAS,CAAC;EAE1D,oDAAoD;EACpD,GAAG;CACJ;AACD,CACD,CAAC"}
@@ -11,11 +11,15 @@ declare const importRules: {
11
11
  "import-x/no-duplicates": "error";
12
12
  "import-x/order": ["error", {
13
13
  groups: string[];
14
- pathGroups: {
14
+ pathGroups: ({
15
15
  pattern: string;
16
16
  group: "external";
17
17
  position: "before";
18
- }[];
18
+ } | {
19
+ pattern: string;
20
+ group: "internal";
21
+ position: "before";
22
+ })[];
19
23
  pathGroupsExcludedImportTypes: string[];
20
24
  sortTypesGroup: true;
21
25
  "newlines-between": "never";
@@ -18,8 +18,8 @@ const importRules = {
18
18
  "sibling",
19
19
  "index",
20
20
  "object",
21
- "type",
22
- "unknown"
21
+ "unknown",
22
+ "type"
23
23
  ],
24
24
  pathGroups: [
25
25
  {
@@ -51,6 +51,11 @@ const importRules = {
51
51
  pattern: "lodash{,-es,-unified}{,/**}",
52
52
  group: "external",
53
53
  position: "before"
54
+ },
55
+ {
56
+ pattern: "@/**",
57
+ group: "internal",
58
+ position: "before"
54
59
  }
55
60
  ],
56
61
  pathGroupsExcludedImportTypes: ["type"],
@@ -1 +1 @@
1
- {"version":3,"file":"import.mjs","names":[],"sources":["../../src/rules/import.ts"],"sourcesContent":["import type { RuleOptions } from \"../typegen\";\n\n/**\n * 默认启用的模块导入正确性与排序规则。\n *\n * @remarks\n * 该记录补充 import-x 推荐预置,统一导入位置、重复导入及分组顺序。依赖项目 resolver\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// 常用平台、框架和工具依赖优先于其他第三方依赖,并按声明顺序分层排序\n\t\t\tpathGroups: [\n\t\t\t\t// uni-app 平台生态\n\t\t\t\t{ pattern: \"@dcloudio/**\", group: \"external\", position: \"before\" },\n\t\t\t\t// Vue 核心、路由、状态管理和 VueUse 生态\n\t\t\t\t{ pattern: \"{vue,@vue/**,vue-router,pinia,@pinia/**,@vueuse/**}\", group: \"external\", position: \"before\" },\n\t\t\t\t// Element Plus 生态及其子路径\n\t\t\t\t{ pattern: \"{element-plus,element-plus/**,@element-plus/**}\", group: \"external\", position: \"before\" },\n\t\t\t\t// Fast Element Plus 生态及其子路径\n\t\t\t\t{ pattern: \"{fast-element-plus,fast-element-plus/**,@fast-element-plus/**}\", group: \"external\", position: \"before\" },\n\t\t\t\t// Fast China 组织包及其子路径\n\t\t\t\t{ pattern: \"@fast-china/**\", group: \"external\", position: \"before\" },\n\t\t\t\t// Lodash、lodash-es、lodash-unified 及其子路径\n\t\t\t\t{ pattern: \"lodash{,-es,-unified}{,/**}\", group: \"external\", position: \"before\" },\n\t\t\t],\n\t\t\t// 类型导入不参与自定义 pathGroups 匹配,统一保留在 type 总分组\n\t\t\tpathGroupsExcludedImportTypes: [\"type\"],\n\t\t\t// type 总分组内部继续按照 builtin、external、internal、parent、sibling、index 来源层级排序\n\t\t\tsortTypesGroup: true,\n\t\t\t// 所有 import 分组连续排列,不保留空行\n\t\t\t\"newlines-between\": \"never\",\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// 非样式副作用导入同样参与检查;样式导入由 createImportConfigs 注册的本地规则独立处理\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"],"mappings":";;;;;;;;AASA,MAAa,cAAc;CAE1B,kBAAkB;CAElB,0BAA0B;CAE1B,kBAAkB,CACjB,SACA;EACC,QAAQ;GAEP;GAEA;GAEA;GAEA;GAEA;GAEA;GAEA;GAEA;GAEA;EACD;EAEA,YAAY;GAEX;IAAE,SAAS;IAAgB,OAAO;IAAY,UAAU;GAAS;GAEjE;IAAE,SAAS;IAAuD,OAAO;IAAY,UAAU;GAAS;GAExG;IAAE,SAAS;IAAmD,OAAO;IAAY,UAAU;GAAS;GAEpG;IAAE,SAAS;IAAkE,OAAO;IAAY,UAAU;GAAS;GAEnH;IAAE,SAAS;IAAkB,OAAO;IAAY,UAAU;GAAS;GAEnE;IAAE,SAAS;IAA+B,OAAO;IAAY,UAAU;GAAS;EACjF;EAEA,+BAA+B,CAAC,MAAM;EAEtC,gBAAgB;EAEhB,oBAAoB;EAEpB,aAAa;GACZ,OAAO;GACP,iBAAiB;EAClB;EAEA,yBAAyB;CAC1B,CACD;CAEA,0BAA0B;CAE1B,sBAAsB;CAEtB,oBAAoB;CAEpB,gCAAgC;CAEhC,uCAAuC;CAEvC,kBAAkB;AACnB"}
1
+ {"version":3,"file":"import.mjs","names":[],"sources":["../../src/rules/import.ts"],"sourcesContent":["import type { RuleOptions } from \"../typegen\";\n\n/**\n * 默认启用的模块导入正确性与排序规则。\n *\n * @remarks\n * 该记录补充 import-x 推荐预置,统一导入位置、重复导入及分组顺序。依赖项目 resolver\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// 无法识别分类的导入\n\t\t\t\t\"unknown\",\n\t\t\t\t// TypeScript 类型导入始终位于所有非样式导入之后\n\t\t\t\t\"type\",\n\t\t\t],\n\t\t\t// 常用平台、框架和工具依赖优先于其他第三方依赖,并按声明顺序分层排序\n\t\t\tpathGroups: [\n\t\t\t\t// uni-app 平台生态\n\t\t\t\t{ pattern: \"@dcloudio/**\", group: \"external\", position: \"before\" },\n\t\t\t\t// Vue 核心、路由、状态管理和 VueUse 生态\n\t\t\t\t{ pattern: \"{vue,@vue/**,vue-router,pinia,@pinia/**,@vueuse/**}\", group: \"external\", position: \"before\" },\n\t\t\t\t// Element Plus 生态及其子路径\n\t\t\t\t{ pattern: \"{element-plus,element-plus/**,@element-plus/**}\", group: \"external\", position: \"before\" },\n\t\t\t\t// Fast Element Plus 生态及其子路径\n\t\t\t\t{ pattern: \"{fast-element-plus,fast-element-plus/**,@fast-element-plus/**}\", group: \"external\", position: \"before\" },\n\t\t\t\t// Fast China 组织包及其子路径\n\t\t\t\t{ pattern: \"@fast-china/**\", group: \"external\", position: \"before\" },\n\t\t\t\t// Lodash、lodash-es、lodash-unified 及其子路径\n\t\t\t\t{ pattern: \"lodash{,-es,-unified}{,/**}\", group: \"external\", position: \"before\" },\n\t\t\t\t// 项目根目录 @/ 别名归入 internal,并优先于其他 internal 导入\n\t\t\t\t{ pattern: \"@/**\", group: \"internal\", position: \"before\" },\n\t\t\t],\n\t\t\t// 类型导入不参与自定义 pathGroups 匹配,统一保留在 type 总分组\n\t\t\tpathGroupsExcludedImportTypes: [\"type\"],\n\t\t\t// type 总分组内部继续按照 builtin、external、internal、parent、sibling、index 来源层级排序\n\t\t\tsortTypesGroup: true,\n\t\t\t// 所有 import 分组连续排列,不保留空行\n\t\t\t\"newlines-between\": \"never\",\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// 非样式副作用导入同样参与检查;样式导入由 createImportConfigs 注册的本地规则独立处理\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"],"mappings":";;;;;;;;AASA,MAAa,cAAc;CAE1B,kBAAkB;CAElB,0BAA0B;CAE1B,kBAAkB,CACjB,SACA;EACC,QAAQ;GAEP;GAEA;GAEA;GAEA;GAEA;GAEA;GAEA;GAEA;GAEA;EACD;EAEA,YAAY;GAEX;IAAE,SAAS;IAAgB,OAAO;IAAY,UAAU;GAAS;GAEjE;IAAE,SAAS;IAAuD,OAAO;IAAY,UAAU;GAAS;GAExG;IAAE,SAAS;IAAmD,OAAO;IAAY,UAAU;GAAS;GAEpG;IAAE,SAAS;IAAkE,OAAO;IAAY,UAAU;GAAS;GAEnH;IAAE,SAAS;IAAkB,OAAO;IAAY,UAAU;GAAS;GAEnE;IAAE,SAAS;IAA+B,OAAO;IAAY,UAAU;GAAS;GAEhF;IAAE,SAAS;IAAQ,OAAO;IAAY,UAAU;GAAS;EAC1D;EAEA,+BAA+B,CAAC,MAAM;EAEtC,gBAAgB;EAEhB,oBAAoB;EAEpB,aAAa;GACZ,OAAO;GACP,iBAAiB;EAClB;EAEA,yBAAyB;CAC1B,CACD;CAEA,0BAA0B;CAE1B,sBAAsB;CAEtB,oBAAoB;CAEpB,gCAAgC;CAEhC,uCAAuC;CAEvC,kBAAkB;AACnB"}
@@ -1,8 +1,8 @@
1
1
  # 工程质量审查报告
2
2
 
3
- 审查日期:2026-08-29
3
+ 审查日期:2026-08-30
4
4
 
5
- 审查对象:`@fast-china/eslint-config` 2.1.3 工作区
5
+ 审查对象:`@fast-china/eslint-config` 2.1.5 工作区
6
6
 
7
7
  ## 结论
8
8
 
@@ -11,6 +11,7 @@
11
11
  ## 当前规则模型
12
12
 
13
13
  - JavaScript、TypeScript、Import 和 RegExp 只有一套共享规则。
14
+ - `@/**` 根别名归入 internal;类型导入位于所有其他非样式导入之后,并在 type 总分组内按来源层级排序。
14
15
  - 样式导入由独立规则约束为最后一个连续分组,不参与普通 import 字母排序,也不提供自动修复。
15
16
  - TypeScript、Vue 和 React TypeScript 始终使用 `recommendedTypeChecked` 与 Project Service。
16
17
  - Vue 使用 `flat/recommended`,并叠加事件声明、kebab-case 属性、闭合标签和排序规则。
@@ -1,6 +1,6 @@
1
1
  # Default Rules and Risk Guide
2
2
 
3
- This document describes the current 2.1.3 configuration model, major rules, and migration risks. Source comments explain current intent only; historical changes belong in `CHANGELOG.md`.
3
+ This document describes the current 2.1.5 configuration model, major rules, and migration risks. Source comments explain current intent only; historical changes belong in `CHANGELOG.md`.
4
4
 
5
5
  ## Configuration model
6
6
 
@@ -43,12 +43,12 @@ The root entry is a fixed Vue 3 + TypeScript + UniApp preset:
43
43
  - `prefer-arrow-callback`, `logical-assignment-operators`, and `prefer-object-spread` are errors.
44
44
  - `prefer-exponentiation-operator` and `prefer-object-has-own` are errors.
45
45
  - `sort-imports` warns and only sorts members within one import.
46
- - `import-x/order` is an error with `warnOnUnassignedImports: true` and `sortTypesGroup: true`; ordinary side-effect imports remain checked, type imports are ordered by source category inside the final type group, and stylesheet imports do not participate in this rule.
46
+ - `import-x/order` is an error with `warnOnUnassignedImports: true` and `sortTypesGroup: true`; `@/**` belongs to `internal`, type imports follow every non-style import and retain source-category ordering inside the final type group, and stylesheet imports do not participate in this rule.
47
47
  - `import-x/style-imports-last` is an error; CSS, SCSS, LESS, and related styles must form the final contiguous import group, with their internal order preserved and no automatic fix.
48
48
 
49
49
  ### TypeScript
50
50
 
51
- - `recommendedTypeChecked` and `projectService: true` are always enabled.
51
+ - `recommendedTypeChecked` and `projectService: true` are always enabled; TypeScript, TSX, Vue, and NVue share `extraFileExtensions: [".vue", ".nvue"]` to prevent Project Service reloads during mixed-file linting.
52
52
  - `explicit-module-boundary-types` is an error and does not allow explicitly typed `any` arguments as an escape hatch.
53
53
  - `explicit-function-return-type` is not additionally enabled, so internal functions and callbacks can rely on inference.
54
54
  - `no-explicit-any` warns.
@@ -1,6 +1,6 @@
1
1
  # 默认规则与风险指南
2
2
 
3
- 本文说明 2.1.3 当前配置模型、主要规则和迁移风险。规则源码注释只解释现行意图;历史差异统一记录在 `CHANGELOG.md`。
3
+ 本文说明 2.1.5 当前配置模型、主要规则和迁移风险。规则源码注释只解释现行意图;历史差异统一记录在 `CHANGELOG.md`。
4
4
 
5
5
  ## 配置模型
6
6
 
@@ -43,12 +43,12 @@ SDK、OA、Admin、Vue Web 与 UniApp 客户端共享同一套 JavaScript、Type
43
43
  - `prefer-arrow-callback`、`logical-assignment-operators`、`prefer-object-spread` 为 `error`。
44
44
  - `prefer-exponentiation-operator`、`prefer-object-has-own` 为 `error`。
45
45
  - `sort-imports` 为 `warn`,只排序同一 import 的成员。
46
- - `import-x/order` 为 `error`,并设置 `warnOnUnassignedImports: true` 和 `sortTypesGroup: true`;普通副作用导入继续受检,类型导入在 `type` 总分组内按来源层级排序,样式导入不参与该规则。
46
+ - `import-x/order` 为 `error`,并设置 `warnOnUnassignedImports: true` 和 `sortTypesGroup: true`;`@/**` 归入 `internal`,类型导入位于所有非样式导入之后并在 `type` 总分组内按来源层级排序,样式导入不参与该规则。
47
47
  - `import-x/style-imports-last` 为 `error`;CSS、SCSS、LESS 等样式必须形成最后一个连续导入分组,组内顺序保持不变且不自动修复。
48
48
 
49
49
  ### TypeScript
50
50
 
51
- - 始终启用 `recommendedTypeChecked` 与 `projectService: true`。
51
+ - 始终启用 `recommendedTypeChecked` 与 `projectService: true`;TypeScript、TSX、Vue 与 NVue 统一使用 `extraFileExtensions: [".vue", ".nvue"]`,避免混合检查时 Project Service 重载项目。
52
52
  - `explicit-module-boundary-types` 为 `error`,模块导出边界必须显式声明类型,不允许用显式 `any` 参数规避。
53
53
  - `explicit-function-return-type` 不额外启用,内部函数和回调可以依赖推断。
54
54
  - `no-explicit-any` 为 `warn`。
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fast-china/eslint-config",
3
- "version": "2.1.3",
3
+ "version": "2.1.5",
4
4
  "description": "Practical, typed ESLint Flat Config for Vue 3, UniApp, React, Angular, Vite, TypeScript, JavaScript, and Node.js.",
5
5
  "type": "module",
6
6
  "keywords": [