@fast-china/eslint-config 1.1.0 → 2.0.1
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 +40 -0
- package/README.md +158 -83
- package/README.zh.md +159 -84
- package/dist/{define-rules-CSwQ8C1q.d.ts → define-rules.d.mts} +6010 -4651
- package/dist/define-rules.d.mts.map +1 -0
- package/dist/index.d.mts +181 -0
- package/dist/index.d.mts.map +1 -0
- package/dist/index.mjs +475 -0
- package/dist/index.mjs.map +1 -0
- package/dist/rules/index.d.mts +309 -0
- package/dist/rules/index.d.mts.map +1 -0
- package/dist/rules/index.mjs +2 -0
- package/dist/rules.mjs +485 -0
- package/dist/rules.mjs.map +1 -0
- package/docs/engineering-audit.zh.md +77 -82
- package/docs/rules-risk.md +40 -45
- package/docs/rules-risk.zh.md +41 -46
- package/package.json +26 -18
- package/dist/index.d.ts +0 -259
- package/dist/index.js +0 -786
- package/dist/index.js.map +0 -1
- package/dist/rules/index.d.ts +0 -229
- package/dist/rules/index.js +0 -486
- package/dist/rules/index.js.map +0 -1
package/package.json
CHANGED
|
@@ -1,14 +1,15 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fast-china/eslint-config",
|
|
3
|
-
"version": "
|
|
4
|
-
"
|
|
5
|
-
"description": "A practical ESLint Flat Config for Vue 3, TypeScript, Vite, and JavaScript projects.",
|
|
3
|
+
"version": "2.0.1",
|
|
4
|
+
"description": "Opinionated, typed ESLint Flat Config for Vue 3, React, Angular, Vite, TypeScript, JavaScript, and Node.js.",
|
|
6
5
|
"type": "module",
|
|
7
6
|
"keywords": [
|
|
8
7
|
"fast",
|
|
8
|
+
"angular",
|
|
9
9
|
"eslint",
|
|
10
10
|
"eslint-config",
|
|
11
11
|
"flat-config",
|
|
12
|
+
"react",
|
|
12
13
|
"typescript",
|
|
13
14
|
"vite",
|
|
14
15
|
"vue",
|
|
@@ -25,6 +26,7 @@
|
|
|
25
26
|
},
|
|
26
27
|
"author": "小方",
|
|
27
28
|
"files": [
|
|
29
|
+
"CHANGELOG.md",
|
|
28
30
|
"Fast.png",
|
|
29
31
|
"LICENSE",
|
|
30
32
|
"README.md",
|
|
@@ -32,19 +34,19 @@
|
|
|
32
34
|
"dist",
|
|
33
35
|
"docs"
|
|
34
36
|
],
|
|
35
|
-
"main": "./dist/index.
|
|
36
|
-
"module": "./dist/index.
|
|
37
|
-
"types": "./dist/index.d.
|
|
37
|
+
"main": "./dist/index.mjs",
|
|
38
|
+
"module": "./dist/index.mjs",
|
|
39
|
+
"types": "./dist/index.d.mts",
|
|
38
40
|
"exports": {
|
|
39
41
|
".": {
|
|
40
|
-
"types": "./dist/index.d.
|
|
41
|
-
"import": "./dist/index.
|
|
42
|
-
"default": "./dist/index.
|
|
42
|
+
"types": "./dist/index.d.mts",
|
|
43
|
+
"import": "./dist/index.mjs",
|
|
44
|
+
"default": "./dist/index.mjs"
|
|
43
45
|
},
|
|
44
46
|
"./rules": {
|
|
45
|
-
"types": "./dist/rules/index.d.
|
|
46
|
-
"import": "./dist/rules/index.
|
|
47
|
-
"default": "./dist/rules/index.
|
|
47
|
+
"types": "./dist/rules/index.d.mts",
|
|
48
|
+
"import": "./dist/rules/index.mjs",
|
|
49
|
+
"default": "./dist/rules/index.mjs"
|
|
48
50
|
},
|
|
49
51
|
"./package.json": "./package.json"
|
|
50
52
|
},
|
|
@@ -54,7 +56,7 @@
|
|
|
54
56
|
},
|
|
55
57
|
"scripts": {
|
|
56
58
|
"dev": "eslint-config-inspector --config src/eslint-inspector.config.ts",
|
|
57
|
-
"build": "pnpm run typegen:check &&
|
|
59
|
+
"build": "pnpm run typegen:check && tsdown",
|
|
58
60
|
"build:inspector": "eslint-config-inspector build --config src/eslint-inspector.config.ts",
|
|
59
61
|
"typegen": "tsx scripts/typegen.ts",
|
|
60
62
|
"typegen:check": "tsx scripts/typegen.ts --check",
|
|
@@ -70,15 +72,20 @@
|
|
|
70
72
|
},
|
|
71
73
|
"peerDependencies": {
|
|
72
74
|
"eslint": "^10.0.0",
|
|
73
|
-
"typescript": ">=
|
|
75
|
+
"typescript": ">=6.0.0 <6.1.0"
|
|
74
76
|
},
|
|
75
77
|
"dependencies": {
|
|
78
|
+
"@angular-eslint/eslint-plugin": "^22.1.0",
|
|
79
|
+
"@angular-eslint/eslint-plugin-template": "^22.1.0",
|
|
80
|
+
"@angular-eslint/template-parser": "^22.1.0",
|
|
81
|
+
"@eslint-react/eslint-plugin": "^5.18.0",
|
|
76
82
|
"@eslint/js": "^10.0.0",
|
|
77
83
|
"@eslint/markdown": "^8.0.3",
|
|
78
84
|
"eslint-config-flat-gitignore": "^2.0.0",
|
|
79
85
|
"eslint-config-prettier": "^10.0.0",
|
|
80
86
|
"eslint-plugin-import-x": "^4.17.1",
|
|
81
87
|
"eslint-plugin-jsonc": "^3.3.0",
|
|
88
|
+
"eslint-plugin-react-hooks": "^7.1.1",
|
|
82
89
|
"eslint-plugin-regexp": "^3.1.1",
|
|
83
90
|
"eslint-plugin-vue": "^10.10.0",
|
|
84
91
|
"globals": "^17.7.0",
|
|
@@ -88,14 +95,15 @@
|
|
|
88
95
|
"devDependencies": {
|
|
89
96
|
"@eslint/config-inspector": "^3.1.0",
|
|
90
97
|
"@types/node": "^24.13.3",
|
|
91
|
-
"eslint": "^10.
|
|
98
|
+
"eslint": "^10.8.0",
|
|
92
99
|
"eslint-typegen": "^2.3.1",
|
|
93
100
|
"prettier": "^3.9.6",
|
|
94
|
-
"
|
|
101
|
+
"tsdown": "^0.22.14",
|
|
95
102
|
"tsx": "^4.23.1",
|
|
96
|
-
"typescript": "^
|
|
103
|
+
"typescript": "^6.0.3"
|
|
97
104
|
},
|
|
98
105
|
"engines": {
|
|
99
|
-
"node": "^
|
|
106
|
+
"node": "^22.18.0 || >=24.11.0",
|
|
107
|
+
"pnpm": "^11.0.0"
|
|
100
108
|
}
|
|
101
109
|
}
|
package/dist/index.d.ts
DELETED
|
@@ -1,259 +0,0 @@
|
|
|
1
|
-
import * as eslint_config from 'eslint/config';
|
|
2
|
-
export { R as RuleOptions, d as defineRules } from './define-rules-CSwQ8C1q.js';
|
|
3
|
-
import 'eslint';
|
|
4
|
-
|
|
5
|
-
/**
|
|
6
|
-
* 公共配置
|
|
7
|
-
* @description 最佳实践
|
|
8
|
-
*/
|
|
9
|
-
declare const createCommonConfigs: (files?: readonly string[]) => eslint_config.Config[];
|
|
10
|
-
declare const commonConfigs: eslint_config.Config[];
|
|
11
|
-
|
|
12
|
-
type RuntimeEnvironment = "browser" | "node" | "universal";
|
|
13
|
-
/**
|
|
14
|
-
* 创建运行时环境相关的 ESLint 配置。
|
|
15
|
-
*
|
|
16
|
-
* 用于为应用源码配置对应运行环境的全局变量,
|
|
17
|
-
* 同时为 Node.js 工程脚本单独启用 Node.js 全局变量。
|
|
18
|
-
*
|
|
19
|
-
* @param environment 运行时环境,默认为浏览器环境
|
|
20
|
-
* @param files 应用源码匹配规则,默认为所有代码文件
|
|
21
|
-
* @returns ESLint Flat Config 配置数组
|
|
22
|
-
*/
|
|
23
|
-
declare const createEnvironmentConfigs: (environment?: RuntimeEnvironment, files?: readonly string[]) => eslint_config.Config[];
|
|
24
|
-
/**
|
|
25
|
-
* 浏览器应用环境配置。
|
|
26
|
-
*
|
|
27
|
-
* 适用于普通 Vue、React 等浏览器端项目。
|
|
28
|
-
*/
|
|
29
|
-
declare const browserConfigs: eslint_config.Config[];
|
|
30
|
-
/**
|
|
31
|
-
* Node.js 应用环境配置。
|
|
32
|
-
*
|
|
33
|
-
* 适用于 Node.js 服务、CLI 工具等项目。
|
|
34
|
-
*/
|
|
35
|
-
declare const nodeConfigs: eslint_config.Config[];
|
|
36
|
-
/**
|
|
37
|
-
* 通用运行环境配置。
|
|
38
|
-
*
|
|
39
|
-
* 同时启用浏览器和 Node.js 全局变量,
|
|
40
|
-
* 适用于 SSR、同构应用或跨运行时共享代码。
|
|
41
|
-
*/
|
|
42
|
-
declare const universalConfigs: eslint_config.Config[];
|
|
43
|
-
|
|
44
|
-
/**
|
|
45
|
-
* 忽略配置
|
|
46
|
-
*/
|
|
47
|
-
declare const globalIgnoresConfigs: eslint_config.Config[];
|
|
48
|
-
declare const gitignoreConfigs: eslint_config.Config[];
|
|
49
|
-
declare const ignoresConfigs: eslint_config.Config[];
|
|
50
|
-
|
|
51
|
-
/**
|
|
52
|
-
* import配置
|
|
53
|
-
*/
|
|
54
|
-
declare const createImportConfigs: (files?: readonly string[]) => eslint_config.Config[];
|
|
55
|
-
declare const importConfigs: eslint_config.Config[];
|
|
56
|
-
|
|
57
|
-
/**
|
|
58
|
-
* JavaScript配置
|
|
59
|
-
*/
|
|
60
|
-
declare const javascriptConfigs: eslint_config.Config[];
|
|
61
|
-
|
|
62
|
-
/**
|
|
63
|
-
* Json配置
|
|
64
|
-
*/
|
|
65
|
-
declare const jsonConfigs: eslint_config.Config[];
|
|
66
|
-
|
|
67
|
-
/**
|
|
68
|
-
* markdown配置
|
|
69
|
-
*/
|
|
70
|
-
declare const markdownConfigs: eslint_config.Config[];
|
|
71
|
-
|
|
72
|
-
/**
|
|
73
|
-
* prettier配置
|
|
74
|
-
*/
|
|
75
|
-
declare const prettierConfigs: eslint_config.Config[];
|
|
76
|
-
|
|
77
|
-
/**
|
|
78
|
-
* regexp配置
|
|
79
|
-
*/
|
|
80
|
-
declare const createRegexpConfigs: (files?: readonly string[]) => eslint_config.Config[];
|
|
81
|
-
declare const regexpConfigs: eslint_config.Config[];
|
|
82
|
-
|
|
83
|
-
/**
|
|
84
|
-
* package.json 属性排序
|
|
85
|
-
*/
|
|
86
|
-
declare const packageJsonSortConfigs: eslint_config.Config[];
|
|
87
|
-
|
|
88
|
-
/**
|
|
89
|
-
* tsconfig.json 属性排序
|
|
90
|
-
*/
|
|
91
|
-
declare const tsconfigJsonSortConfigs: eslint_config.Config[];
|
|
92
|
-
|
|
93
|
-
interface TypeScriptConfigOptions {
|
|
94
|
-
typeChecked?: boolean;
|
|
95
|
-
}
|
|
96
|
-
/**
|
|
97
|
-
* TypeScript 核心配置
|
|
98
|
-
*/
|
|
99
|
-
declare const createTypeScriptCoreConfigs: ({ typeChecked }?: TypeScriptConfigOptions) => eslint_config.Config[];
|
|
100
|
-
declare const typescriptCoreConfigs: eslint_config.Config[];
|
|
101
|
-
/**
|
|
102
|
-
* TypeScript配置
|
|
103
|
-
*/
|
|
104
|
-
declare const createTypeScriptConfigs: (options?: TypeScriptConfigOptions) => eslint_config.Config[];
|
|
105
|
-
declare const typescriptConfigs: eslint_config.Config[];
|
|
106
|
-
declare const typescriptTypeCheckedConfigs: eslint_config.Config[];
|
|
107
|
-
|
|
108
|
-
interface VueConfigOptions {
|
|
109
|
-
typeChecked?: boolean;
|
|
110
|
-
version?: 2 | 3;
|
|
111
|
-
}
|
|
112
|
-
/**
|
|
113
|
-
* vue配置
|
|
114
|
-
*/
|
|
115
|
-
declare const createVueConfigs: ({ typeChecked, version }?: VueConfigOptions) => eslint_config.Config[];
|
|
116
|
-
declare const vueConfigs: eslint_config.Config[];
|
|
117
|
-
declare const vue2Configs: eslint_config.Config[];
|
|
118
|
-
declare const vueTypeCheckedConfigs: eslint_config.Config[];
|
|
119
|
-
|
|
120
|
-
/**
|
|
121
|
-
* JS
|
|
122
|
-
*/
|
|
123
|
-
declare const CONST_JS = "**/*.?([cm])js";
|
|
124
|
-
/**
|
|
125
|
-
* JSX
|
|
126
|
-
*/
|
|
127
|
-
declare const CONST_JSX = "**/*.?([cm])jsx";
|
|
128
|
-
/**
|
|
129
|
-
* TS
|
|
130
|
-
*/
|
|
131
|
-
declare const CONST_TS = "**/*.?([cm])ts";
|
|
132
|
-
/**
|
|
133
|
-
* TSX
|
|
134
|
-
*/
|
|
135
|
-
declare const CONST_TSX = "**/*.?([cm])tsx";
|
|
136
|
-
/**
|
|
137
|
-
* .d.ts
|
|
138
|
-
*/
|
|
139
|
-
declare const CONST_DTS = "**/*.d.ts";
|
|
140
|
-
/**
|
|
141
|
-
* JSON
|
|
142
|
-
*/
|
|
143
|
-
declare const CONST_JSON = "**/*.json";
|
|
144
|
-
/**
|
|
145
|
-
* JSONC
|
|
146
|
-
*/
|
|
147
|
-
declare const CONST_JSONC = "**/*.jsonc";
|
|
148
|
-
/**
|
|
149
|
-
* JSON5
|
|
150
|
-
*/
|
|
151
|
-
declare const CONST_JSON5 = "**/*.json5";
|
|
152
|
-
/**
|
|
153
|
-
* MD
|
|
154
|
-
*/
|
|
155
|
-
declare const CONST_MD = "**/*.md";
|
|
156
|
-
/**
|
|
157
|
-
* VUE
|
|
158
|
-
*/
|
|
159
|
-
declare const CONST_VUE = "**/*.vue";
|
|
160
|
-
/**
|
|
161
|
-
* YAML
|
|
162
|
-
*/
|
|
163
|
-
declare const CONST_YAML = "**/*.y?(a)ml";
|
|
164
|
-
/**
|
|
165
|
-
* node_modules
|
|
166
|
-
*/
|
|
167
|
-
declare const CONST_NODE_MODULES = "**/node_modules/**";
|
|
168
|
-
/**
|
|
169
|
-
* 打包目录 dist
|
|
170
|
-
*/
|
|
171
|
-
declare const CONST_DIST = "**/dist/**";
|
|
172
|
-
/**
|
|
173
|
-
* 包管理 lock 文件
|
|
174
|
-
*/
|
|
175
|
-
declare const CONST_LOCKFILE: string[];
|
|
176
|
-
/**
|
|
177
|
-
* public
|
|
178
|
-
*/
|
|
179
|
-
declare const CONST_PUBLIC = "**/public";
|
|
180
|
-
/**
|
|
181
|
-
* TS 配置文件
|
|
182
|
-
*/
|
|
183
|
-
declare const CONST_TSCONFIG: string[];
|
|
184
|
-
/** JavaScript 文件 */
|
|
185
|
-
declare const GLOB_JAVASCRIPT: readonly ["**/*.?([cm])js", "**/*.?([cm])jsx"];
|
|
186
|
-
/** TypeScript 文件 */
|
|
187
|
-
declare const GLOB_TYPESCRIPT: readonly ["**/*.?([cm])ts", "**/*.?([cm])tsx"];
|
|
188
|
-
/** ESLint 可处理的源码文件 */
|
|
189
|
-
declare const GLOB_CODE: readonly ["**/*.?([cm])js", "**/*.?([cm])jsx", "**/*.?([cm])ts", "**/*.?([cm])tsx", "**/*.vue"];
|
|
190
|
-
/** 默认按 Node.js 环境处理的工程文件 */
|
|
191
|
-
declare const GLOB_NODE: readonly ["**/*.{config,setup}.{js,cjs,mjs,ts,cts,mts}", "**/{scripts,bin}/**/*.{js,cjs,mjs,ts,cts,mts}", "**/{test,tests}/**/*.{js,cjs,mjs,ts,cts,mts}", "**/cli.{js,cjs,mjs,ts,cts,mts}"];
|
|
192
|
-
|
|
193
|
-
interface FastConfigOptions {
|
|
194
|
-
/** 运行时全局变量。Vue/Vite 应用通常使用 browser。 */
|
|
195
|
-
environment?: RuntimeEnvironment;
|
|
196
|
-
/** 是否读取项目根目录的 .gitignore。 */
|
|
197
|
-
gitignore?: boolean;
|
|
198
|
-
/** 额外的全局忽略模式。 */
|
|
199
|
-
ignores?: string[];
|
|
200
|
-
/** 是否启用 import-x 规则。 */
|
|
201
|
-
imports?: boolean;
|
|
202
|
-
/** 是否启用 JSON、JSONC、JSON5 规则及常用清单排序。 */
|
|
203
|
-
json?: boolean;
|
|
204
|
-
/** 是否启用 Markdown 规则。 */
|
|
205
|
-
markdown?: boolean;
|
|
206
|
-
/** 是否在末尾关闭与 Prettier 冲突的格式规则。 */
|
|
207
|
-
prettier?: boolean;
|
|
208
|
-
/** 是否启用正则表达式规则。 */
|
|
209
|
-
regexp?: boolean;
|
|
210
|
-
/** TypeScript 支持;传入对象可开启类型感知规则。 */
|
|
211
|
-
typescript?: boolean | TypeScriptConfigOptions;
|
|
212
|
-
/** Vue 支持;默认 Vue 3,也可显式选择 Vue 2。 */
|
|
213
|
-
vue?: boolean | 2 | 3 | VueConfigOptions;
|
|
214
|
-
}
|
|
215
|
-
declare const defaultOptions: Readonly<{
|
|
216
|
-
environment: "browser";
|
|
217
|
-
gitignore: true;
|
|
218
|
-
imports: true;
|
|
219
|
-
json: true;
|
|
220
|
-
markdown: true;
|
|
221
|
-
prettier: true;
|
|
222
|
-
regexp: true;
|
|
223
|
-
typescript: true;
|
|
224
|
-
vue: 3;
|
|
225
|
-
}>;
|
|
226
|
-
/**
|
|
227
|
-
* 创建可组合的 ESLint Flat Config。
|
|
228
|
-
*
|
|
229
|
-
* 返回普通配置数组,可直接展开,也可继续通过 defineConfig 追加项目规则。
|
|
230
|
-
*/
|
|
231
|
-
declare const createConfig: (options?: FastConfigOptions) => eslint_config.Config[];
|
|
232
|
-
|
|
233
|
-
/**
|
|
234
|
-
* JavaScript 预置配置
|
|
235
|
-
*
|
|
236
|
-
* @description ignores,common,javascript,import,regexp
|
|
237
|
-
*/
|
|
238
|
-
declare const PresetJavascriptConfigs: eslint_config.Config[];
|
|
239
|
-
/**
|
|
240
|
-
* JSON 预置配置
|
|
241
|
-
*/
|
|
242
|
-
declare const PresetJsonConfigs: eslint_config.Config[];
|
|
243
|
-
/**
|
|
244
|
-
* TypeScript 预置配置(不包含 Vue、JSON 和 Markdown)。
|
|
245
|
-
*/
|
|
246
|
-
declare const PresetTypescriptConfigs: eslint_config.Config[];
|
|
247
|
-
declare const PresetTypeScriptConfigs: eslint_config.Config[];
|
|
248
|
-
/**
|
|
249
|
-
* 基础预置配置
|
|
250
|
-
*
|
|
251
|
-
* @description javascript,typescript,json
|
|
252
|
-
*/
|
|
253
|
-
declare const PresetBasicConfigs: eslint_config.Config[];
|
|
254
|
-
/**
|
|
255
|
-
* Vue 3 + TypeScript 完整预置配置。
|
|
256
|
-
*/
|
|
257
|
-
declare const PresetVueConfigs: eslint_config.Config[];
|
|
258
|
-
|
|
259
|
-
export { CONST_DIST, CONST_DTS, CONST_JS, CONST_JSON, CONST_JSON5, CONST_JSONC, CONST_JSX, CONST_LOCKFILE, CONST_MD, CONST_NODE_MODULES, CONST_PUBLIC, CONST_TS, CONST_TSCONFIG, CONST_TSX, CONST_VUE, CONST_YAML, type FastConfigOptions, GLOB_CODE, GLOB_JAVASCRIPT, GLOB_NODE, GLOB_TYPESCRIPT, PresetBasicConfigs, PresetJavascriptConfigs, PresetJsonConfigs, PresetTypeScriptConfigs, PresetTypescriptConfigs, PresetVueConfigs, type RuntimeEnvironment, type TypeScriptConfigOptions, type VueConfigOptions, browserConfigs, commonConfigs, createCommonConfigs, createConfig, createEnvironmentConfigs, createImportConfigs, createRegexpConfigs, createTypeScriptConfigs, createTypeScriptCoreConfigs, createVueConfigs, PresetVueConfigs as default, defaultOptions, gitignoreConfigs, globalIgnoresConfigs, ignoresConfigs, importConfigs, javascriptConfigs, jsonConfigs, markdownConfigs, nodeConfigs, packageJsonSortConfigs, prettierConfigs, regexpConfigs, tsconfigJsonSortConfigs, typescriptConfigs, typescriptCoreConfigs, typescriptTypeCheckedConfigs, universalConfigs, vue2Configs, vueConfigs, vueTypeCheckedConfigs };
|