@fast-china/eslint-config 2.1.3 → 2.1.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.
package/CHANGELOG.md
CHANGED
|
@@ -6,6 +6,12 @@ The format follows [Keep a Changelog](https://keepachangelog.com/en/1.1.0/), and
|
|
|
6
6
|
|
|
7
7
|
## Unreleased
|
|
8
8
|
|
|
9
|
+
## 2.1.4 - 2026-08-30
|
|
10
|
+
|
|
11
|
+
### Changed
|
|
12
|
+
|
|
13
|
+
- 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.
|
|
14
|
+
|
|
9
15
|
## 2.1.3 - 2026-08-29
|
|
10
16
|
|
|
11
17
|
### Changed
|
package/dist/rules/import.d.mts
CHANGED
|
@@ -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";
|
package/dist/rules/import.mjs
CHANGED
|
@@ -18,8 +18,8 @@ const importRules = {
|
|
|
18
18
|
"sibling",
|
|
19
19
|
"index",
|
|
20
20
|
"object",
|
|
21
|
-
"
|
|
22
|
-
"
|
|
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//
|
|
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-
|
|
3
|
+
审查日期:2026-08-30
|
|
4
4
|
|
|
5
|
-
审查对象:`@fast-china/eslint-config` 2.1.
|
|
5
|
+
审查对象:`@fast-china/eslint-config` 2.1.4 工作区
|
|
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 属性、闭合标签和排序规则。
|
package/docs/rules-risk.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Default Rules and Risk Guide
|
|
2
2
|
|
|
3
|
-
This document describes the current 2.1.
|
|
3
|
+
This document describes the current 2.1.4 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,7 +43,7 @@ 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`;
|
|
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
|
package/docs/rules-risk.zh.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# 默认规则与风险指南
|
|
2
2
|
|
|
3
|
-
本文说明 2.1.
|
|
3
|
+
本文说明 2.1.4 当前配置模型、主要规则和迁移风险。规则源码注释只解释现行意图;历史差异统一记录在 `CHANGELOG.md`。
|
|
4
4
|
|
|
5
5
|
## 配置模型
|
|
6
6
|
|
|
@@ -43,7 +43,7 @@ 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
|
|
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
|
package/package.json
CHANGED