@fast-china/eslint-config 2.1.7 → 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.
- package/CHANGELOG.md +25 -0
- package/CONTRIBUTING.md +2 -2
- package/README.md +66 -142
- package/README.zh.md +64 -142
- package/dist/configs/environment.mjs +2 -0
- package/dist/configs/environment.mjs.map +1 -1
- package/dist/configs/ignores.mjs +0 -1
- package/dist/configs/ignores.mjs.map +1 -1
- package/dist/configs/import.mjs +4 -1
- package/dist/configs/import.mjs.map +1 -1
- package/dist/configs/index.d.mts +2 -2
- package/dist/configs/index.mjs +2 -2
- package/dist/configs/javascript.mjs +3 -1
- package/dist/configs/javascript.mjs.map +1 -1
- package/dist/configs/json.mjs +3 -1
- package/dist/configs/json.mjs.map +1 -1
- package/dist/configs/markdown.d.mts +2 -1
- package/dist/configs/markdown.mjs +4 -2
- package/dist/configs/markdown.mjs.map +1 -1
- package/dist/configs/prettier.mjs +1 -1
- package/dist/configs/prettier.mjs.map +1 -1
- package/dist/configs/sort-package.d.mts +1 -1
- package/dist/configs/sort-package.mjs +1 -1
- package/dist/configs/sort-package.mjs.map +1 -1
- package/dist/configs/sort-tsconfig.d.mts +2 -2
- package/dist/configs/sort-tsconfig.mjs +2 -2
- package/dist/configs/sort-tsconfig.mjs.map +1 -1
- package/dist/configs/typescript.d.mts +11 -7
- package/dist/configs/typescript.mjs +25 -22
- package/dist/configs/typescript.mjs.map +1 -1
- package/dist/configs/uniapp.mjs +19 -13
- package/dist/configs/uniapp.mjs.map +1 -1
- package/dist/configs/vue.d.mts +18 -3
- package/dist/configs/vue.mjs +59 -9
- package/dist/configs/vue.mjs.map +1 -1
- package/dist/constants/index.d.mts +4 -0
- package/dist/constants/index.mjs +5 -1
- package/dist/constants/index.mjs.map +1 -1
- package/dist/index.d.mts +37 -58
- package/dist/index.mjs +43 -47
- package/dist/index.mjs.map +1 -1
- package/dist/rules/angular.d.mts +28 -0
- package/dist/rules/angular.mjs +28 -0
- package/dist/rules/angular.mjs.map +1 -1
- package/dist/rules/common.d.mts +16 -6
- package/dist/rules/common.mjs +16 -13
- package/dist/rules/common.mjs.map +1 -1
- package/dist/rules/import.d.mts +9 -0
- package/dist/rules/import.mjs +24 -0
- package/dist/rules/import.mjs.map +1 -1
- package/dist/rules/index.d.mts +2 -2
- package/dist/rules/index.mjs +2 -2
- package/dist/rules/javascript.d.mts +18 -0
- package/dist/rules/javascript.mjs +18 -0
- package/dist/rules/javascript.mjs.map +1 -1
- package/dist/rules/lodash.d.mts +2 -0
- package/dist/rules/lodash.mjs +6 -2
- package/dist/rules/lodash.mjs.map +1 -1
- package/dist/rules/react.d.mts +13 -0
- package/dist/rules/react.mjs +13 -0
- package/dist/rules/react.mjs.map +1 -1
- package/dist/rules/regexp.d.mts +25 -0
- package/dist/rules/regexp.mjs +25 -0
- package/dist/rules/regexp.mjs.map +1 -1
- package/dist/rules/sort-package.d.mts +3 -1
- package/dist/rules/sort-package.mjs +3 -1
- package/dist/rules/sort-package.mjs.map +1 -1
- package/dist/rules/sort-tsconfig.d.mts +3 -1
- package/dist/rules/sort-tsconfig.mjs +3 -1
- package/dist/rules/sort-tsconfig.mjs.map +1 -1
- package/dist/rules/typescript.d.mts +81 -13
- package/dist/rules/typescript.mjs +83 -15
- package/dist/rules/typescript.mjs.map +1 -1
- package/dist/rules/vue.d.mts +65 -10
- package/dist/rules/vue.mjs +41 -14
- package/dist/rules/vue.mjs.map +1 -1
- package/docs/engineering-audit.zh.md +45 -49
- package/docs/rules/angular.zh.md +721 -0
- package/docs/rules/core.zh.md +3031 -0
- package/docs/rules/index.zh.md +38 -0
- package/docs/rules/json.zh.md +784 -0
- package/docs/rules/markdown.zh.md +449 -0
- package/docs/rules/react.zh.md +2091 -0
- package/docs/rules/typescript.zh.md +2051 -0
- package/docs/rules/vue.zh.md +3016 -0
- package/docs/rules-risk.md +85 -91
- package/docs/rules-risk.zh.md +76 -82
- package/package.json +4 -2
package/CHANGELOG.md
CHANGED
|
@@ -6,6 +6,31 @@ 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
|
+
|
|
9
34
|
## 2.1.7 - 2026-09-11
|
|
10
35
|
|
|
11
36
|
### 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
|
|
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
|
|
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,
|
|
11
|
+
A practical ESLint Flat Config for Vue 3, UniApp, SDKs, Node.js, React, Angular, TypeScript, and JavaScript projects.
|
|
12
12
|
|
|
13
|
-
|
|
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
|
-
##
|
|
15
|
+
## Highlights
|
|
16
16
|
|
|
17
|
-
-
|
|
18
|
-
-
|
|
19
|
-
- TypeScript
|
|
20
|
-
-
|
|
21
|
-
-
|
|
22
|
-
- React, Angular, Markdown, and Lodash
|
|
23
|
-
- Schema-generated `RuleOptions` provides
|
|
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
|
|
39
|
-
|
|
40
|
-
Create `eslint.config.mjs`:
|
|
35
|
+
## Vue 3
|
|
41
36
|
|
|
42
37
|
```js
|
|
43
|
-
import
|
|
38
|
+
import { vueConfig } from "@fast-china/eslint-config";
|
|
44
39
|
|
|
45
|
-
export default
|
|
40
|
+
export default vueConfig;
|
|
46
41
|
```
|
|
47
42
|
|
|
48
|
-
The
|
|
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
|
-
|
|
57
|
-
|
|
58
|
-
## `fastConfig()`
|
|
59
|
-
|
|
60
|
-
The root factory retains only `environment`, whose default is `"browser"`:
|
|
45
|
+
## UniApp
|
|
61
46
|
|
|
62
47
|
```js
|
|
63
|
-
import {
|
|
48
|
+
import { uniAppConfig } from "@fast-china/eslint-config";
|
|
64
49
|
|
|
65
|
-
export default
|
|
66
|
-
environment: "universal",
|
|
67
|
-
});
|
|
50
|
+
export default uniAppConfig;
|
|
68
51
|
```
|
|
69
52
|
|
|
70
|
-
|
|
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
|
-
|
|
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
|
-
##
|
|
57
|
+
## Factories and project overrides
|
|
79
58
|
|
|
80
|
-
|
|
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 {
|
|
62
|
+
import { createVueProjectConfigs, defineRules } from "@fast-china/eslint-config";
|
|
84
63
|
|
|
85
|
-
export default
|
|
86
|
-
{ environment: "
|
|
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
|
-
|
|
108
|
-
|
|
109
|
-
## TypeScript
|
|
80
|
+
Available factories:
|
|
110
81
|
|
|
111
|
-
`
|
|
82
|
+
- `createVueProjectConfigs(options, ...overrides)`
|
|
83
|
+
- `createUniAppProjectConfigs(options, ...overrides)`
|
|
84
|
+
- `createBaseConfigs(options)` for framework-neutral Node.js, SDK, and explicit composition
|
|
112
85
|
|
|
113
|
-
|
|
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
|
-
|
|
88
|
+
Trailing Flat Config objects have the highest precedence. `defineRules()` returns its input unchanged and only adds precise rule typing.
|
|
121
89
|
|
|
122
|
-
|
|
90
|
+
## TypeScript policy
|
|
123
91
|
|
|
124
|
-
|
|
92
|
+
Type-aware files must belong to a `tsconfig.json` discoverable by Project Service.
|
|
125
93
|
|
|
126
|
-
|
|
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
|
-
|
|
106
|
+
## JavaScript, Import, and Vue policy
|
|
129
107
|
|
|
130
|
-
|
|
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
|
|
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
|
-
|
|
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
|
-
##
|
|
130
|
+
## Optional capabilities and manifest sorting
|
|
182
131
|
|
|
183
|
-
Markdown
|
|
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
|
-
|
|
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
|
-
|
|
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
|
|
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
|
-
- [
|
|
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)
|