@fast-china/eslint-config 2.1.9 → 2.1.11
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 +64 -23
- package/CONTRIBUTING.md +1 -1
- package/README.md +44 -118
- package/README.zh.md +44 -118
- package/dist/configs/angular.d.mts +1 -1
- package/dist/configs/angular.mjs.map +1 -1
- package/dist/configs/environment.d.mts +1 -1
- package/dist/configs/environment.mjs.map +1 -1
- package/dist/configs/ignores.d.mts +1 -1
- package/dist/configs/ignores.mjs +2 -1
- package/dist/configs/ignores.mjs.map +1 -1
- package/dist/configs/react.d.mts +1 -1
- package/dist/configs/react.mjs.map +1 -1
- package/dist/configs/typescript.mjs +5 -2
- package/dist/configs/typescript.mjs.map +1 -1
- package/dist/configs/vue.mjs +5 -2
- package/dist/configs/vue.mjs.map +1 -1
- package/dist/constants/index.d.mts +2 -2
- package/dist/constants/index.mjs +3 -2
- package/dist/constants/index.mjs.map +1 -1
- package/dist/index.d.mts +1 -1
- package/dist/index.mjs.map +1 -1
- package/package.json +3 -4
- package/docs/engineering-audit.zh.md +0 -78
- package/docs/rules/angular.zh.md +0 -721
- package/docs/rules/core.zh.md +0 -3031
- package/docs/rules/index.zh.md +0 -38
- package/docs/rules/json.zh.md +0 -784
- package/docs/rules/markdown.zh.md +0 -449
- package/docs/rules/react.zh.md +0 -2091
- package/docs/rules/typescript.zh.md +0 -2052
- package/docs/rules/vue.zh.md +0 -3016
- package/docs/rules-risk.md +0 -113
- package/docs/rules-risk.zh.md +0 -113
package/CHANGELOG.md
CHANGED
|
@@ -1,18 +1,35 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
-
All notable changes to this project
|
|
3
|
+
All notable changes to this project are documented in this file.
|
|
4
4
|
|
|
5
5
|
The format follows [Keep a Changelog](https://keepachangelog.com/en/1.1.0/), and releases should follow [Semantic Versioning](https://semver.org/).
|
|
6
6
|
|
|
7
|
-
##
|
|
7
|
+
## [2.1.11] - 2026-11-06
|
|
8
8
|
|
|
9
|
-
|
|
9
|
+
### Fixed
|
|
10
|
+
|
|
11
|
+
- Allow Promise-returning object-property callbacks typed as `() => void` in TSX and Vue/NVue SFCs via `no-misused-promises.checksVoidReturn.properties: false`; retain the existing JSX attribute exemption and other Promise misuse checks.
|
|
12
|
+
- Clarify that these exemptions do not guarantee that callers handle Promise rejections, and add regression coverage for their file scope.
|
|
13
|
+
|
|
14
|
+
## [2.1.10] - 2026-09-22
|
|
15
|
+
|
|
16
|
+
### Fixed
|
|
17
|
+
|
|
18
|
+
- Exclude root and nested `.agents` directories and `skills-lock.json` from the shared default ignores; keep Prettier ignores independent.
|
|
19
|
+
|
|
20
|
+
### Documentation and Tooling
|
|
21
|
+
|
|
22
|
+
- Correct localized Fast.Docs links and retain minimal README examples.
|
|
23
|
+
- Align public-contract comments and agent guidance; keep licenses and `.editorconfig` unchanged.
|
|
24
|
+
- Keep ESLint and Prettier skill-file ignores separate and add regression checks.
|
|
25
|
+
|
|
26
|
+
## [2.1.9] - 2026-09-14
|
|
10
27
|
|
|
11
28
|
### Changed
|
|
12
29
|
|
|
13
30
|
- Disabled `@typescript-eslint/switch-exhaustiveness-check` for Vue single-file components while retaining the error-level check for regular TypeScript and TSX files.
|
|
14
31
|
|
|
15
|
-
## 2.1.8 - 2026-09-12
|
|
32
|
+
## [2.1.8] - 2026-09-12
|
|
16
33
|
|
|
17
34
|
### Added
|
|
18
35
|
|
|
@@ -37,7 +54,7 @@ The format follows [Keep a Changelog](https://keepachangelog.com/en/1.1.0/), and
|
|
|
37
54
|
- Removed the 2.x default export, `fastConfig()`, and `FastConfigOptions`; consumers now select the Vue or UniApp named configuration explicitly.
|
|
38
55
|
- Removed Vue-to-UniApp capability leakage from the new Vue-only entry and removed `prefer-object-has-own` from the defaults.
|
|
39
56
|
|
|
40
|
-
## 2.1.7 - 2026-09-11
|
|
57
|
+
## [2.1.7] - 2026-09-11
|
|
41
58
|
|
|
42
59
|
### Added
|
|
43
60
|
|
|
@@ -47,7 +64,7 @@ The format follows [Keep a Changelog](https://keepachangelog.com/en/1.1.0/), and
|
|
|
47
64
|
|
|
48
65
|
- Allowed Promise-returning event handlers in Vue templates and TSX attributes while retaining all other `no-misused-promises` checks.
|
|
49
66
|
|
|
50
|
-
## 2.1.6 - 2026-09-11
|
|
67
|
+
## [2.1.6] - 2026-09-11
|
|
51
68
|
|
|
52
69
|
### Added
|
|
53
70
|
|
|
@@ -63,31 +80,31 @@ The format follows [Keep a Changelog](https://keepachangelog.com/en/1.1.0/), and
|
|
|
63
80
|
- Reduced syntax-only enforcement for type declarations, indexed objects, literal class properties, RegExp calls, dynamic object deletion, and static utility classes; deprecated APIs and apparently unnecessary runtime guards now warn instead of blocking builds.
|
|
64
81
|
- Updated runtime and development dependencies to their latest compatible releases while retaining TypeScript 6, tsdown 0.22, and the existing peer compatibility ranges.
|
|
65
82
|
|
|
66
|
-
## 2.1.5 - 2026-09-01
|
|
83
|
+
## [2.1.5] - 2026-09-01
|
|
67
84
|
|
|
68
85
|
### Changed
|
|
69
86
|
|
|
70
87
|
- 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.
|
|
71
88
|
|
|
72
|
-
## 2.1.4 - 2026-08-30
|
|
89
|
+
## [2.1.4] - 2026-08-30
|
|
73
90
|
|
|
74
91
|
### Changed
|
|
75
92
|
|
|
76
93
|
- 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.
|
|
77
94
|
|
|
78
|
-
## 2.1.3 - 2026-08-29
|
|
95
|
+
## [2.1.3] - 2026-08-29
|
|
79
96
|
|
|
80
97
|
### Changed
|
|
81
98
|
|
|
82
99
|
- Enabled `import-x/order` `sortTypesGroup` so separate type imports retain the final type group while sorting by their original source category within it.
|
|
83
100
|
|
|
84
|
-
## 2.1.2 - 2026-08-29
|
|
101
|
+
## [2.1.2] - 2026-08-29
|
|
85
102
|
|
|
86
103
|
### Changed
|
|
87
104
|
|
|
88
105
|
- Changed `@typescript-eslint/consistent-type-imports` fixes from inline type specifiers to separate `import type` declarations.
|
|
89
106
|
|
|
90
|
-
## 2.1.1 - 2026-08-29
|
|
107
|
+
## [2.1.1] - 2026-08-29
|
|
91
108
|
|
|
92
109
|
### Added
|
|
93
110
|
|
|
@@ -98,7 +115,7 @@ The format follows [Keep a Changelog](https://keepachangelog.com/en/1.1.0/), and
|
|
|
98
115
|
- Expanded the inline documentation for local ESLint rules and scoped overrides, including their purpose, important exceptions, and ownership of duplicate React checks.
|
|
99
116
|
- Excluded stylesheet imports from `import-x/order` while preserving its grouping, alphabetizing, and `warnOnUnassignedImports` checks for all other imports.
|
|
100
117
|
|
|
101
|
-
## 2.1.0 - 2026-08-26
|
|
118
|
+
## [2.1.0] - 2026-08-26
|
|
102
119
|
|
|
103
120
|
### Added
|
|
104
121
|
|
|
@@ -125,27 +142,27 @@ The format follows [Keep a Changelog](https://keepachangelog.com/en/1.1.0/), and
|
|
|
125
142
|
|
|
126
143
|
- Removed `defaultConfigOptions`, root language/framework/plugin switches, factory-level rules/globals/ignores, `typeChecked`, and `tsconfigRootDir`. Native trailing Flat Config and focused factories replace these wrapper options.
|
|
127
144
|
|
|
128
|
-
## 2.0.10 - 2026-08-19
|
|
145
|
+
## [2.0.10] - 2026-08-19
|
|
129
146
|
|
|
130
147
|
### Changed
|
|
131
148
|
|
|
132
149
|
- Changed the default export to a ready-to-use Flat Config array that can be exported directly or spread into another configuration; configurable usage remains available through the named `fastConfig()` export.
|
|
133
150
|
- Enabled Markdown, `package.json` sorting, and `tsconfig*.json` sorting by default while keeping React and Angular disabled by default.
|
|
134
151
|
|
|
135
|
-
## 2.0.9 - 2026-08-10
|
|
152
|
+
## [2.0.9] - 2026-08-10
|
|
136
153
|
|
|
137
154
|
### Changed
|
|
138
155
|
|
|
139
156
|
- Allowed type-aware TypeScript configurations to forward `unknown` Promise rejection reasons without disabling `prefer-promise-reject-errors` for statically known non-`Error` values.
|
|
140
157
|
|
|
141
|
-
## 2.0.8 - 2026-08-09
|
|
158
|
+
## [2.0.8] - 2026-08-09
|
|
142
159
|
|
|
143
160
|
### Changed
|
|
144
161
|
|
|
145
162
|
- Added prioritized import path groups for the uni-app, Vue, Element Plus, Fast Element Plus, Fast China, and Lodash ecosystems while keeping type-only imports in the dedicated type group.
|
|
146
163
|
- Changed import group spacing to a compact no-blank-line style and normalized the repository imports to the new policy.
|
|
147
164
|
|
|
148
|
-
## 2.0.7 - 2026-08-08
|
|
165
|
+
## [2.0.7] - 2026-08-08
|
|
149
166
|
|
|
150
167
|
### Changed
|
|
151
168
|
|
|
@@ -153,7 +170,7 @@ The format follows [Keep a Changelog](https://keepachangelog.com/en/1.1.0/), and
|
|
|
153
170
|
- Removed `src` and declaration maps that referenced unpublished source files while retaining self-contained runtime source maps.
|
|
154
171
|
- Added package-contract coverage for the publish allowlist and source-map integrity.
|
|
155
172
|
|
|
156
|
-
## 2.0.6 - 2026-08-04
|
|
173
|
+
## [2.0.6] - 2026-08-04
|
|
157
174
|
|
|
158
175
|
### Changed
|
|
159
176
|
|
|
@@ -161,14 +178,14 @@ The format follows [Keep a Changelog](https://keepachangelog.com/en/1.1.0/), and
|
|
|
161
178
|
- Simplified the test pipeline to runtime, type-contract, and package-contract verification by removing documentation- and comment-governance tests.
|
|
162
179
|
- Included contribution and security documents in the published package and refreshed the engineering guidance for the current workflow.
|
|
163
180
|
|
|
164
|
-
## 2.0.5 - 2026-08-02
|
|
181
|
+
## [2.0.5] - 2026-08-02
|
|
165
182
|
|
|
166
183
|
### Changed
|
|
167
184
|
|
|
168
185
|
- Upgraded public API documentation to complete TSDoc, including standard defaults, parameters, return values, thrown errors, remarks, examples, and package-level documentation.
|
|
169
186
|
- Separated runtime, type-contract, rule-governance, and package-contract tests, and replaced the hard-coded release version assertion with SemVer and changelog consistency checks.
|
|
170
187
|
|
|
171
|
-
## 2.0.4 - 2026-08-02
|
|
188
|
+
## [2.0.4] - 2026-08-02
|
|
172
189
|
|
|
173
190
|
### Added
|
|
174
191
|
|
|
@@ -184,21 +201,21 @@ The format follows [Keep a Changelog](https://keepachangelog.com/en/1.1.0/), and
|
|
|
184
201
|
- Changed `createGlobalIgnores()` to return a config array like the other fragment factories, so direct composition consistently uses spread syntax.
|
|
185
202
|
- Updated `@eslint-react/eslint-plugin`, `@eslint/config-inspector`, and `globals` within their existing compatible version ranges.
|
|
186
203
|
|
|
187
|
-
## 2.0.3 - 2026-07-29
|
|
204
|
+
## [2.0.3] - 2026-07-29
|
|
188
205
|
|
|
189
206
|
### Changed
|
|
190
207
|
|
|
191
208
|
- Renamed the internal factory directory from `src/code` to the clearer `src/core` and updated all source and type-generation imports.
|
|
192
209
|
- Expanded JSDoc for public and internal configuration interfaces, covering defaults, activation conditions, file scopes, option interactions, performance tradeoffs, and behavior intentionally left to project tooling.
|
|
193
210
|
|
|
194
|
-
## 2.0.2 - 2026-07-29
|
|
211
|
+
## [2.0.2] - 2026-07-29
|
|
195
212
|
|
|
196
213
|
### Changed
|
|
197
214
|
|
|
198
215
|
- Moved the `fastConfig()` factory implementation to `src/code/index.ts` so the source layout groups the primary code entry consistently.
|
|
199
216
|
- Inlined `defineRules()` into the root entry and kept `@fast-china/eslint-config/rules` focused on the documented raw rule records and generated `RuleOptions` type.
|
|
200
217
|
|
|
201
|
-
## 2.0.1 - 2026-07-26
|
|
218
|
+
## [2.0.1] - 2026-07-26
|
|
202
219
|
|
|
203
220
|
### Added
|
|
204
221
|
|
|
@@ -212,7 +229,7 @@ The format follows [Keep a Changelog](https://keepachangelog.com/en/1.1.0/), and
|
|
|
212
229
|
- Raised the verified runtime baselines to Node.js 22.18.0 and 24.11.0 to match the current tsdown toolchain.
|
|
213
230
|
- Updated the development baseline to ESLint 10.8.0, then upgraded `actions/checkout` plus `actions/setup-node` to their current v7 major releases.
|
|
214
231
|
|
|
215
|
-
## 2.0.0 - 2026-07-26
|
|
232
|
+
## [2.0.0] - 2026-07-26
|
|
216
233
|
|
|
217
234
|
### Added
|
|
218
235
|
|
|
@@ -230,3 +247,27 @@ The format follows [Keep a Changelog](https://keepachangelog.com/en/1.1.0/), and
|
|
|
230
247
|
|
|
231
248
|
- Raised the minimum supported Node.js version to 22.13.0 so the package, local development workflow, and pnpm 11 CI use one consistent runtime baseline.
|
|
232
249
|
- Upgraded `pnpm/action-setup` to v6 so GitHub Actions uses its Node.js 24 runtime without Node.js 20 deprecation warnings.
|
|
250
|
+
|
|
251
|
+
[2.1.11]: https://gitee.com/FastDotnet/fast.eslint.config/compare/v2.1.10...v2.1.11
|
|
252
|
+
[2.1.10]: https://gitee.com/FastDotnet/fast.eslint.config/compare/v2.1.9...v2.1.10
|
|
253
|
+
[2.1.9]: https://gitee.com/FastDotnet/fast.eslint.config/compare/v2.1.8...v2.1.9
|
|
254
|
+
[2.1.8]: https://gitee.com/FastDotnet/fast.eslint.config/compare/v2.1.7...v2.1.8
|
|
255
|
+
[2.1.7]: https://gitee.com/FastDotnet/fast.eslint.config/compare/v2.1.6...v2.1.7
|
|
256
|
+
[2.1.6]: https://gitee.com/FastDotnet/fast.eslint.config/compare/v2.1.5...v2.1.6
|
|
257
|
+
[2.1.5]: https://gitee.com/FastDotnet/fast.eslint.config/compare/v2.1.4...v2.1.5
|
|
258
|
+
[2.1.4]: https://gitee.com/FastDotnet/fast.eslint.config/compare/v2.1.3...v2.1.4
|
|
259
|
+
[2.1.3]: https://gitee.com/FastDotnet/fast.eslint.config/compare/v2.1.2...v2.1.3
|
|
260
|
+
[2.1.2]: https://gitee.com/FastDotnet/fast.eslint.config/compare/v2.1.1...v2.1.2
|
|
261
|
+
[2.1.1]: https://gitee.com/FastDotnet/fast.eslint.config/compare/v2.1.0...v2.1.1
|
|
262
|
+
[2.1.0]: https://gitee.com/FastDotnet/fast.eslint.config/compare/v2.0.10...v2.1.0
|
|
263
|
+
[2.0.10]: https://gitee.com/FastDotnet/fast.eslint.config/compare/v2.0.9...v2.0.10
|
|
264
|
+
[2.0.9]: https://gitee.com/FastDotnet/fast.eslint.config/compare/v2.0.8...v2.0.9
|
|
265
|
+
[2.0.8]: https://gitee.com/FastDotnet/fast.eslint.config/compare/v2.0.7...v2.0.8
|
|
266
|
+
[2.0.7]: https://gitee.com/FastDotnet/fast.eslint.config/compare/v2.0.6...v2.0.7
|
|
267
|
+
[2.0.6]: https://gitee.com/FastDotnet/fast.eslint.config/compare/v2.0.5...v2.0.6
|
|
268
|
+
[2.0.5]: https://gitee.com/FastDotnet/fast.eslint.config/compare/v2.0.4...v2.0.5
|
|
269
|
+
[2.0.4]: https://gitee.com/FastDotnet/fast.eslint.config/compare/v2.0.3...v2.0.4
|
|
270
|
+
[2.0.3]: https://gitee.com/FastDotnet/fast.eslint.config/compare/v2.0.2...v2.0.3
|
|
271
|
+
[2.0.2]: https://gitee.com/FastDotnet/fast.eslint.config/compare/v2.0.1...v2.0.2
|
|
272
|
+
[2.0.1]: https://gitee.com/FastDotnet/fast.eslint.config/compare/v2.0.0...v2.0.1
|
|
273
|
+
[2.0.0]: https://gitee.com/FastDotnet/fast.eslint.config/releases/tag/v2.0.0
|
package/CONTRIBUTING.md
CHANGED
|
@@ -30,7 +30,7 @@ Use `pnpm lint:fix` and `pnpm format` for safe mechanical fixes. `pnpm test` fir
|
|
|
30
30
|
5. Preserve the documented JavaScript, TypeScript, and Vue behavior unless a release explicitly changes it; keep historical comparisons in the changelog rather than source comments.
|
|
31
31
|
6. Keep organization-specific dependency restrictions out of this general-purpose package; projects should own those policies.
|
|
32
32
|
7. Explain the purpose, rationale, and important exception or risk immediately above every local rule override.
|
|
33
|
-
8. Document every default rule's severity and valid exceptions; every generated rule entry must have explicitly reviewed incorrect and correct code rather than placeholder comments. Keep repository overrides before third-party preset rules, verify `meta.fixable` before claiming auto-fix support, run `pnpm run docs:rules` after any rule or dependency change, and keep
|
|
33
|
+
8. Document every default rule's severity and valid exceptions; every generated rule entry must have explicitly reviewed incorrect and correct code rather than placeholder comments. Keep repository overrides before third-party preset rules, verify `meta.fixable` before claiming auto-fix support, run `pnpm run docs:rules` after any rule or dependency change, and keep [rules-risk.en](https://docs.fastdotnet.cn/en-US/frontend/eslint-config/rules-risk) plus [rules-risk](https://docs.fastdotnet.cn/zh-CN/frontend/eslint-config/rules-risk) synchronized.
|
|
34
34
|
9. Never sort a map whose key order has semantics, including conditional objects under `package.json#exports`.
|
|
35
35
|
10. Regenerate `src/typegen.d.ts` whenever ESLint or a bundled plugin changes; confirm new rules and changed option schemas intentionally.
|
|
36
36
|
11. Add or update an integration test for every parser, plugin, option, auto-fix, generated type, or public export change. The root API is intentionally limited to the Vue, UniApp, and framework-neutral project factories, their ready configurations, `defineRules`, and related types.
|
package/README.md
CHANGED
|
@@ -1,16 +1,20 @@
|
|
|
1
|
-
|
|
2
|
-
<a href="./README.zh.md">简体中文</a> | <strong>English</strong>
|
|
3
|
-
</p>
|
|
1
|
+
[简体中文](./README.zh.md) | **English**
|
|
4
2
|
|
|
5
3
|
<p align="center">
|
|
6
|
-
<img src="./Fast.png"
|
|
4
|
+
<img src="./Fast.png" width="128" alt="Fast.ESLint.Config Logo" />
|
|
7
5
|
</p>
|
|
8
6
|
|
|
9
|
-
|
|
7
|
+
<h1 align="center">Fast.ESLint.Config</h1>
|
|
8
|
+
|
|
9
|
+
<p align="center">
|
|
10
|
+
<a href="https://www.npmjs.com/package/@fast-china/eslint-config"><img src="https://img.shields.io/npm/v/@fast-china/eslint-config?logo=npm" alt="npm version" /></a>
|
|
11
|
+
<a href="https://www.npmjs.com/package/@fast-china/eslint-config"><img src="https://img.shields.io/npm/dm/@fast-china/eslint-config" alt="npm downloads" /></a>
|
|
12
|
+
<a href="./LICENSE"><img src="https://img.shields.io/npm/l/@fast-china/eslint-config" alt="License" /></a>
|
|
13
|
+
</p>
|
|
10
14
|
|
|
11
|
-
|
|
15
|
+
Typed ESLint Flat Config for Vue 3, uni-app, TypeScript and Node.js, with optional framework integrations.
|
|
12
16
|
|
|
13
|
-
|
|
17
|
+
**[Documentation](https://docs.fastdotnet.cn/en-US/frontend/eslint-config/) · [Official website](https://fastdotnet.com)**
|
|
14
18
|
|
|
15
19
|
## Highlights
|
|
16
20
|
|
|
@@ -28,11 +32,15 @@ The policy starts from common ecosystem conventions and concise, readable code.
|
|
|
28
32
|
- ESLint `^10.0.0`
|
|
29
33
|
- TypeScript `^6.0.0`
|
|
30
34
|
|
|
35
|
+
## Installation
|
|
36
|
+
|
|
31
37
|
```sh
|
|
32
38
|
pnpm add -D eslint typescript @fast-china/eslint-config
|
|
33
39
|
```
|
|
34
40
|
|
|
35
|
-
##
|
|
41
|
+
## Quick start
|
|
42
|
+
|
|
43
|
+
Create `eslint.config.mjs` in the Vue 3 project:
|
|
36
44
|
|
|
37
45
|
```js
|
|
38
46
|
import { vueConfig } from "@fast-china/eslint-config";
|
|
@@ -42,139 +50,43 @@ export default defineConfig([
|
|
|
42
50
|
...vueConfig,
|
|
43
51
|
{
|
|
44
52
|
name: "project/custom",
|
|
45
|
-
rules: {
|
|
46
|
-
"no-console": "warn",
|
|
47
|
-
},
|
|
53
|
+
rules: {},
|
|
48
54
|
},
|
|
49
55
|
]);
|
|
50
56
|
```
|
|
51
57
|
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
## UniApp
|
|
55
|
-
|
|
56
|
-
```js
|
|
57
|
-
import { uniAppConfig } from "@fast-china/eslint-config";
|
|
58
|
-
import { defineConfig } from "eslint/config";
|
|
59
|
-
|
|
60
|
-
export default defineConfig([
|
|
61
|
-
...uniAppConfig,
|
|
62
|
-
{
|
|
63
|
-
name: "project/custom",
|
|
64
|
-
ignores: ["src/generated/**"],
|
|
65
|
-
rules: {
|
|
66
|
-
"no-console": "warn",
|
|
67
|
-
},
|
|
68
|
-
},
|
|
69
|
-
]);
|
|
70
|
-
```
|
|
71
|
-
|
|
72
|
-
The UniApp entry adds `.nvue`, `uni`, `uniCloud`, page APIs, conditional-platform globals, the `unpackage` ignore, and comment handling for `pages.json` and `manifest.json`.
|
|
73
|
-
|
|
74
|
-
ESLint does not execute `#ifdef` or `#endif`, so it can recognize platform objects but cannot prove that they occur in the correct branch. `.uvue` and `.uts` remain unsupported because they require dedicated parsers.
|
|
75
|
-
|
|
76
|
-
## Factories and project overrides
|
|
77
|
-
|
|
78
|
-
The root entry provides explicit named configurations and factories. Use a factory when the project needs to select its runtime environment or append overrides:
|
|
79
|
-
|
|
80
|
-
```js
|
|
81
|
-
import { createVueProjectConfigs, defineRules } from "@fast-china/eslint-config";
|
|
82
|
-
import { defineConfig } from "eslint/config";
|
|
83
|
-
|
|
84
|
-
export default defineConfig([
|
|
85
|
-
...createVueProjectConfigs({ environment: "universal" }),
|
|
86
|
-
{
|
|
87
|
-
name: "project/custom",
|
|
88
|
-
ignores: ["public/vendor/**"],
|
|
89
|
-
languageOptions: {
|
|
90
|
-
globals: {
|
|
91
|
-
__APP_VERSION__: "readonly",
|
|
92
|
-
},
|
|
93
|
-
},
|
|
94
|
-
rules: defineRules({
|
|
95
|
-
"no-console": "warn",
|
|
96
|
-
}),
|
|
97
|
-
},
|
|
98
|
-
]);
|
|
58
|
+
```sh
|
|
59
|
+
pnpm exec eslint .
|
|
99
60
|
```
|
|
100
61
|
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
- `createVueProjectConfigs(options, ...overrides)`
|
|
104
|
-
- `createUniAppProjectConfigs(options, ...overrides)`
|
|
105
|
-
- `createBaseConfigs(options)` for framework-neutral Node.js, SDK, and explicit composition
|
|
106
|
-
|
|
107
|
-
`environment` accepts `"browser"`, `"node"`, or `"universal"` and defaults to `"browser"`. Configuration, script, test, and CLI files always receive Node.js globals separately.
|
|
108
|
-
|
|
109
|
-
Trailing Flat Config objects have the highest precedence. `defineRules()` returns its input unchanged and only adds precise rule typing.
|
|
110
|
-
|
|
111
|
-
## TypeScript policy
|
|
62
|
+
Type-aware source files must belong to the project tsconfig. The Vue configuration does not include uni-app capabilities.
|
|
112
63
|
|
|
113
|
-
|
|
64
|
+
## Common usage
|
|
114
65
|
|
|
115
|
-
|
|
116
|
-
- `.tsx` disables the module-boundary annotation requirement by default: component props remain type checked without forcing an otherwise inferable JSX return annotation.
|
|
117
|
-
- `explicit-function-return-type: "off"` leaves internal functions, local handlers, and inline callbacks to TypeScript inference.
|
|
118
|
-
- `no-inferrable-types` preserves explicit parameter and property types.
|
|
119
|
-
- Vue/NVue SFCs and standalone TSX components do not require module-boundary or function-return annotations, retaining common concise component forms.
|
|
120
|
-
- `no-floating-promises` is disabled because Promise waiting depends on business ordering and error semantics.
|
|
121
|
-
- `no-void: "error"` rejects `void promise` and other `void` expressions as lint workarounds.
|
|
122
|
-
- `require-await: "error"` requires removing `async` when there is no real `await`, avoiding changed return and exception semantics.
|
|
123
|
-
- `no-misused-promises`, `await-thenable`, unsafe-type rules, and selected high-confidence type rules remain errors.
|
|
124
|
-
- Standard non-null assertions are permitted; contradictory, redundant, or invalid assertions remain checked by focused rules.
|
|
125
|
-
- Numbers and booleans may be interpolated directly in template strings, and runtime guards are not rejected merely because types make them look unnecessary.
|
|
126
|
-
|
|
127
|
-
## JavaScript, Import, and Vue policy
|
|
128
|
-
|
|
129
|
-
- `no-empty` permits a completely empty `catch` while reporting other empty blocks.
|
|
130
|
-
- `camelcase: ["error", { properties: "never" }]` applies to variables and types while preserving external protocol property names.
|
|
131
|
-
- Real-risk rules such as `no-eval`, `no-implied-eval`, `no-new-func`, and `no-debugger` remain errors.
|
|
132
|
-
- `import-x/first`, `import-x/no-duplicates`, and `import-x/order` are errors; declaration ordering supports automatic fixes.
|
|
133
|
-
- Common path groups cover UniApp, Vue, React, Angular, Vite, Element Plus, Fast, and Lodash. `@/**` is internal, and type imports do not participate in path-group matching.
|
|
134
|
-
- `sort-imports` checks only member order inside one import declaration and does not order declarations.
|
|
135
|
-
- `import-x/style-imports-last` keeps stylesheets in the final contiguous group without reordering that group internally.
|
|
136
|
-
- Vue SFCs use the official `flat/recommended`; script-semantic checks for explicit emits, duplicate keys, readonly props, reactivity loss, and reserved component names also apply to Vue JSX/TSX.
|
|
137
|
-
- Kebab-case attributes, template attribute ordering, and component `v-text`/`v-html` remain limited to `.vue/.nvue` templates; JSX attributes retain JavaScript camelCase conventions. `no-v-html` remains a warning.
|
|
138
|
-
|
|
139
|
-
## React and Angular
|
|
66
|
+
Use the independent uni-app entry rather than stacking both complete configurations:
|
|
140
67
|
|
|
141
68
|
```js
|
|
142
|
-
import {
|
|
143
|
-
import { createReactConfigs } from "@fast-china/eslint-config/configs";
|
|
69
|
+
import { uniAppConfig } from "@fast-china/eslint-config";
|
|
144
70
|
import { defineConfig } from "eslint/config";
|
|
145
71
|
|
|
146
72
|
export default defineConfig([
|
|
147
|
-
...
|
|
148
|
-
...createReactConfigs(),
|
|
73
|
+
...uniAppConfig,
|
|
149
74
|
{
|
|
150
75
|
name: "project/custom",
|
|
151
|
-
rules: {
|
|
76
|
+
rules: {},
|
|
152
77
|
},
|
|
153
78
|
]);
|
|
154
79
|
```
|
|
155
80
|
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
## Optional capabilities and manifest sorting
|
|
159
|
-
|
|
160
|
-
Markdown and Lodash import policy require explicit composition:
|
|
81
|
+
For framework-independent Node.js projects:
|
|
161
82
|
|
|
162
83
|
```js
|
|
163
84
|
import { createBaseConfigs } from "@fast-china/eslint-config";
|
|
164
|
-
import { createMarkdownConfigs } from "@fast-china/eslint-config/configs";
|
|
165
|
-
import { defineConfig } from "eslint/config";
|
|
166
85
|
|
|
167
|
-
export default
|
|
168
|
-
...createBaseConfigs({ environment: "node" }),
|
|
169
|
-
...createMarkdownConfigs(),
|
|
170
|
-
{
|
|
171
|
-
name: "project/custom",
|
|
172
|
-
rules: { "no-console": "warn" },
|
|
173
|
-
},
|
|
174
|
-
]);
|
|
86
|
+
export default createBaseConfigs({ environment: "node" });
|
|
175
87
|
```
|
|
176
88
|
|
|
177
|
-
|
|
89
|
+
Append project configuration after the shared preset; leave `rules: {}` empty until project-specific rules are needed. Use the configuration factories to customize the runtime environment. Fast repositories maintaining local rule copies continue following their own AGENTS.md synchronization policy.
|
|
178
90
|
|
|
179
91
|
## Public entries
|
|
180
92
|
|
|
@@ -189,8 +101,8 @@ Prettier does not run as an ESLint rule. The defaults only load `eslint-config-p
|
|
|
189
101
|
|
|
190
102
|
## Documentation
|
|
191
103
|
|
|
192
|
-
- [Complete rule reference (Chinese)](
|
|
193
|
-
- [Default rules and risk guide](
|
|
104
|
+
- [Complete rule reference (Chinese)](https://docs.fastdotnet.cn/en-US/frontend/eslint-config/rules/)
|
|
105
|
+
- [Default rules and risk guide](https://docs.fastdotnet.cn/en-US/frontend/eslint-config/rules-risk)
|
|
194
106
|
- [Chinese engineering audit](./docs/engineering-audit.zh.md)
|
|
195
107
|
- [Changelog](./CHANGELOG.md)
|
|
196
108
|
|
|
@@ -203,3 +115,17 @@ pnpm install --frozen-lockfile
|
|
|
203
115
|
pnpm typegen
|
|
204
116
|
pnpm check
|
|
205
117
|
```
|
|
118
|
+
|
|
119
|
+
## Contribution and security
|
|
120
|
+
|
|
121
|
+
[Contributing](./CONTRIBUTING.md) · [Security policy](./SECURITY.md)
|
|
122
|
+
|
|
123
|
+
## Copyright, license and use
|
|
124
|
+
|
|
125
|
+
Copyright © 2018-Now 小方. This project uses [Apache License 2.0](./LICENSE). Use, modification, distribution and commercial use are permitted subject to its terms.
|
|
126
|
+
|
|
127
|
+
When redistributing, provide the license, mark modified files and preserve applicable copyright, attribution and supplied NOTICE information as required. This summary does not replace the license or impose additional UI attribution.
|
|
128
|
+
|
|
129
|
+
Users are responsible for the legal compliance and authorization of their own modifications, deployment, data processing and operations. This reminder is not an additional license condition.
|
|
130
|
+
|
|
131
|
+
Except as required by applicable law or agreed in writing, the software is provided on an "AS IS" basis. Sections 7 and 8 govern warranty disclaimers and liability limits. Providing the project does not endorse downstream activities or assume users' contractual commitments. This statement does not exclude liability that cannot lawfully be excluded.
|