@fast-china/eslint-config 2.1.9 → 2.1.10
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 +56 -23
- package/CONTRIBUTING.md +1 -1
- package/README.md +44 -118
- package/README.zh.md +44 -118
- 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/constants/index.d.mts +2 -2
- package/dist/constants/index.mjs +3 -2
- package/dist/constants/index.mjs.map +1 -1
- package/package.json +4 -5
- 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,28 @@
|
|
|
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.10] - 2026-09-22
|
|
8
8
|
|
|
9
|
-
|
|
9
|
+
### Fixed
|
|
10
|
+
|
|
11
|
+
- Exclude root and nested `.agents` directories and `skills-lock.json` from the shared default ignores; keep Prettier ignores independent.
|
|
12
|
+
|
|
13
|
+
### Documentation and Tooling
|
|
14
|
+
|
|
15
|
+
- Correct localized Fast.Docs links and retain minimal README examples.
|
|
16
|
+
- Align public-contract comments and agent guidance; keep licenses and `.editorconfig` unchanged.
|
|
17
|
+
- Keep ESLint and Prettier skill-file ignores separate and add regression checks.
|
|
18
|
+
|
|
19
|
+
## [2.1.9] - 2026-09-14
|
|
10
20
|
|
|
11
21
|
### Changed
|
|
12
22
|
|
|
13
23
|
- Disabled `@typescript-eslint/switch-exhaustiveness-check` for Vue single-file components while retaining the error-level check for regular TypeScript and TSX files.
|
|
14
24
|
|
|
15
|
-
## 2.1.8 - 2026-09-12
|
|
25
|
+
## [2.1.8] - 2026-09-12
|
|
16
26
|
|
|
17
27
|
### Added
|
|
18
28
|
|
|
@@ -37,7 +47,7 @@ The format follows [Keep a Changelog](https://keepachangelog.com/en/1.1.0/), and
|
|
|
37
47
|
- Removed the 2.x default export, `fastConfig()`, and `FastConfigOptions`; consumers now select the Vue or UniApp named configuration explicitly.
|
|
38
48
|
- Removed Vue-to-UniApp capability leakage from the new Vue-only entry and removed `prefer-object-has-own` from the defaults.
|
|
39
49
|
|
|
40
|
-
## 2.1.7 - 2026-09-11
|
|
50
|
+
## [2.1.7] - 2026-09-11
|
|
41
51
|
|
|
42
52
|
### Added
|
|
43
53
|
|
|
@@ -47,7 +57,7 @@ The format follows [Keep a Changelog](https://keepachangelog.com/en/1.1.0/), and
|
|
|
47
57
|
|
|
48
58
|
- Allowed Promise-returning event handlers in Vue templates and TSX attributes while retaining all other `no-misused-promises` checks.
|
|
49
59
|
|
|
50
|
-
## 2.1.6 - 2026-09-11
|
|
60
|
+
## [2.1.6] - 2026-09-11
|
|
51
61
|
|
|
52
62
|
### Added
|
|
53
63
|
|
|
@@ -63,31 +73,31 @@ The format follows [Keep a Changelog](https://keepachangelog.com/en/1.1.0/), and
|
|
|
63
73
|
- 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
74
|
- Updated runtime and development dependencies to their latest compatible releases while retaining TypeScript 6, tsdown 0.22, and the existing peer compatibility ranges.
|
|
65
75
|
|
|
66
|
-
## 2.1.5 - 2026-09-01
|
|
76
|
+
## [2.1.5] - 2026-09-01
|
|
67
77
|
|
|
68
78
|
### Changed
|
|
69
79
|
|
|
70
80
|
- 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
81
|
|
|
72
|
-
## 2.1.4 - 2026-08-30
|
|
82
|
+
## [2.1.4] - 2026-08-30
|
|
73
83
|
|
|
74
84
|
### Changed
|
|
75
85
|
|
|
76
86
|
- 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
87
|
|
|
78
|
-
## 2.1.3 - 2026-08-29
|
|
88
|
+
## [2.1.3] - 2026-08-29
|
|
79
89
|
|
|
80
90
|
### Changed
|
|
81
91
|
|
|
82
92
|
- Enabled `import-x/order` `sortTypesGroup` so separate type imports retain the final type group while sorting by their original source category within it.
|
|
83
93
|
|
|
84
|
-
## 2.1.2 - 2026-08-29
|
|
94
|
+
## [2.1.2] - 2026-08-29
|
|
85
95
|
|
|
86
96
|
### Changed
|
|
87
97
|
|
|
88
98
|
- Changed `@typescript-eslint/consistent-type-imports` fixes from inline type specifiers to separate `import type` declarations.
|
|
89
99
|
|
|
90
|
-
## 2.1.1 - 2026-08-29
|
|
100
|
+
## [2.1.1] - 2026-08-29
|
|
91
101
|
|
|
92
102
|
### Added
|
|
93
103
|
|
|
@@ -98,7 +108,7 @@ The format follows [Keep a Changelog](https://keepachangelog.com/en/1.1.0/), and
|
|
|
98
108
|
- Expanded the inline documentation for local ESLint rules and scoped overrides, including their purpose, important exceptions, and ownership of duplicate React checks.
|
|
99
109
|
- Excluded stylesheet imports from `import-x/order` while preserving its grouping, alphabetizing, and `warnOnUnassignedImports` checks for all other imports.
|
|
100
110
|
|
|
101
|
-
## 2.1.0 - 2026-08-26
|
|
111
|
+
## [2.1.0] - 2026-08-26
|
|
102
112
|
|
|
103
113
|
### Added
|
|
104
114
|
|
|
@@ -125,27 +135,27 @@ The format follows [Keep a Changelog](https://keepachangelog.com/en/1.1.0/), and
|
|
|
125
135
|
|
|
126
136
|
- 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
137
|
|
|
128
|
-
## 2.0.10 - 2026-08-19
|
|
138
|
+
## [2.0.10] - 2026-08-19
|
|
129
139
|
|
|
130
140
|
### Changed
|
|
131
141
|
|
|
132
142
|
- 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
143
|
- Enabled Markdown, `package.json` sorting, and `tsconfig*.json` sorting by default while keeping React and Angular disabled by default.
|
|
134
144
|
|
|
135
|
-
## 2.0.9 - 2026-08-10
|
|
145
|
+
## [2.0.9] - 2026-08-10
|
|
136
146
|
|
|
137
147
|
### Changed
|
|
138
148
|
|
|
139
149
|
- Allowed type-aware TypeScript configurations to forward `unknown` Promise rejection reasons without disabling `prefer-promise-reject-errors` for statically known non-`Error` values.
|
|
140
150
|
|
|
141
|
-
## 2.0.8 - 2026-08-09
|
|
151
|
+
## [2.0.8] - 2026-08-09
|
|
142
152
|
|
|
143
153
|
### Changed
|
|
144
154
|
|
|
145
155
|
- 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
156
|
- Changed import group spacing to a compact no-blank-line style and normalized the repository imports to the new policy.
|
|
147
157
|
|
|
148
|
-
## 2.0.7 - 2026-08-08
|
|
158
|
+
## [2.0.7] - 2026-08-08
|
|
149
159
|
|
|
150
160
|
### Changed
|
|
151
161
|
|
|
@@ -153,7 +163,7 @@ The format follows [Keep a Changelog](https://keepachangelog.com/en/1.1.0/), and
|
|
|
153
163
|
- Removed `src` and declaration maps that referenced unpublished source files while retaining self-contained runtime source maps.
|
|
154
164
|
- Added package-contract coverage for the publish allowlist and source-map integrity.
|
|
155
165
|
|
|
156
|
-
## 2.0.6 - 2026-08-04
|
|
166
|
+
## [2.0.6] - 2026-08-04
|
|
157
167
|
|
|
158
168
|
### Changed
|
|
159
169
|
|
|
@@ -161,14 +171,14 @@ The format follows [Keep a Changelog](https://keepachangelog.com/en/1.1.0/), and
|
|
|
161
171
|
- Simplified the test pipeline to runtime, type-contract, and package-contract verification by removing documentation- and comment-governance tests.
|
|
162
172
|
- Included contribution and security documents in the published package and refreshed the engineering guidance for the current workflow.
|
|
163
173
|
|
|
164
|
-
## 2.0.5 - 2026-08-02
|
|
174
|
+
## [2.0.5] - 2026-08-02
|
|
165
175
|
|
|
166
176
|
### Changed
|
|
167
177
|
|
|
168
178
|
- Upgraded public API documentation to complete TSDoc, including standard defaults, parameters, return values, thrown errors, remarks, examples, and package-level documentation.
|
|
169
179
|
- 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
180
|
|
|
171
|
-
## 2.0.4 - 2026-08-02
|
|
181
|
+
## [2.0.4] - 2026-08-02
|
|
172
182
|
|
|
173
183
|
### Added
|
|
174
184
|
|
|
@@ -184,21 +194,21 @@ The format follows [Keep a Changelog](https://keepachangelog.com/en/1.1.0/), and
|
|
|
184
194
|
- Changed `createGlobalIgnores()` to return a config array like the other fragment factories, so direct composition consistently uses spread syntax.
|
|
185
195
|
- Updated `@eslint-react/eslint-plugin`, `@eslint/config-inspector`, and `globals` within their existing compatible version ranges.
|
|
186
196
|
|
|
187
|
-
## 2.0.3 - 2026-07-29
|
|
197
|
+
## [2.0.3] - 2026-07-29
|
|
188
198
|
|
|
189
199
|
### Changed
|
|
190
200
|
|
|
191
201
|
- Renamed the internal factory directory from `src/code` to the clearer `src/core` and updated all source and type-generation imports.
|
|
192
202
|
- 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
203
|
|
|
194
|
-
## 2.0.2 - 2026-07-29
|
|
204
|
+
## [2.0.2] - 2026-07-29
|
|
195
205
|
|
|
196
206
|
### Changed
|
|
197
207
|
|
|
198
208
|
- Moved the `fastConfig()` factory implementation to `src/code/index.ts` so the source layout groups the primary code entry consistently.
|
|
199
209
|
- 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
210
|
|
|
201
|
-
## 2.0.1 - 2026-07-26
|
|
211
|
+
## [2.0.1] - 2026-07-26
|
|
202
212
|
|
|
203
213
|
### Added
|
|
204
214
|
|
|
@@ -212,7 +222,7 @@ The format follows [Keep a Changelog](https://keepachangelog.com/en/1.1.0/), and
|
|
|
212
222
|
- Raised the verified runtime baselines to Node.js 22.18.0 and 24.11.0 to match the current tsdown toolchain.
|
|
213
223
|
- Updated the development baseline to ESLint 10.8.0, then upgraded `actions/checkout` plus `actions/setup-node` to their current v7 major releases.
|
|
214
224
|
|
|
215
|
-
## 2.0.0 - 2026-07-26
|
|
225
|
+
## [2.0.0] - 2026-07-26
|
|
216
226
|
|
|
217
227
|
### Added
|
|
218
228
|
|
|
@@ -230,3 +240,26 @@ The format follows [Keep a Changelog](https://keepachangelog.com/en/1.1.0/), and
|
|
|
230
240
|
|
|
231
241
|
- 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
242
|
- Upgraded `pnpm/action-setup` to v6 so GitHub Actions uses its Node.js 24 runtime without Node.js 20 deprecation warnings.
|
|
243
|
+
|
|
244
|
+
[2.1.10]: https://gitee.com/FastDotnet/fast.eslint.config/compare/v2.1.9...v2.1.10
|
|
245
|
+
[2.1.9]: https://gitee.com/FastDotnet/fast.eslint.config/compare/v2.1.8...v2.1.9
|
|
246
|
+
[2.1.8]: https://gitee.com/FastDotnet/fast.eslint.config/compare/v2.1.7...v2.1.8
|
|
247
|
+
[2.1.7]: https://gitee.com/FastDotnet/fast.eslint.config/compare/v2.1.6...v2.1.7
|
|
248
|
+
[2.1.6]: https://gitee.com/FastDotnet/fast.eslint.config/compare/v2.1.5...v2.1.6
|
|
249
|
+
[2.1.5]: https://gitee.com/FastDotnet/fast.eslint.config/compare/v2.1.4...v2.1.5
|
|
250
|
+
[2.1.4]: https://gitee.com/FastDotnet/fast.eslint.config/compare/v2.1.3...v2.1.4
|
|
251
|
+
[2.1.3]: https://gitee.com/FastDotnet/fast.eslint.config/compare/v2.1.2...v2.1.3
|
|
252
|
+
[2.1.2]: https://gitee.com/FastDotnet/fast.eslint.config/compare/v2.1.1...v2.1.2
|
|
253
|
+
[2.1.1]: https://gitee.com/FastDotnet/fast.eslint.config/compare/v2.1.0...v2.1.1
|
|
254
|
+
[2.1.0]: https://gitee.com/FastDotnet/fast.eslint.config/compare/v2.0.10...v2.1.0
|
|
255
|
+
[2.0.10]: https://gitee.com/FastDotnet/fast.eslint.config/compare/v2.0.9...v2.0.10
|
|
256
|
+
[2.0.9]: https://gitee.com/FastDotnet/fast.eslint.config/compare/v2.0.8...v2.0.9
|
|
257
|
+
[2.0.8]: https://gitee.com/FastDotnet/fast.eslint.config/compare/v2.0.7...v2.0.8
|
|
258
|
+
[2.0.7]: https://gitee.com/FastDotnet/fast.eslint.config/compare/v2.0.6...v2.0.7
|
|
259
|
+
[2.0.6]: https://gitee.com/FastDotnet/fast.eslint.config/compare/v2.0.5...v2.0.6
|
|
260
|
+
[2.0.5]: https://gitee.com/FastDotnet/fast.eslint.config/compare/v2.0.4...v2.0.5
|
|
261
|
+
[2.0.4]: https://gitee.com/FastDotnet/fast.eslint.config/compare/v2.0.3...v2.0.4
|
|
262
|
+
[2.0.3]: https://gitee.com/FastDotnet/fast.eslint.config/compare/v2.0.2...v2.0.3
|
|
263
|
+
[2.0.2]: https://gitee.com/FastDotnet/fast.eslint.config/compare/v2.0.1...v2.0.2
|
|
264
|
+
[2.0.1]: https://gitee.com/FastDotnet/fast.eslint.config/compare/v2.0.0...v2.0.1
|
|
265
|
+
[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](http://docs.fastdotnet.cn/en-US/frontend/eslint-config/rules-risk) plus [rules-risk](http://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](http://docs.fastdotnet.cn/en-US/frontend/eslint-config/) · [Official website](http://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)](http://docs.fastdotnet.cn/en-US/frontend/eslint-config/rules/)
|
|
105
|
+
- [Default rules and risk guide](http://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.
|