@fast-china/eslint-config 2.1.8 → 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 CHANGED
@@ -1,12 +1,28 @@
1
1
  # Changelog
2
2
 
3
- All notable changes to this project will be documented in this file.
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
- ## Unreleased
7
+ ## [2.1.10] - 2026-09-22
8
8
 
9
- ## 2.1.8 - 2026-09-12
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
20
+
21
+ ### Changed
22
+
23
+ - Disabled `@typescript-eslint/switch-exhaustiveness-check` for Vue single-file components while retaining the error-level check for regular TypeScript and TSX files.
24
+
25
+ ## [2.1.8] - 2026-09-12
10
26
 
11
27
  ### Added
12
28
 
@@ -31,7 +47,7 @@ The format follows [Keep a Changelog](https://keepachangelog.com/en/1.1.0/), and
31
47
  - Removed the 2.x default export, `fastConfig()`, and `FastConfigOptions`; consumers now select the Vue or UniApp named configuration explicitly.
32
48
  - Removed Vue-to-UniApp capability leakage from the new Vue-only entry and removed `prefer-object-has-own` from the defaults.
33
49
 
34
- ## 2.1.7 - 2026-09-11
50
+ ## [2.1.7] - 2026-09-11
35
51
 
36
52
  ### Added
37
53
 
@@ -41,7 +57,7 @@ The format follows [Keep a Changelog](https://keepachangelog.com/en/1.1.0/), and
41
57
 
42
58
  - Allowed Promise-returning event handlers in Vue templates and TSX attributes while retaining all other `no-misused-promises` checks.
43
59
 
44
- ## 2.1.6 - 2026-09-11
60
+ ## [2.1.6] - 2026-09-11
45
61
 
46
62
  ### Added
47
63
 
@@ -57,31 +73,31 @@ The format follows [Keep a Changelog](https://keepachangelog.com/en/1.1.0/), and
57
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.
58
74
  - Updated runtime and development dependencies to their latest compatible releases while retaining TypeScript 6, tsdown 0.22, and the existing peer compatibility ranges.
59
75
 
60
- ## 2.1.5 - 2026-09-01
76
+ ## [2.1.5] - 2026-09-01
61
77
 
62
78
  ### Changed
63
79
 
64
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.
65
81
 
66
- ## 2.1.4 - 2026-08-30
82
+ ## [2.1.4] - 2026-08-30
67
83
 
68
84
  ### Changed
69
85
 
70
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.
71
87
 
72
- ## 2.1.3 - 2026-08-29
88
+ ## [2.1.3] - 2026-08-29
73
89
 
74
90
  ### Changed
75
91
 
76
92
  - Enabled `import-x/order` `sortTypesGroup` so separate type imports retain the final type group while sorting by their original source category within it.
77
93
 
78
- ## 2.1.2 - 2026-08-29
94
+ ## [2.1.2] - 2026-08-29
79
95
 
80
96
  ### Changed
81
97
 
82
98
  - Changed `@typescript-eslint/consistent-type-imports` fixes from inline type specifiers to separate `import type` declarations.
83
99
 
84
- ## 2.1.1 - 2026-08-29
100
+ ## [2.1.1] - 2026-08-29
85
101
 
86
102
  ### Added
87
103
 
@@ -92,7 +108,7 @@ The format follows [Keep a Changelog](https://keepachangelog.com/en/1.1.0/), and
92
108
  - Expanded the inline documentation for local ESLint rules and scoped overrides, including their purpose, important exceptions, and ownership of duplicate React checks.
93
109
  - Excluded stylesheet imports from `import-x/order` while preserving its grouping, alphabetizing, and `warnOnUnassignedImports` checks for all other imports.
94
110
 
95
- ## 2.1.0 - 2026-08-26
111
+ ## [2.1.0] - 2026-08-26
96
112
 
97
113
  ### Added
98
114
 
@@ -119,27 +135,27 @@ The format follows [Keep a Changelog](https://keepachangelog.com/en/1.1.0/), and
119
135
 
120
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.
121
137
 
122
- ## 2.0.10 - 2026-08-19
138
+ ## [2.0.10] - 2026-08-19
123
139
 
124
140
  ### Changed
125
141
 
126
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.
127
143
  - Enabled Markdown, `package.json` sorting, and `tsconfig*.json` sorting by default while keeping React and Angular disabled by default.
128
144
 
129
- ## 2.0.9 - 2026-08-10
145
+ ## [2.0.9] - 2026-08-10
130
146
 
131
147
  ### Changed
132
148
 
133
149
  - Allowed type-aware TypeScript configurations to forward `unknown` Promise rejection reasons without disabling `prefer-promise-reject-errors` for statically known non-`Error` values.
134
150
 
135
- ## 2.0.8 - 2026-08-09
151
+ ## [2.0.8] - 2026-08-09
136
152
 
137
153
  ### Changed
138
154
 
139
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.
140
156
  - Changed import group spacing to a compact no-blank-line style and normalized the repository imports to the new policy.
141
157
 
142
- ## 2.0.7 - 2026-08-08
158
+ ## [2.0.7] - 2026-08-08
143
159
 
144
160
  ### Changed
145
161
 
@@ -147,7 +163,7 @@ The format follows [Keep a Changelog](https://keepachangelog.com/en/1.1.0/), and
147
163
  - Removed `src` and declaration maps that referenced unpublished source files while retaining self-contained runtime source maps.
148
164
  - Added package-contract coverage for the publish allowlist and source-map integrity.
149
165
 
150
- ## 2.0.6 - 2026-08-04
166
+ ## [2.0.6] - 2026-08-04
151
167
 
152
168
  ### Changed
153
169
 
@@ -155,14 +171,14 @@ The format follows [Keep a Changelog](https://keepachangelog.com/en/1.1.0/), and
155
171
  - Simplified the test pipeline to runtime, type-contract, and package-contract verification by removing documentation- and comment-governance tests.
156
172
  - Included contribution and security documents in the published package and refreshed the engineering guidance for the current workflow.
157
173
 
158
- ## 2.0.5 - 2026-08-02
174
+ ## [2.0.5] - 2026-08-02
159
175
 
160
176
  ### Changed
161
177
 
162
178
  - Upgraded public API documentation to complete TSDoc, including standard defaults, parameters, return values, thrown errors, remarks, examples, and package-level documentation.
163
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.
164
180
 
165
- ## 2.0.4 - 2026-08-02
181
+ ## [2.0.4] - 2026-08-02
166
182
 
167
183
  ### Added
168
184
 
@@ -178,21 +194,21 @@ The format follows [Keep a Changelog](https://keepachangelog.com/en/1.1.0/), and
178
194
  - Changed `createGlobalIgnores()` to return a config array like the other fragment factories, so direct composition consistently uses spread syntax.
179
195
  - Updated `@eslint-react/eslint-plugin`, `@eslint/config-inspector`, and `globals` within their existing compatible version ranges.
180
196
 
181
- ## 2.0.3 - 2026-07-29
197
+ ## [2.0.3] - 2026-07-29
182
198
 
183
199
  ### Changed
184
200
 
185
201
  - Renamed the internal factory directory from `src/code` to the clearer `src/core` and updated all source and type-generation imports.
186
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.
187
203
 
188
- ## 2.0.2 - 2026-07-29
204
+ ## [2.0.2] - 2026-07-29
189
205
 
190
206
  ### Changed
191
207
 
192
208
  - Moved the `fastConfig()` factory implementation to `src/code/index.ts` so the source layout groups the primary code entry consistently.
193
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.
194
210
 
195
- ## 2.0.1 - 2026-07-26
211
+ ## [2.0.1] - 2026-07-26
196
212
 
197
213
  ### Added
198
214
 
@@ -206,7 +222,7 @@ The format follows [Keep a Changelog](https://keepachangelog.com/en/1.1.0/), and
206
222
  - Raised the verified runtime baselines to Node.js 22.18.0 and 24.11.0 to match the current tsdown toolchain.
207
223
  - Updated the development baseline to ESLint 10.8.0, then upgraded `actions/checkout` plus `actions/setup-node` to their current v7 major releases.
208
224
 
209
- ## 2.0.0 - 2026-07-26
225
+ ## [2.0.0] - 2026-07-26
210
226
 
211
227
  ### Added
212
228
 
@@ -224,3 +240,26 @@ The format follows [Keep a Changelog](https://keepachangelog.com/en/1.1.0/), and
224
240
 
225
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.
226
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 `docs/rules-risk.md` plus `docs/rules-risk.zh.md` synchronized.
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
- <p align="left">
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" alt="logo" width="160" />
4
+ <img src="./Fast.png" width="128" alt="Fast.ESLint.Config Logo" />
7
5
  </p>
8
6
 
9
- # @fast-china/eslint-config
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
- A practical ESLint Flat Config for Vue 3, UniApp, SDKs, Node.js, React, Angular, TypeScript, and JavaScript projects.
15
+ Typed ESLint Flat Config for Vue 3, uni-app, TypeScript and Node.js, with optional framework integrations.
12
16
 
13
- The policy starts from common ecosystem conventions and concise, readable code. It then prioritizes real bugs and type safety, consistency, and finally Fast project preferences. It does not force unusual rewrites merely to satisfy ESLint.
17
+ **[Documentation](http://docs.fastdotnet.cn/en-US/frontend/eslint-config/) · [Official website](http://fastdotnet.com)**
14
18
 
15
19
  ## Highlights
16
20
 
@@ -28,118 +32,61 @@ 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
- ## Vue 3
36
-
37
- ```js
38
- import { vueConfig } from "@fast-china/eslint-config";
39
-
40
- export default vueConfig;
41
- ```
42
-
43
- This entry covers JavaScript, type-aware TypeScript, Vue SFCs, and standalone `.jsx`/`.tsx` components used by Vue projects. Vue JSX/TSX keeps checks for explicit emits, duplicate keys, readonly props, reactivity loss, and reserved component names without inheriting template-only kebab-case, attribute-order, or `v-text`/`v-html` rules. The entry also includes JSON, Import, RegExp, `.gitignore`, and Prettier compatibility without loading UniApp capabilities.
41
+ ## Quick start
44
42
 
45
- ## UniApp
43
+ Create `eslint.config.mjs` in the Vue 3 project:
46
44
 
47
45
  ```js
48
- import { uniAppConfig } from "@fast-china/eslint-config";
49
-
50
- export default uniAppConfig;
51
- ```
52
-
53
- The UniApp entry adds `.nvue`, `uni`, `uniCloud`, page APIs, conditional-platform globals, the `unpackage` ignore, and comment handling for `pages.json` and `manifest.json`.
54
-
55
- 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.
56
-
57
- ## Factories and project overrides
58
-
59
- The root entry provides explicit named configurations and factories. Use a factory when the project needs to select its runtime environment or append overrides:
60
-
61
- ```js
62
- import { createVueProjectConfigs, defineRules } from "@fast-china/eslint-config";
46
+ import { vueConfig } from "@fast-china/eslint-config";
47
+ import { defineConfig } from "eslint/config";
63
48
 
64
- export default createVueProjectConfigs(
65
- { environment: "universal" },
49
+ export default defineConfig([
50
+ ...vueConfig,
66
51
  {
67
- ignores: ["public/vendor/**"],
68
- languageOptions: {
69
- globals: {
70
- __APP_VERSION__: "readonly",
71
- },
72
- },
73
- rules: defineRules({
74
- "no-console": "warn",
75
- }),
76
- }
77
- );
52
+ name: "project/custom",
53
+ rules: {},
54
+ },
55
+ ]);
78
56
  ```
79
57
 
80
- Available factories:
81
-
82
- - `createVueProjectConfigs(options, ...overrides)`
83
- - `createUniAppProjectConfigs(options, ...overrides)`
84
- - `createBaseConfigs(options)` for framework-neutral Node.js, SDK, and explicit composition
85
-
86
- `environment` accepts `"browser"`, `"node"`, or `"universal"` and defaults to `"browser"`. Configuration, script, test, and CLI files always receive Node.js globals separately.
87
-
88
- Trailing Flat Config objects have the highest precedence. `defineRules()` returns its input unchanged and only adds precise rule typing.
89
-
90
- ## TypeScript policy
91
-
92
- Type-aware files must belong to a `tsconfig.json` discoverable by Project Service.
93
-
94
- - `explicit-module-boundary-types: "error"` requires explicit parameter and return types for exported `.ts`, `.mts`, and `.cts` functions and public boundaries of exported classes.
95
- - `.tsx` disables the module-boundary annotation requirement by default: component props remain type checked without forcing an otherwise inferable JSX return annotation.
96
- - `explicit-function-return-type: "off"` leaves internal functions, local handlers, and inline callbacks to TypeScript inference.
97
- - `no-inferrable-types` preserves explicit parameter and property types.
98
- - Vue/NVue SFCs and standalone TSX components do not require module-boundary or function-return annotations, retaining common concise component forms.
99
- - `no-floating-promises` is disabled because Promise waiting depends on business ordering and error semantics.
100
- - `no-void: "error"` rejects `void promise` and other `void` expressions as lint workarounds.
101
- - `require-await: "error"` requires removing `async` when there is no real `await`, avoiding changed return and exception semantics.
102
- - `no-misused-promises`, `await-thenable`, unsafe-type rules, and selected high-confidence type rules remain errors.
103
- - Standard non-null assertions are permitted; contradictory, redundant, or invalid assertions remain checked by focused rules.
104
- - Numbers and booleans may be interpolated directly in template strings, and runtime guards are not rejected merely because types make them look unnecessary.
58
+ ```sh
59
+ pnpm exec eslint .
60
+ ```
105
61
 
106
- ## JavaScript, Import, and Vue policy
62
+ Type-aware source files must belong to the project tsconfig. The Vue configuration does not include uni-app capabilities.
107
63
 
108
- - `no-empty` permits a completely empty `catch` while reporting other empty blocks.
109
- - `camelcase: ["error", { properties: "never" }]` applies to variables and types while preserving external protocol property names.
110
- - Real-risk rules such as `no-eval`, `no-implied-eval`, `no-new-func`, and `no-debugger` remain errors.
111
- - `import-x/first`, `import-x/no-duplicates`, and `import-x/order` are errors; declaration ordering supports automatic fixes.
112
- - 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.
113
- - `sort-imports` checks only member order inside one import declaration and does not order declarations.
114
- - `import-x/style-imports-last` keeps stylesheets in the final contiguous group without reordering that group internally.
115
- - 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.
116
- - 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.
64
+ ## Common usage
117
65
 
118
- ## React and Angular
66
+ Use the independent uni-app entry rather than stacking both complete configurations:
119
67
 
120
68
  ```js
121
- import { createBaseConfigs } from "@fast-china/eslint-config";
122
- import { createReactConfigs } from "@fast-china/eslint-config/configs";
69
+ import { uniAppConfig } from "@fast-china/eslint-config";
123
70
  import { defineConfig } from "eslint/config";
124
71
 
125
- export default defineConfig([...createBaseConfigs(), ...createReactConfigs()]);
72
+ export default defineConfig([
73
+ ...uniAppConfig,
74
+ {
75
+ name: "project/custom",
76
+ rules: {},
77
+ },
78
+ ]);
126
79
  ```
127
80
 
128
- Angular composes `createAngularConfigs()` in the same way. The base configuration loads neither Vue nor UniApp.
129
-
130
- ## Optional capabilities and manifest sorting
131
-
132
- Markdown and Lodash import policy require explicit composition:
81
+ For framework-independent Node.js projects:
133
82
 
134
83
  ```js
135
84
  import { createBaseConfigs } from "@fast-china/eslint-config";
136
- import { createMarkdownConfigs } from "@fast-china/eslint-config/configs";
137
- import { defineConfig } from "eslint/config";
138
85
 
139
- export default defineConfig([...createBaseConfigs({ environment: "node" }), ...createMarkdownConfigs()]);
86
+ export default createBaseConfigs({ environment: "node" });
140
87
  ```
141
88
 
142
- `createBaseConfigs()`, `vueConfig`, and `uniAppConfig` all enable `package.json` and `tsconfig*.json` sorting by default. Package sorting does not enter conditional `exports` objects whose order has runtime meaning.
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.
143
90
 
144
91
  ## Public entries
145
92
 
@@ -154,8 +101,8 @@ Prettier does not run as an ESLint rule. The defaults only load `eslint-config-p
154
101
 
155
102
  ## Documentation
156
103
 
157
- - [Complete rule reference (Chinese)](./docs/rules/index.zh.md)
158
- - [Default rules and risk guide](./docs/rules-risk.md)
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)
159
106
  - [Chinese engineering audit](./docs/engineering-audit.zh.md)
160
107
  - [Changelog](./CHANGELOG.md)
161
108
 
@@ -168,3 +115,17 @@ pnpm install --frozen-lockfile
168
115
  pnpm typegen
169
116
  pnpm check
170
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.
package/README.zh.md CHANGED
@@ -1,16 +1,20 @@
1
- <p align="left">
2
- <strong>简体中文</strong> | <a href="./README.md">English</a>
3
- </p>
1
+ **简体中文** | [English](./README.md)
4
2
 
5
3
  <p align="center">
6
- <img src="./Fast.png" alt="logo" width="160" />
4
+ <img src="./Fast.png" width="128" alt="Fast.ESLint.Config Logo" />
7
5
  </p>
8
6
 
9
- # @fast-china/eslint-config
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
- 面向 Vue 3、UniApp、SDK、Node.js、React、Angular、TypeScript 与 JavaScript 项目的实用型 ESLint Flat Config。
15
+ 面向 Vue 3、uni-app、TypeScript 与 Node.js 的 ESLint Flat Config,提供按需框架配置与规则类型。
12
16
 
13
- 规则取舍遵循:先尊重社区通用写法并保持代码简洁、易读,再依次考虑真实 Bug / 类型安全、代码一致性和 Fast 系列项目偏好。不会为了满足 ESLint 强制改写语义正常、普遍使用的代码。
17
+ **[使用文档](http://docs.fastdotnet.cn/zh-CN/frontend/eslint-config/) · [官方网站](http://fastdotnet.com)**
14
18
 
15
19
  ## 特性
16
20
 
@@ -28,118 +32,61 @@
28
32
  - ESLint `^10.0.0`
29
33
  - TypeScript `^6.0.0`
30
34
 
35
+ ## 安装
36
+
31
37
  ```sh
32
38
  pnpm add -D eslint typescript @fast-china/eslint-config
33
39
  ```
34
40
 
35
- ## Vue 3
36
-
37
- ```js
38
- import { vueConfig } from "@fast-china/eslint-config";
39
-
40
- export default vueConfig;
41
- ```
42
-
43
- 该入口处理 JavaScript、类型感知 TypeScript、Vue SFC,以及 Vue 项目常用的独立 `.jsx`/`.tsx` 组件文件;Vue JSX/TSX 继续检查显式 emits、重复键、只读 props、响应性丢失和保留组件名,但不会套用模板专属的 kebab-case、模板属性排序或 `v-text`/`v-html` 规则。配置同时包含 JSON、Import、RegExp、`.gitignore` 和 Prettier 兼容规则,但不包含任何 UniApp 能力。
41
+ ## 快速开始
44
42
 
45
- ## UniApp
43
+ 在 Vue 3 项目中创建 `eslint.config.mjs`:
46
44
 
47
45
  ```js
48
- import { uniAppConfig } from "@fast-china/eslint-config";
49
-
50
- export default uniAppConfig;
51
- ```
52
-
53
- UniApp 入口在 Vue 完整能力之外增加 `.nvue`、`uni`、`uniCloud`、页面 API、条件编译平台 globals、`unpackage` 忽略,以及 `pages.json`、`manifest.json` 注释适配。
54
-
55
- ESLint 不执行 `#ifdef`/`#endif`,因此只能识别平台对象,不能验证对象是否位于正确的平台分支。当前不处理需要专用解析器的 `.uvue` 与 `.uts`。
56
-
57
- ## 工厂与项目覆写
58
-
59
- 根入口只提供含义明确的具名配置与工厂。项目需要选择运行环境或追加覆写时使用对应工厂:
60
-
61
- ```js
62
- import { createVueProjectConfigs, defineRules } from "@fast-china/eslint-config";
46
+ import { vueConfig } from "@fast-china/eslint-config";
47
+ import { defineConfig } from "eslint/config";
63
48
 
64
- export default createVueProjectConfigs(
65
- { environment: "universal" },
49
+ export default defineConfig([
50
+ ...vueConfig,
66
51
  {
67
- ignores: ["public/vendor/**"],
68
- languageOptions: {
69
- globals: {
70
- __APP_VERSION__: "readonly",
71
- },
72
- },
73
- rules: defineRules({
74
- "no-console": "warn",
75
- }),
76
- }
77
- );
52
+ name: "project/custom",
53
+ rules: {},
54
+ },
55
+ ]);
78
56
  ```
79
57
 
80
- 可用工厂:
81
-
82
- - `createVueProjectConfigs(options, ...overrides)`
83
- - `createUniAppProjectConfigs(options, ...overrides)`
84
- - `createBaseConfigs(options)`:不绑定前端框架,适用于 Node.js、SDK 及其他显式组合场景
85
-
86
- `environment` 可为 `"browser"`、`"node"` 或 `"universal"`,默认是 `"browser"`。配置文件、脚本、测试和 CLI 文件始终单独获得 Node.js globals。
87
-
88
- 后置 Flat Config 拥有最高优先级。`defineRules()` 不修改传入对象,只提供精确规则类型检查。
89
-
90
- ## TypeScript 策略
91
-
92
- 类型感知文件必须属于 Project Service 可发现的 `tsconfig.json`。
93
-
94
- - `explicit-module-boundary-types: "error"`:`.ts`、`.mts`、`.cts` 导出函数及导出类的公共边界必须显式声明参数和返回类型。
95
- - `.tsx` 默认关闭模块边界类型强制:组件 Props 继续接受 TypeScript 检查,但不要求补写可稳定推断的 JSX 返回类型。
96
- - `explicit-function-return-type: "off"`:内部函数、局部处理函数和内联回调使用 TypeScript 推断。
97
- - `no-inferrable-types` 不删除参数和属性上的显式类型。
98
- - Vue/NVue SFC 与独立 TSX 组件不强制模块边界和函数返回类型,以保留常见简洁写法。
99
- - `no-floating-promises` 关闭;是否等待 Promise 由业务顺序和异常语义决定。
100
- - `no-void: "error"`:不使用 `void promise` 或其他 `void` 表达式规避检查。
101
- - `require-await: "error"`:没有真实 `await` 的函数应删除 `async`,避免改变返回值和异常语义。
102
- - `no-misused-promises`、`await-thenable`、unsafe 类型规则及精选的高置信度类型规则保持为错误。
103
- - 标准非空断言可用;矛盾、重复或无效的断言仍由专项规则检查。
104
- - 数字和布尔值可直接用于模板字符串;运行时防御性条件不会因类型看似多余而报错。
58
+ ```sh
59
+ pnpm exec eslint .
60
+ ```
105
61
 
106
- ## JavaScript、Import 与 Vue 策略
62
+ 类型感知检查的源码应属于项目 tsconfig 范围。Vue 配置不包含 uni-app 平台能力。
107
63
 
108
- - `no-empty` 允许完全空的 `catch`,其他空代码块仍报错。
109
- - `camelcase: ["error", { properties: "never" }]`:变量和类型使用 camelCase,外部协议对象属性保持原名。
110
- - `no-eval`、`no-implied-eval`、`no-new-func`、`no-debugger` 等真实风险规则为错误。
111
- - `import-x/first`、`import-x/no-duplicates` 与 `import-x/order` 均为错误;声明顺序支持自动修复。
112
- - 保留 UniApp、Vue、React、Angular、Vite、Element Plus、Fast 和 Lodash 等常用 pathGroups,`@/**` 归入 internal,类型导入不参与 pathGroups 匹配。
113
- - `sort-imports` 只检查同一 import 声明 `{}` 内的成员顺序,不接管声明之间的排序。
114
- - `import-x/style-imports-last` 要求样式文件形成最后一个连续分组,同时不改变样式组内部顺序。
115
- - Vue SFC 使用官方 `flat/recommended`;显式 emits、重复键、只读 props、响应性丢失和保留组件名等脚本语义规则也应用于 Vue JSX/TSX。
116
- - kebab-case 属性、模板属性顺序和组件上的 `v-text`/`v-html` 仅检查 `.vue/.nvue` 模板;JSX 属性继续遵循 JavaScript 的 camelCase 约定。`no-v-html` 保持警告。
64
+ ## 常见用法
117
65
 
118
- ## React 与 Angular
66
+ uni-app 使用独立入口,不与 Vue 完整配置叠加:
119
67
 
120
68
  ```js
121
- import { createBaseConfigs } from "@fast-china/eslint-config";
122
- import { createReactConfigs } from "@fast-china/eslint-config/configs";
69
+ import { uniAppConfig } from "@fast-china/eslint-config";
123
70
  import { defineConfig } from "eslint/config";
124
71
 
125
- export default defineConfig([...createBaseConfigs(), ...createReactConfigs()]);
72
+ export default defineConfig([
73
+ ...uniAppConfig,
74
+ {
75
+ name: "project/custom",
76
+ rules: {},
77
+ },
78
+ ]);
126
79
  ```
127
80
 
128
- Angular 同理组合 `createAngularConfigs()`。基础配置不会加载 Vue 或 UniApp。
129
-
130
- ## 可选能力与清单排序
131
-
132
- Markdown 和 Lodash 导入策略需要显式组合:
81
+ 不绑定框架的 Node.js 项目:
133
82
 
134
83
  ```js
135
84
  import { createBaseConfigs } from "@fast-china/eslint-config";
136
- import { createMarkdownConfigs } from "@fast-china/eslint-config/configs";
137
- import { defineConfig } from "eslint/config";
138
85
 
139
- export default defineConfig([...createBaseConfigs({ environment: "node" }), ...createMarkdownConfigs()]);
86
+ export default createBaseConfigs({ environment: "node" });
140
87
  ```
141
88
 
142
- `createBaseConfigs()`、`vueConfig` 和 `uniAppConfig` 都默认启用 `package.json` 与 `tsconfig*.json` 排序。`package.json` 排序不会进入顺序具有运行时语义的条件 `exports` 对象。
89
+ 将项目自定义配置放在共享配置之后;`rules: {}` 留给项目按需填写。需要调整运行环境时,可使用配置工厂。Fast 生态的本地规则副本继续按各仓库 AGENTS.md 同步,不因示例而改成安装配置包。
143
90
 
144
91
  ## 公共入口
145
92
 
@@ -154,8 +101,8 @@ Prettier 不作为 ESLint 规则运行。默认配置只加载 `eslint-config-pr
154
101
 
155
102
  ## 文档
156
103
 
157
- - [完整规则手册](./docs/rules/index.zh.md)
158
- - [默认规则与风险指南](./docs/rules-risk.zh.md)
104
+ - [完整规则手册](http://docs.fastdotnet.cn/zh-CN/frontend/eslint-config/rules/)
105
+ - [默认规则与风险指南](http://docs.fastdotnet.cn/zh-CN/frontend/eslint-config/rules-risk)
159
106
  - [工程质量审查报告](./docs/engineering-audit.zh.md)
160
107
  - [更新日志](./CHANGELOG.md)
161
108
 
@@ -168,3 +115,17 @@ pnpm install --frozen-lockfile
168
115
  pnpm typegen
169
116
  pnpm check
170
117
  ```
118
+
119
+ ## 贡献与安全
120
+
121
+ [贡献指南](./CONTRIBUTING.md) · [安全策略](./SECURITY.md)
122
+
123
+ ## 版权、许可证与使用声明
124
+
125
+ 版权所有 © 2018-Now 小方。本项目依据 [Apache License 2.0](./LICENSE) 开源;在遵守许可证的前提下,可以使用、修改和分发本软件,包括商业使用。
126
+
127
+ 再分发时,应按许可证要求提供许可证副本、对修改的文件作出显著说明,并保留适用的版权和归属声明;包含需要保留的 NOTICE 信息时一并处理。本说明不替代正式许可证,也不额外要求在产品界面展示作者或项目标识。
128
+
129
+ 使用者应就自身使用、二次开发、部署、数据处理及运营活动遵守适用法律和第三方合法权益,自行取得依法需要的授权。上述内容为合规提醒,不构成附加许可条件。
130
+
131
+ 除适用法律另有规定或另有书面约定外,本软件按“原样”提供;保证排除与责任限制以许可证第 7、8 条为准。提供本项目不代表原作者为使用者的二次开发和运营活动背书,也不当然承担其对第三方作出的合同承诺。本说明不排除依法不得排除的责任。
@@ -1,7 +1,7 @@
1
1
  import { defineConfig } from "eslint/config";
2
2
  //#region src/configs/ignores.d.ts
3
3
  /**
4
- * 默认忽略依赖、构建结果、缓存、生成文件和包管理器锁文件。
4
+ * 默认忽略依赖、构建结果、缓存、生成文件、AI 技能内容和工具锁文件。
5
5
  *
6
6
  * @remarks
7
7
  * 不忽略 `src`、`public`、测试夹具或普通 Markdown 文档,避免共享配置静默漏检