@fast-china/eslint-config 2.1.6 → 2.1.8

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.
Files changed (88) hide show
  1. package/CHANGELOG.md +35 -0
  2. package/CONTRIBUTING.md +2 -2
  3. package/README.md +66 -142
  4. package/README.zh.md +64 -142
  5. package/dist/configs/environment.mjs +2 -0
  6. package/dist/configs/environment.mjs.map +1 -1
  7. package/dist/configs/ignores.mjs +0 -1
  8. package/dist/configs/ignores.mjs.map +1 -1
  9. package/dist/configs/import.mjs +4 -1
  10. package/dist/configs/import.mjs.map +1 -1
  11. package/dist/configs/index.d.mts +2 -2
  12. package/dist/configs/index.mjs +2 -2
  13. package/dist/configs/javascript.mjs +3 -1
  14. package/dist/configs/javascript.mjs.map +1 -1
  15. package/dist/configs/json.mjs +3 -1
  16. package/dist/configs/json.mjs.map +1 -1
  17. package/dist/configs/markdown.d.mts +2 -1
  18. package/dist/configs/markdown.mjs +4 -2
  19. package/dist/configs/markdown.mjs.map +1 -1
  20. package/dist/configs/prettier.mjs +1 -1
  21. package/dist/configs/prettier.mjs.map +1 -1
  22. package/dist/configs/sort-package.d.mts +1 -1
  23. package/dist/configs/sort-package.mjs +1 -1
  24. package/dist/configs/sort-package.mjs.map +1 -1
  25. package/dist/configs/sort-tsconfig.d.mts +2 -2
  26. package/dist/configs/sort-tsconfig.mjs +2 -2
  27. package/dist/configs/sort-tsconfig.mjs.map +1 -1
  28. package/dist/configs/typescript.d.mts +11 -7
  29. package/dist/configs/typescript.mjs +26 -19
  30. package/dist/configs/typescript.mjs.map +1 -1
  31. package/dist/configs/uniapp.mjs +19 -13
  32. package/dist/configs/uniapp.mjs.map +1 -1
  33. package/dist/configs/vue.d.mts +18 -3
  34. package/dist/configs/vue.mjs +60 -9
  35. package/dist/configs/vue.mjs.map +1 -1
  36. package/dist/constants/index.d.mts +4 -0
  37. package/dist/constants/index.mjs +5 -1
  38. package/dist/constants/index.mjs.map +1 -1
  39. package/dist/index.d.mts +37 -58
  40. package/dist/index.mjs +43 -47
  41. package/dist/index.mjs.map +1 -1
  42. package/dist/rules/angular.d.mts +28 -0
  43. package/dist/rules/angular.mjs +28 -0
  44. package/dist/rules/angular.mjs.map +1 -1
  45. package/dist/rules/common.d.mts +19 -6
  46. package/dist/rules/common.mjs +19 -13
  47. package/dist/rules/common.mjs.map +1 -1
  48. package/dist/rules/import.d.mts +9 -0
  49. package/dist/rules/import.mjs +24 -0
  50. package/dist/rules/import.mjs.map +1 -1
  51. package/dist/rules/index.d.mts +2 -2
  52. package/dist/rules/index.mjs +2 -2
  53. package/dist/rules/javascript.d.mts +18 -0
  54. package/dist/rules/javascript.mjs +18 -0
  55. package/dist/rules/javascript.mjs.map +1 -1
  56. package/dist/rules/lodash.d.mts +2 -0
  57. package/dist/rules/lodash.mjs +6 -2
  58. package/dist/rules/lodash.mjs.map +1 -1
  59. package/dist/rules/react.d.mts +13 -0
  60. package/dist/rules/react.mjs +13 -0
  61. package/dist/rules/react.mjs.map +1 -1
  62. package/dist/rules/regexp.d.mts +25 -0
  63. package/dist/rules/regexp.mjs +25 -0
  64. package/dist/rules/regexp.mjs.map +1 -1
  65. package/dist/rules/sort-package.d.mts +3 -1
  66. package/dist/rules/sort-package.mjs +3 -1
  67. package/dist/rules/sort-package.mjs.map +1 -1
  68. package/dist/rules/sort-tsconfig.d.mts +3 -1
  69. package/dist/rules/sort-tsconfig.mjs +3 -1
  70. package/dist/rules/sort-tsconfig.mjs.map +1 -1
  71. package/dist/rules/typescript.d.mts +82 -13
  72. package/dist/rules/typescript.mjs +85 -16
  73. package/dist/rules/typescript.mjs.map +1 -1
  74. package/dist/rules/vue.d.mts +67 -10
  75. package/dist/rules/vue.mjs +43 -14
  76. package/dist/rules/vue.mjs.map +1 -1
  77. package/docs/engineering-audit.zh.md +45 -49
  78. package/docs/rules/angular.zh.md +721 -0
  79. package/docs/rules/core.zh.md +3031 -0
  80. package/docs/rules/index.zh.md +38 -0
  81. package/docs/rules/json.zh.md +784 -0
  82. package/docs/rules/markdown.zh.md +449 -0
  83. package/docs/rules/react.zh.md +2091 -0
  84. package/docs/rules/typescript.zh.md +2051 -0
  85. package/docs/rules/vue.zh.md +3016 -0
  86. package/docs/rules-risk.md +85 -90
  87. package/docs/rules-risk.zh.md +76 -81
  88. package/package.json +4 -2
package/CHANGELOG.md CHANGED
@@ -6,6 +6,41 @@ The format follows [Keep a Changelog](https://keepachangelog.com/en/1.1.0/), and
6
6
 
7
7
  ## Unreleased
8
8
 
9
+ ## 2.1.8 - 2026-09-12
10
+
11
+ ### Added
12
+
13
+ - Added named `vueConfig`, `uniAppConfig`, `createVueProjectConfigs()`, and `createUniAppProjectConfigs()` exports to the root entry.
14
+ - Added focused high-confidence TypeScript checks on top of `recommendedTypeChecked`, including optional-chain, mixed-enum, spread, redundant-conversion, getter/setter, and catch-callback safety rules.
15
+ - Added explicitly reviewed incorrect and correct code examples for every rule recorded in the generated 474-rule reference.
16
+
17
+ ### Changed
18
+
19
+ - Rebased the rule policy on common ecosystem conventions and concise readability, followed by real bugs and type safety, consistency, and finally Fast project preferences.
20
+ - Treated exported `.ts`, `.mts`, and `.cts` module boundaries as SDK APIs requiring explicit types while allowing internal function return inference and preserving explicit parameter/property annotations.
21
+ - Treated `.tsx` as a type-aware UI component format shared by Vue and other JSX runtimes, preserving inferred component return types and fixing TSX overrides for custom multi-pattern file scopes.
22
+ - Applied Vue component-script semantics such as explicit emits, duplicate keys, readonly props, reactivity preservation, and reserved names to Vue JSX/TSX while keeping template-only casing, ordering, and directive rules scoped to `.vue`/`.nvue`.
23
+ - Ordered every generated rule category with repository-explicit rules first and third-party preset rules last; generation now rejects missing, identical, or comment-only examples.
24
+ - Kept empty catches valid, `no-void` and `require-await` strict, and `camelcase` strict with external object properties excluded.
25
+ - Replaced the complete strict and stylistic type-aware presets with `recommendedTypeChecked`; allowed standard non-null assertions and defensive runtime conditions while retaining focused contradiction and unsafe-type checks.
26
+ - Kept import ordering, stylesheet-last placement, explicit Vue emits, kebab-case attributes, Vue correctness rules, and Vue attribute ordering strict; added common React, Angular, and Vite path groups and made import-member ordering an error.
27
+ - Kept package and tsconfig key sorting in every complete project configuration.
28
+
29
+ ### Removed
30
+
31
+ - Removed the 2.x default export, `fastConfig()`, and `FastConfigOptions`; consumers now select the Vue or UniApp named configuration explicitly.
32
+ - Removed Vue-to-UniApp capability leakage from the new Vue-only entry and removed `prefer-object-has-own` from the defaults.
33
+
34
+ ## 2.1.7 - 2026-09-11
35
+
36
+ ### Added
37
+
38
+ - Rejected direct and indirect dynamic string execution, returned values from Promise executors, type-only inline imports with runtime side effects, and Vue props/ref usage that loses reactivity.
39
+
40
+ ### Changed
41
+
42
+ - Allowed Promise-returning event handlers in Vue templates and TSX attributes while retaining all other `no-misused-promises` checks.
43
+
9
44
  ## 2.1.6 - 2026-09-11
10
45
 
11
46
  ### Added
package/CONTRIBUTING.md CHANGED
@@ -30,10 +30,10 @@ 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; verify `meta.fixable` before using `[可自动修复]`, 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 `docs/rules-risk.md` plus `docs/rules-risk.zh.md` 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
- 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 default config, `fastConfig`, `defineRules`, and related types.
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.
37
37
  12. Document behavior changes in `CHANGELOG.md` and both README files.
38
38
 
39
39
  ## Pull requests
package/README.md CHANGED
@@ -8,20 +8,19 @@
8
8
 
9
9
  # @fast-china/eslint-config
10
10
 
11
- A practical ESLint Flat Config for Vue 3, UniApp, React, Angular, Vite, TypeScript, and JavaScript projects.
11
+ A practical ESLint Flat Config for Vue 3, UniApp, SDKs, Node.js, React, Angular, TypeScript, and JavaScript projects.
12
12
 
13
- [![npm version](https://img.shields.io/npm/v/@fast-china/eslint-config?color=orange)](https://www.npmjs.com/package/@fast-china/eslint-config) [![Node.js](https://img.shields.io/badge/node-%5E22.18%20%7C%7C%20%5E24.18-brightgreen)](https://nodejs.org/) [![ESLint](https://img.shields.io/badge/eslint-%5E10.0-4b32c3)](https://eslint.org/) [![license](https://img.shields.io/npm/l/@fast-china/eslint-config)](./LICENSE)
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.
14
14
 
15
- ## Features
15
+ ## Highlights
16
16
 
17
- - Built for ESLint 10 and native Flat Config only.
18
- - The root entry is a fixed Vue 3 + TypeScript + UniApp preset with no language or plugin switches.
19
- - TypeScript, Vue, and React TypeScript always use type-aware recommended rules and Project Service.
20
- - SDKs, OA systems, administration apps, and clients use one JavaScript, TypeScript, Import, and RegExp rule set with no strictness tiers.
21
- - JavaScript, TypeScript, Vue/`.nvue`, UniApp globals, JSON dialects, Import, RegExp, manifest sorting, `.gitignore`, and Prettier compatibility are enabled by default.
22
- - React, Angular, Markdown, and Lodash policies compose explicitly from `@fast-china/eslint-config/configs`.
23
- - Schema-generated `RuleOptions` provides exact rule-name and option completion.
24
- - Plugins and parsers are direct package dependencies, so consumers do not assemble a plugin dependency tree.
17
+ - ESLint 10 with native Flat Config only.
18
+ - Separate complete configurations for Vue 3 and UniApp; plain Vue projects do not receive UniApp globals, `.nvue` parsing, or manifest behavior.
19
+ - TypeScript uses `recommendedTypeChecked` and Project Service without the complete strict or stylistic presets.
20
+ - Exported `.ts`, `.mts`, and `.cts` boundaries are treated as SDK public APIs; `.tsx` retains full type safety and normal component return inference.
21
+ - SDKs and applications share one JavaScript, TypeScript, Import, and RegExp policy.
22
+ - `package.json` and `tsconfig*.json` sorting is enabled by default; React, Angular, Markdown, and Lodash compose explicitly from `./configs`.
23
+ - Schema-generated `RuleOptions` provides precise rule-name and option completion.
25
24
 
26
25
  ## Requirements
27
26
 
@@ -29,61 +28,41 @@ A practical ESLint Flat Config for Vue 3, UniApp, React, Angular, Vite, TypeScri
29
28
  - ESLint `^10.0.0`
30
29
  - TypeScript `^6.0.0`
31
30
 
32
- ## Installation
33
-
34
31
  ```sh
35
32
  pnpm add -D eslint typescript @fast-china/eslint-config
36
33
  ```
37
34
 
38
- ## Vue 3 / UniApp quick start
39
-
40
- Create `eslint.config.mjs`:
35
+ ## Vue 3
41
36
 
42
37
  ```js
43
- import fastChina from "@fast-china/eslint-config";
38
+ import { vueConfig } from "@fast-china/eslint-config";
44
39
 
45
- export default fastChina;
40
+ export default vueConfig;
46
41
  ```
47
42
 
48
- The default entry includes:
49
-
50
- - Browser globals plus dedicated Node.js globals for tooling files.
51
- - JavaScript, type-aware TypeScript, Vue 3, and `.nvue`.
52
- - `uni`, `uniCloud`, page APIs, and conditional-platform globals such as `wx`, `plus`, `my`, and `tt`.
53
- - JSON, JSONC, JSON5, comment-compatible `pages.json`, `manifest.json`, and VS Code `settings.json` and `extensions.json`.
54
- - Import, RegExp, `package.json`/`tsconfig*.json` sorting, `.gitignore`, and Prettier conflict handling.
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.
55
44
 
56
- ESLint does not execute UniApp `#ifdef`/`#endif` directives. It recognizes platform objects but cannot verify that they are used in the correct platform branch. `.uvue` and `.uts`, which require dedicated parsers, are not handled.
57
-
58
- ## `fastConfig()`
59
-
60
- The root factory retains only `environment`, whose default is `"browser"`:
45
+ ## UniApp
61
46
 
62
47
  ```js
63
- import { fastConfig } from "@fast-china/eslint-config";
48
+ import { uniAppConfig } from "@fast-china/eslint-config";
64
49
 
65
- export default fastConfig({
66
- environment: "universal",
67
- });
50
+ export default uniAppConfig;
68
51
  ```
69
52
 
70
- | Value | Application globals |
71
- | ------------- | ------------------- |
72
- | `"browser"` | Browser |
73
- | `"node"` | Node.js |
74
- | `"universal"` | Browser and Node.js |
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`.
75
54
 
76
- Config, script, test, and CLI files always receive Node.js globals and allow necessary logging and CommonJS interoperability.
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.
77
56
 
78
- ## Project overrides
57
+ ## Factories and project overrides
79
58
 
80
- Rules, globals, ignores, and special parser settings use trailing Flat Config objects instead of root factory options:
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:
81
60
 
82
61
  ```js
83
- import { defineRules, fastConfig } from "@fast-china/eslint-config";
62
+ import { createVueProjectConfigs, defineRules } from "@fast-china/eslint-config";
84
63
 
85
- export default fastConfig(
86
- { environment: "browser" },
64
+ export default createVueProjectConfigs(
65
+ { environment: "universal" },
87
66
  {
88
67
  ignores: ["public/vendor/**"],
89
68
  languageOptions: {
@@ -94,42 +73,49 @@ export default fastConfig(
94
73
  rules: defineRules({
95
74
  "no-console": "warn",
96
75
  }),
97
- },
98
- {
99
- files: ["**/*.generated.ts"],
100
- rules: defineRules({
101
- "@typescript-eslint/no-unused-vars": "off",
102
- }),
103
76
  }
104
77
  );
105
78
  ```
106
79
 
107
- Trailing configs have the highest precedence. `defineRules()` leaves the object unchanged and only adds exact type checking.
108
-
109
- ## TypeScript
80
+ Available factories:
110
81
 
111
- `createTypeScriptConfigs()`, Vue SFCs, and React TSX always use `strictTypeChecked` plus `stylisticTypeChecked` with:
82
+ - `createVueProjectConfigs(options, ...overrides)`
83
+ - `createUniAppProjectConfigs(options, ...overrides)`
84
+ - `createBaseConfigs(options)` for framework-neutral Node.js, SDK, and explicit composition
112
85
 
113
- ```js
114
- parserOptions: {
115
- projectService: true,
116
- extraFileExtensions: [".vue", ".nvue"],
117
- }
118
- ```
86
+ `environment` accepts `"browser"`, `"node"`, or `"universal"` and defaults to `"browser"`. Configuration, script, test, and CLI files always receive Node.js globals separately.
119
87
 
120
- Linted files must belong to a discoverable `tsconfig.json`. The same `extraFileExtensions` list is applied to TypeScript, TSX, Vue, and NVue files so Project Service does not reload the project while linting mixed file types. The `typeChecked` and `tsconfigRootDir` wrapper options have been removed. Complex monorepos can override `languageOptions.parserOptions` in a trailing Flat Config when necessary, but every type-aware file override in the same project must keep `extraFileExtensions` identical.
88
+ Trailing Flat Config objects have the highest precedence. `defineRules()` returns its input unchanged and only adds precise rule typing.
121
89
 
122
- Developers decide whether a Promise must be awaited, returned, or handled from the required ordering and error semantics. Therefore, `no-floating-promises` and `strict-void-return` are disabled, framework allowlists are unnecessary, and `void promise` is rejected. `no-misused-promises`, `await-thenable`, `require-await`, and the unsafe type rules remain strict, so invalid async callbacks, invalid `await` expressions, and `async` functions without asynchronous behavior are still reported.
90
+ ## TypeScript policy
123
91
 
124
- `return-await` keeps the strict preset's `error-handling-correctness-only` mode instead of forcing stylistic `await` expressions.
92
+ Type-aware files must belong to a `tsconfig.json` discoverable by Project Service.
125
93
 
126
- Named TypeScript and TSX functions and module boundaries require explicit types, while inline callbacks and already typed function expressions keep contextual inference. Vue/NVue SFCs disable function-return and module-boundary annotations and allow unused parameters in declarative callbacks such as `defineEmits` validators; unused variables and imports are still reported. Standalone SFC handler parameters that cannot be inferred back from templates still require explicit types.
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.
127
105
 
128
- Type-only exports use `export type`, and private members assigned only during construction use `readonly`. Primitive values retain the semantic choice between `||` and `??`, while public overloads with different parameter names or standalone JSDoc are preserved. Shared JavaScript rules reject `eval` and the `void` operator, require consistent braces for multiline branches, and place an existing `default` branch last.
106
+ ## JavaScript, Import, and Vue policy
129
107
 
130
- ## React
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.
131
117
 
132
- React projects compose from the framework-neutral base:
118
+ ## React and Angular
133
119
 
134
120
  ```js
135
121
  import { createBaseConfigs } from "@fast-china/eslint-config";
@@ -139,108 +125,46 @@ import { defineConfig } from "eslint/config";
139
125
  export default defineConfig([...createBaseConfigs(), ...createReactConfigs()]);
140
126
  ```
141
127
 
142
- The base provides the shared JavaScript, type-aware TypeScript, JSON, Import, RegExp, manifest sorting, and Prettier compatibility. The React fragment adds `@eslint-react`, the official Hooks Recommended preset, and DOM safety rules without loading Vue or UniApp globals.
143
-
144
- React-compatible runtimes can pass recognition settings:
145
-
146
- ```js
147
- export default defineConfig([...createBaseConfigs(), ...createReactConfigs({ importSource: "preact", version: "detect" })]);
148
- ```
149
-
150
- ## Angular
151
-
152
- ```js
153
- import { createBaseConfigs } from "@fast-china/eslint-config";
154
- import { createAngularConfigs } from "@fast-china/eslint-config/configs";
155
- import { defineConfig } from "eslint/config";
156
-
157
- export default defineConfig([...createBaseConfigs(), ...createAngularConfigs()]);
158
- ```
159
-
160
- The Angular fragment checks TypeScript source, external HTML templates, and component inline templates. Official template accessibility rules are enabled by default. Exceptional projects can still configure:
161
-
162
- ```js
163
- createAngularConfigs({
164
- inlineTemplates: false,
165
- templateAccessibility: false,
166
- });
167
- ```
168
-
169
- ## Node.js / SDK
170
-
171
- Projects that do not need Vue, UniApp, React, or Angular use the base directly:
172
-
173
- ```js
174
- import { createBaseConfigs } from "@fast-china/eslint-config";
175
-
176
- export default createBaseConfigs({ environment: "node" });
177
- ```
178
-
179
- `createBaseConfigs()` always enables JavaScript, type-aware TypeScript, JSON, Import, RegExp, manifest sorting, `.gitignore`, and Prettier compatibility, but does not claim framework files.
128
+ Angular composes `createAngularConfigs()` in the same way. The base configuration loads neither Vue nor UniApp.
180
129
 
181
- ## Markdown and Lodash
130
+ ## Optional capabilities and manifest sorting
182
131
 
183
- Markdown composes explicitly:
132
+ Markdown and Lodash import policy require explicit composition:
184
133
 
185
134
  ```js
186
135
  import { createBaseConfigs } from "@fast-china/eslint-config";
187
136
  import { createMarkdownConfigs } from "@fast-china/eslint-config/configs";
188
137
  import { defineConfig } from "eslint/config";
189
138
 
190
- export default defineConfig([...createBaseConfigs(), ...createMarkdownConfigs()]);
139
+ export default defineConfig([...createBaseConfigs({ environment: "node" }), ...createMarkdownConfigs()]);
191
140
  ```
192
141
 
193
- Lodash static-import policies are also standalone:
194
-
195
- ```js
196
- import { createLodashConfigs } from "@fast-china/eslint-config/configs";
197
-
198
- createLodashConfigs("lodash");
199
- createLodashConfigs("lodash-unified");
200
- ```
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.
201
143
 
202
144
  ## Public entries
203
145
 
204
- The root entry exports only:
205
-
206
- - The default Vue 3 + TypeScript + UniApp Flat Config.
207
- - `fastConfig`, `createBaseConfigs`, and `FastConfigOptions`.
208
- - `defineRules` and `RuleOptions`.
209
-
210
- Focused subpaths provide advanced composition:
211
-
212
- - `@fast-china/eslint-config/configs`: framework and capability fragments.
146
+ - `@fast-china/eslint-config`: named exports for both complete configurations, the project factories, `defineRules`, `ProjectConfigOptions`, and `RuleOptions`; no default export or legacy aliases are provided.
147
+ - `@fast-china/eslint-config/configs`: framework and optional feature fragments.
213
148
  - `@fast-china/eslint-config/constants`: file globs and UniApp globals.
214
149
  - `@fast-china/eslint-config/rules`: typed raw rule records.
215
150
 
216
151
  ## Prettier
217
152
 
218
- Prettier does not run as an ESLint rule. The default only loads `eslint-config-prettier` to disable conflicting rules. Install and run formatting separately:
219
-
220
- ```sh
221
- pnpm add -D prettier
222
- pnpm exec prettier --check .
223
- ```
153
+ Prettier does not run as an ESLint rule. The defaults only load `eslint-config-prettier` to disable conflicting rules; projects install and run Prettier separately.
224
154
 
225
155
  ## Documentation
226
156
 
157
+ - [Complete rule reference (Chinese)](./docs/rules/index.zh.md)
227
158
  - [Default rules and risk guide](./docs/rules-risk.md)
228
- - [Engineering quality audit](./docs/engineering-audit.zh.md)
229
- - [Contributing guide](./CONTRIBUTING.md)
230
- - [Security policy](./SECURITY.md)
159
+ - [Chinese engineering audit](./docs/engineering-audit.zh.md)
231
160
  - [Changelog](./CHANGELOG.md)
232
161
 
162
+ Each rule-reference category lists repository-explicit rules before third-party preset rules, and every rule includes direct incorrect and correct code examples.
163
+
233
164
  ## Development
234
165
 
235
166
  ```sh
236
167
  pnpm install --frozen-lockfile
237
168
  pnpm typegen
238
169
  pnpm check
239
- pnpm pack --dry-run
240
170
  ```
241
-
242
- Run `pnpm typegen` after upgrading ESLint or plugins and commit `src/typegen.d.ts`. `pnpm check` verifies types, builds, runtime behavior, package contracts, ESLint, and formatting.
243
-
244
- ## License
245
-
246
- [Apache-2.0](./LICENSE)