@fast-china/eslint-config 2.0.9 → 2.1.0
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 +38 -0
- package/CONTRIBUTING.md +8 -7
- package/README.md +108 -236
- package/README.zh.md +105 -231
- package/SECURITY.md +4 -4
- package/dist/configs/angular.d.mts +6 -6
- package/dist/configs/angular.mjs +1 -1
- package/dist/configs/angular.mjs.map +1 -1
- package/dist/configs/common.d.mts +2 -1
- package/dist/configs/common.mjs.map +1 -1
- package/dist/configs/environment.d.mts +21 -11
- package/dist/configs/environment.mjs +25 -5
- package/dist/configs/environment.mjs.map +1 -1
- package/dist/configs/ignores.d.mts +3 -2
- package/dist/configs/ignores.mjs +4 -3
- package/dist/configs/ignores.mjs.map +1 -1
- package/dist/configs/import.d.mts +2 -1
- package/dist/configs/import.mjs.map +1 -1
- package/dist/configs/index.d.mts +5 -4
- package/dist/configs/index.mjs +3 -2
- package/dist/configs/javascript.d.mts +2 -1
- package/dist/configs/javascript.mjs.map +1 -1
- package/dist/configs/json.d.mts +5 -3
- package/dist/configs/json.mjs +5 -4
- package/dist/configs/json.mjs.map +1 -1
- package/dist/configs/lodash.d.mts +2 -1
- package/dist/configs/lodash.mjs.map +1 -1
- package/dist/configs/markdown.d.mts +2 -1
- package/dist/configs/markdown.mjs.map +1 -1
- package/dist/configs/prettier.d.mts +2 -1
- package/dist/configs/prettier.mjs +4 -1
- package/dist/configs/prettier.mjs.map +1 -1
- package/dist/configs/react.d.mts +7 -44
- package/dist/configs/react.mjs +7 -8
- package/dist/configs/react.mjs.map +1 -1
- package/dist/configs/regexp.d.mts +4 -4
- package/dist/configs/regexp.mjs +5 -4
- package/dist/configs/regexp.mjs.map +1 -1
- package/dist/configs/sort-package.d.mts +4 -3
- package/dist/configs/sort-package.mjs +2 -2
- package/dist/configs/sort-package.mjs.map +1 -1
- package/dist/configs/sort-tsconfig.d.mts +4 -2
- package/dist/configs/sort-tsconfig.mjs +2 -1
- package/dist/configs/sort-tsconfig.mjs.map +1 -1
- package/dist/configs/typescript.d.mts +9 -56
- package/dist/configs/typescript.mjs +20 -29
- package/dist/configs/typescript.mjs.map +1 -1
- package/dist/configs/uniapp.d.mts +17 -0
- package/dist/configs/uniapp.mjs +30 -0
- package/dist/configs/uniapp.mjs.map +1 -0
- package/dist/configs/vue.d.mts +5 -38
- package/dist/configs/vue.mjs +25 -35
- package/dist/configs/vue.mjs.map +1 -1
- package/dist/constants/index.d.mts +33 -1
- package/dist/constants/index.mjs +33 -1
- package/dist/constants/index.mjs.map +1 -1
- package/dist/index.d.mts +41 -208
- package/dist/index.mjs +58 -100
- package/dist/index.mjs.map +1 -1
- package/dist/rules/angular.d.mts +1 -1
- package/dist/rules/angular.mjs +1 -1
- package/dist/rules/angular.mjs.map +1 -1
- package/dist/rules/common.d.mts +2 -2
- package/dist/rules/common.mjs +2 -2
- package/dist/rules/common.mjs.map +1 -1
- package/dist/rules/import.mjs.map +1 -1
- package/dist/rules/index.d.mts +2 -1
- package/dist/rules/index.mjs +2 -1
- package/dist/rules/javascript.d.mts +10 -6
- package/dist/rules/javascript.mjs +12 -6
- package/dist/rules/javascript.mjs.map +1 -1
- package/dist/rules/react.d.mts +2 -3
- package/dist/rules/react.mjs +2 -3
- package/dist/rules/react.mjs.map +1 -1
- package/dist/rules/regexp.d.mts +38 -0
- package/dist/rules/regexp.mjs +39 -0
- package/dist/rules/regexp.mjs.map +1 -0
- package/dist/rules/sort-package.d.mts +1 -1
- package/dist/rules/sort-package.mjs +1 -1
- package/dist/rules/sort-package.mjs.map +1 -1
- package/dist/rules/sort-tsconfig.d.mts +1 -1
- package/dist/rules/sort-tsconfig.mjs +1 -1
- package/dist/rules/sort-tsconfig.mjs.map +1 -1
- package/dist/rules/typescript.d.mts +11 -3
- package/dist/rules/typescript.mjs +10 -4
- package/dist/rules/typescript.mjs.map +1 -1
- package/dist/rules/vue.d.mts +8 -2
- package/dist/rules/vue.mjs +8 -2
- package/dist/rules/vue.mjs.map +1 -1
- package/docs/engineering-audit.zh.md +53 -77
- package/docs/rules-risk.md +104 -101
- package/docs/rules-risk.zh.md +104 -105
- package/package.json +3 -2
|
@@ -1,104 +1,80 @@
|
|
|
1
1
|
# 工程质量审查报告
|
|
2
2
|
|
|
3
|
-
审查日期:2026-08-
|
|
3
|
+
审查日期:2026-08-26
|
|
4
4
|
|
|
5
|
-
审查对象:`@fast-china/eslint-config` 2.0
|
|
5
|
+
审查对象:`@fast-china/eslint-config` 2.1.0 工作区
|
|
6
6
|
|
|
7
7
|
## 结论
|
|
8
8
|
|
|
9
|
-
|
|
9
|
+
仓库继续使用 ESLint 10 Flat Config、精确规则类型、可重复构建和发布包契约,并将根入口收敛为固定的 Vue 3 + TypeScript + UniApp 配置。SDK、React、Angular、Node.js 等其他项目通过不绑定框架的基础组合和对应框架片段接入,不继承 Vue 或 UniApp globals。
|
|
10
10
|
|
|
11
|
-
|
|
11
|
+
## 当前规则模型
|
|
12
12
|
|
|
13
|
-
|
|
13
|
+
- JavaScript、TypeScript、Import 和 RegExp 只有一套共享规则。
|
|
14
|
+
- TypeScript、Vue 和 React TypeScript 始终使用 `recommendedTypeChecked` 与 Project Service。
|
|
15
|
+
- Vue 使用 `flat/recommended`,并叠加事件声明、kebab-case 属性、闭合标签和排序规则。
|
|
16
|
+
- RegExp 使用显式审查过的正确性与安全规则,不继承完整偏好型推荐集合。
|
|
17
|
+
- React 使用 `@eslint-react` 推荐预置和 React 官方 Hooks Recommended,并关闭重复实现。
|
|
18
|
+
- Angular 与官方 TypeScript、模板和无障碍推荐规则保持一致。
|
|
19
|
+
- 规则源码注释只说明当前意图;历史版本差异由更新日志维护。
|
|
14
20
|
|
|
15
|
-
|
|
16
|
-
- TypeScript 6、tsdown、类型生成与声明文件
|
|
17
|
-
- ESLint Flat Config 顺序、文件作用域、解析器和插件注册
|
|
18
|
-
- JavaScript、TypeScript、Vue、React、Angular、JSON 方言、Markdown、RegExp 与 import 集成
|
|
19
|
-
- 浏览器、Node.js、通用环境和项目自定义全局变量
|
|
20
|
-
- Lodash 静态导入策略、清单排序与 Prettier 职责边界
|
|
21
|
-
- README、规则风险说明、贡献流程、CI、测试和发布前检查
|
|
21
|
+
## 公共 API
|
|
22
22
|
|
|
23
|
-
|
|
23
|
+
根入口公开:
|
|
24
24
|
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
| Flat Config | 通过 | 所有语言和插件配置限定到明确文件范围,项目覆写最后应用 |
|
|
29
|
-
| Vue 3 | 通过 | `vue-eslint-parser` 处理 SFC,TypeScript 解析器正确嵌套 |
|
|
30
|
-
| React | 通过 | 按需覆盖 JSX/TSX、组件、官方 Hooks、Compiler 诊断与 DOM 安全 |
|
|
31
|
-
| Angular | 通过 | 按需覆盖框架 TypeScript、外部 HTML、内联模板与模板无障碍 |
|
|
32
|
-
| TypeScript | 通过 | 默认使用推荐规则,可选 Project Service 类型感知模式 |
|
|
33
|
-
| JavaScript | 通过 | 应用 `@eslint/js` 推荐规则并区分应用环境与 Node.js 工程文件 |
|
|
34
|
-
| 数据与文档文件 | 通过 | JSON、JSONC、JSON5 和 Markdown 分别使用对应语言配置 |
|
|
35
|
-
| 规则自动补全 | 通过 | 从 ESLint 核心和随包插件 schema 生成精确 `RuleOptions` |
|
|
36
|
-
| Lodash 策略 | 通过 | 可选统一 `lodash` 或 `lodash-unified`,默认不限制项目依赖选择 |
|
|
37
|
-
| 清单排序 | 通过 | 默认关闭;启用后不会重排 `package.json#exports` 条件键 |
|
|
38
|
-
| Prettier | 通过 | 只关闭冲突规则,格式化由 Prettier CLI 或编辑器负责 |
|
|
39
|
-
| 构建与发布 | 通过 | tsdown 生成 `.mjs`、`.d.mts` 和 source map,`prepack` 执行完整质量门禁 |
|
|
40
|
-
| 自动化验证 | 通过 | 运行时测试、消费者类型测试、格式检查、静态检查和 Node.js 多版本 CI |
|
|
25
|
+
- 默认 Vue 3 + TypeScript + UniApp Flat Config。
|
|
26
|
+
- 只接收 `environment` 的 `fastConfig()`。
|
|
27
|
+
- `defineRules()`、`FastConfigOptions` 和 `RuleOptions`。
|
|
41
28
|
|
|
42
|
-
|
|
29
|
+
`defaultConfigOptions`、语言和插件布尔开关、`typeChecked`、`tsconfigRootDir`、工厂级 rules/globals/ignores 已删除。项目覆写使用原生后置 Flat Config。
|
|
43
30
|
|
|
44
|
-
`
|
|
31
|
+
根入口新增固定 `createBaseConfigs()`,供 React、Angular、Node.js 和 SDK 组合。框架、Markdown、Lodash 及其他低层片段仍从 `./configs` 显式引用。
|
|
45
32
|
|
|
46
|
-
|
|
47
|
-
2. 应用运行环境、项目全局变量和 Node.js 工程文件全局变量。
|
|
48
|
-
3. JavaScript、import-x、RegExp、TypeScript、JSON 方言、Vue、React、Angular 和 Markdown 配置。
|
|
49
|
-
4. 可选 `package.json`、`tsconfig*.json` 排序配置。
|
|
50
|
-
5. Prettier 冲突关闭配置。
|
|
51
|
-
6. 工厂级 `rules` 与调用方传入的文件级覆写。
|
|
33
|
+
## 工程能力
|
|
52
34
|
|
|
53
|
-
|
|
35
|
+
| 领域 | 状态 | 质量保障 |
|
|
36
|
+
| ------------- | ---- | -------------------------------------------------- |
|
|
37
|
+
| 公共 API | 通过 | 根入口固定、其他能力由独立子路径组合 |
|
|
38
|
+
| JavaScript | 通过 | 核心 recommended + 统一现代语法规则 |
|
|
39
|
+
| TypeScript | 通过 | 固定 `recommendedTypeChecked` 与 Project Service |
|
|
40
|
+
| Vue 3 | 通过 | `vue-eslint-parser` + `flat/recommended` |
|
|
41
|
+
| UniApp | 通过 | 默认 `.nvue`、globals、清单注释和 `unpackage` 忽略 |
|
|
42
|
+
| React | 通过 | 显式组合 JSX/TSX、Hooks Recommended 与 DOM 安全 |
|
|
43
|
+
| Angular | 通过 | 显式组合源码、外部/内联模板和无障碍规则 |
|
|
44
|
+
| Import | 通过 | 正确性和排序为 error,副作用导入参与检查 |
|
|
45
|
+
| RegExp | 通过 | 显式正确性、安全和超线性回溯规则 |
|
|
46
|
+
| JSON | 通过 | 三种方言、VS Code 与 UniApp 注释例外 |
|
|
47
|
+
| 清单排序 | 通过 | 默认启用并保留 `exports` 条件顺序 |
|
|
48
|
+
| Markdown | 通过 | 作为独立片段显式组合 |
|
|
49
|
+
| Node 工具文件 | 通过 | Node globals、console 和 CommonJS 末尾覆写 |
|
|
50
|
+
| 类型生成 | 通过 | 插件 schema 生成精确 `RuleOptions` |
|
|
51
|
+
| 构建发布 | 通过 | TypeScript 6、tsdown、ESM 和根目录 `dist/` |
|
|
54
52
|
|
|
55
|
-
##
|
|
53
|
+
## 根入口配置顺序
|
|
56
54
|
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
- `@fast-china/eslint-config/rules` 提供有完整注释的原始规则记录,便于高级组合。
|
|
55
|
+
1. 内置忽略项和 `.gitignore`。
|
|
56
|
+
2. 应用运行环境与 Node.js 工程文件 globals。
|
|
57
|
+
3. Common、JavaScript、Import、RegExp、TypeScript 与 JSON。
|
|
58
|
+
4. `package.json` 和 `tsconfig*.json` 排序。
|
|
59
|
+
5. Vue、UniApp globals 与清单适配。
|
|
60
|
+
6. Prettier 冲突关闭层。
|
|
61
|
+
7. Node.js 工程文件末尾规则覆写。
|
|
62
|
+
8. 调用方后置 Flat Config。
|
|
66
63
|
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
## 质量门禁
|
|
70
|
-
|
|
71
|
-
发布前必须全部通过:
|
|
64
|
+
## 发布前验证
|
|
72
65
|
|
|
73
66
|
```sh
|
|
67
|
+
pnpm typegen
|
|
74
68
|
pnpm check
|
|
75
69
|
pnpm pack --dry-run
|
|
76
70
|
```
|
|
77
71
|
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
1. 生成类型漂移检查。
|
|
81
|
-
2. 正式 ESM 与声明文件构建。
|
|
82
|
-
3. TypeScript 源码类型检查。
|
|
83
|
-
4. ESLint 全仓检查。
|
|
84
|
-
5. Prettier 格式检查。
|
|
85
|
-
6. 消费者类型契约测试。
|
|
86
|
-
7. 运行时配置集成测试。
|
|
87
|
-
8. 发布元数据、入口文件和声明文件契约测试。
|
|
88
|
-
|
|
89
|
-
发布归档必须包含根入口和 `./configs`、`./constants`、`./rules` 子入口的 JavaScript 与声明文件,以及生成的 JavaScript、声明 source map;且不得包含源码缓存、测试缓存或本地依赖目录。
|
|
90
|
-
|
|
91
|
-
## CI 与发布边界
|
|
92
|
-
|
|
93
|
-
GitHub Actions 在 `master`、`main` 推送和 Pull Request 上运行,覆盖 Node.js 22.18 和 24.18。CI 使用 pnpm 11.x、冻结锁文件安装、完整质量门禁和发布归档预览。
|
|
94
|
-
|
|
95
|
-
CI 只验证代码和发布包,不自动发布 npm。正式发布仍由维护者确认版本、Changelog、归档内容和 npm 身份后执行。
|
|
72
|
+
发布归档必须包含根入口和 `./configs`、`./constants`、`./rules` 子入口,不得包含源码缓存或本地依赖目录。CI 只负责验证,不自动发布 npm。
|
|
96
73
|
|
|
97
74
|
## 剩余风险
|
|
98
75
|
|
|
99
|
-
- ESLint
|
|
100
|
-
-
|
|
101
|
-
-
|
|
102
|
-
-
|
|
103
|
-
-
|
|
104
|
-
- npm 发布自动化尚未启用,后续应在可信发布、分支保护和维护者审批策略确定后单独设计。
|
|
76
|
+
- 上游 recommended 会随依赖升级变化,升级 ESLint 或插件后必须检查实际生效配置。
|
|
77
|
+
- 类型感知依赖 tsconfig 覆盖和 Project Service,复杂 monorepo 需要维护清晰的项目边界。
|
|
78
|
+
- Import、类型导入、Vue 属性和清单排序可能被 `eslint --fix` 修改,需要审查副作用顺序和纯排序差异。
|
|
79
|
+
- 根入口默认声明 UniApp 条件编译 globals,不能验证平台分支;普通 Vue 项目如需避免 globals 扩散应改用片段组合。
|
|
80
|
+
- `.uvue` 与 `.uts` 仍不在支持范围。
|
package/docs/rules-risk.md
CHANGED
|
@@ -1,105 +1,108 @@
|
|
|
1
|
-
# Default Rules
|
|
2
|
-
|
|
3
|
-
This document
|
|
4
|
-
|
|
5
|
-
##
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
`
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
|
25
|
-
|
|
|
26
|
-
|
|
|
27
|
-
|
|
|
28
|
-
|
|
|
29
|
-
|
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
`
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
-
|
|
57
|
-
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
-
|
|
62
|
-
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
1
|
+
# Default Rules and Risk Guide
|
|
2
|
+
|
|
3
|
+
This document describes the current 2.1.0 configuration model, major rules, and migration risks. Source comments explain current intent only; historical changes belong in `CHANGELOG.md`.
|
|
4
|
+
|
|
5
|
+
## Configuration model
|
|
6
|
+
|
|
7
|
+
SDKs, OA systems, administration apps, Vue web apps, and UniApp clients share one JavaScript, TypeScript, Import, and RegExp rule set. There are no strictness tiers.
|
|
8
|
+
|
|
9
|
+
The root entry is a fixed Vue 3 + TypeScript + UniApp preset:
|
|
10
|
+
|
|
11
|
+
- `environment: "browser"`
|
|
12
|
+
- `.gitignore`
|
|
13
|
+
- JavaScript and type-aware TypeScript
|
|
14
|
+
- Vue 3, `.nvue`, UniApp globals, and manifest handling
|
|
15
|
+
- Import, RegExp, JSON, JSONC, and JSON5
|
|
16
|
+
- `package.json` and `tsconfig*.json` sorting
|
|
17
|
+
- Prettier conflict handling
|
|
18
|
+
- Node.js tooling globals and trailing rule overrides
|
|
19
|
+
|
|
20
|
+
`fastConfig()` retains only `environment`. React, Angular, Markdown, and Lodash compose from `./configs`; rules, globals, ignores, and special parser settings use trailing Flat Config objects.
|
|
21
|
+
|
|
22
|
+
## Preset sources
|
|
23
|
+
|
|
24
|
+
| Domain | Preset or implementation |
|
|
25
|
+
| ---------- | -------------------------------------------------------------------------- |
|
|
26
|
+
| JavaScript | `@eslint/js` recommended plus local rules |
|
|
27
|
+
| TypeScript | typescript-eslint `recommendedTypeChecked` plus Project Service |
|
|
28
|
+
| Vue | `eslint-plugin-vue` `flat/recommended` plus type-aware TypeScript |
|
|
29
|
+
| React | `@eslint-react` recommended/type-checked plus React Hooks Flat Recommended |
|
|
30
|
+
| Angular | Angular ESLint TypeScript, template, and accessibility recommended presets |
|
|
31
|
+
| JSON | `eslint-plugin-jsonc` recommended presets for three dialects |
|
|
32
|
+
| Import | `eslint-plugin-import-x` recommended plus a fixed ordering policy |
|
|
33
|
+
| RegExp | Explicit correctness, safety, and super-linear backtracking rules |
|
|
34
|
+
| Prettier | `eslint-config-prettier` conflict disabling |
|
|
35
|
+
|
|
36
|
+
## Major rules
|
|
37
|
+
|
|
38
|
+
### JavaScript
|
|
39
|
+
|
|
40
|
+
- `camelcase: ["error", { properties: "never" }]`
|
|
41
|
+
- `no-debugger: "error"`
|
|
42
|
+
- `no-use-before-define` warns; classes and variables must be declared first while function declarations may be hoisted.
|
|
43
|
+
- `prefer-arrow-callback`, `logical-assignment-operators`, and `prefer-object-spread` are errors.
|
|
44
|
+
- `prefer-exponentiation-operator` and `prefer-object-has-own` are errors.
|
|
45
|
+
- `sort-imports` warns and only sorts members within one import.
|
|
46
|
+
- `import-x/order` is an error with `warnOnUnassignedImports: true`.
|
|
47
|
+
|
|
48
|
+
### TypeScript
|
|
49
|
+
|
|
50
|
+
- `recommendedTypeChecked` and `projectService: true` are always enabled.
|
|
51
|
+
- `explicit-module-boundary-types` is an error and does not allow explicitly typed `any` arguments as an escape hatch.
|
|
52
|
+
- `explicit-function-return-type` is not additionally enabled, so internal functions and callbacks can rely on inference.
|
|
53
|
+
- `no-explicit-any` warns.
|
|
54
|
+
- `no-unused-vars` is an error; an `_` prefix marks intentional omissions and rest siblings are ignored.
|
|
55
|
+
- `no-empty-function` only allows empty constructors and override methods.
|
|
56
|
+
- `consistent-type-imports` uses inline `type` fixes.
|
|
57
|
+
- `no-non-null-assertion` is an error.
|
|
58
|
+
|
|
59
|
+
### Vue
|
|
60
|
+
|
|
61
|
+
- Uses `flat/recommended`.
|
|
62
|
+
- `attribute-hyphenation: ["error", "always"]`.
|
|
63
|
+
- `no-v-html` warns.
|
|
64
|
+
- `no-v-text-v-html-on-component` is an error.
|
|
65
|
+
- `require-explicit-emits`, `attributes-order`, and `no-mutating-props` are errors.
|
|
66
|
+
- `.vue` and `.nvue` share the TypeScript parser and Project Service.
|
|
67
|
+
|
|
68
|
+
## Type-aware requirements
|
|
69
|
+
|
|
70
|
+
TypeScript, Vue, and React TSX always require type information. Linted files must belong to a discoverable `tsconfig.json`, or Project Service reports a configuration error.
|
|
71
|
+
|
|
72
|
+
The `typeChecked` and `tsconfigRootDir` wrapper options no longer exist. Complex monorepos can override `languageOptions.parserOptions` in trailing Flat Config, but should not disable type checking to hide project-boundary problems.
|
|
73
|
+
|
|
74
|
+
## UniApp boundary
|
|
75
|
+
|
|
76
|
+
The root entry declares `uni`, `uniCloud`, page APIs, and conditional-platform objects, and permits comments in `pages.json` and `manifest.json`.
|
|
77
|
+
|
|
78
|
+
ESLint does not execute conditional compilation, so `wx`, `plus`, and similar objects are visible in every code file handled by the root entry. This prevents `no-undef` inside platform branches but cannot verify that objects occur under the correct `#ifdef`. Plain Vue projects that do not want these globals should compose focused fragments instead of using the root entry.
|
|
79
|
+
|
|
80
|
+
## Auto-fix risks
|
|
81
|
+
|
|
82
|
+
Review these fixes carefully:
|
|
83
|
+
|
|
84
|
+
- Import groups, member order, and side-effect import placement.
|
|
85
|
+
- Inline TypeScript `type` imports.
|
|
86
|
+
- Vue attribute naming and ordering.
|
|
87
|
+
- `package.json` and `tsconfig*.json` key order.
|
|
88
|
+
|
|
89
|
+
`package.json` sorting does not enter conditional `exports` objects whose order has runtime meaning.
|
|
90
|
+
|
|
91
|
+
Run a check first:
|
|
92
|
+
|
|
93
|
+
```sh
|
|
94
|
+
pnpm exec eslint .
|
|
93
95
|
```
|
|
94
96
|
|
|
95
|
-
|
|
97
|
+
Then apply fixes after reviewing the scope:
|
|
98
|
+
|
|
99
|
+
```sh
|
|
100
|
+
pnpm exec eslint . --fix
|
|
101
|
+
```
|
|
96
102
|
|
|
97
|
-
##
|
|
103
|
+
## Maintenance policy
|
|
98
104
|
|
|
99
|
-
1.
|
|
100
|
-
2.
|
|
101
|
-
3.
|
|
102
|
-
4.
|
|
103
|
-
5. Run `pnpm typegen` after changing ESLint or any bundled plugin; inspect and commit `src/typegen.d.ts` instead of editing it manually.
|
|
104
|
-
6. Add integration coverage for parser, plugin, scope, auto-fix, generated-type, and public-export changes.
|
|
105
|
-
7. Run `pnpm check` and `pnpm pack --dry-run`, then inspect the real fix diff.
|
|
105
|
+
1. Rule comments explain current behavior, risk, and exceptions without referring to historical versions.
|
|
106
|
+
2. After upgrading recommended presets, inspect the final effective rules to prevent silent severity changes.
|
|
107
|
+
3. New frameworks add parsers, file scopes, and framework semantics without creating another language-rule tier.
|
|
108
|
+
4. New public factories, parsers, or auto-fix behavior require type and runtime tests.
|