@fast-china/eslint-config 1.0.48 → 2.0.0
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/README.md +196 -61
- package/README.zh.md +196 -61
- package/dist/{typegen.d.ts → define-rules-CSwQ8C1q.d.ts} +5577 -2499
- package/dist/index.d.ts +126 -147
- package/dist/index.js +407 -575
- package/dist/index.js.map +1 -1
- package/dist/rules/index.d.ts +211 -24
- package/dist/rules/index.js +171 -267
- package/dist/rules/index.js.map +1 -1
- package/docs/engineering-audit.zh.md +96 -0
- package/docs/rules-risk.md +99 -0
- package/docs/rules-risk.zh.md +103 -0
- package/package.json +61 -46
package/dist/index.d.ts
CHANGED
|
@@ -1,154 +1,133 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { R as RuleOptions } from './define-rules-CSwQ8C1q.js';
|
|
2
|
+
export { d as defineRules } from './define-rules-CSwQ8C1q.js';
|
|
3
|
+
import { Config } from 'eslint/config';
|
|
4
|
+
import { Linter } from 'eslint';
|
|
2
5
|
|
|
3
|
-
|
|
4
|
-
* 公共配置
|
|
5
|
-
* @description 最佳实践
|
|
6
|
-
*/
|
|
7
|
-
declare const commonConfigs: eslint_config.Config[];
|
|
8
|
-
|
|
9
|
-
/**
|
|
10
|
-
* 忽略配置
|
|
11
|
-
*/
|
|
12
|
-
declare const ignoresConfigs: eslint_config.Config[];
|
|
13
|
-
|
|
14
|
-
/**
|
|
15
|
-
* import配置
|
|
16
|
-
*/
|
|
17
|
-
declare const importConfigs: eslint_config.Config[];
|
|
18
|
-
|
|
19
|
-
/**
|
|
20
|
-
* JavaScript配置
|
|
21
|
-
*/
|
|
22
|
-
declare const javascriptConfigs: eslint_config.Config[];
|
|
23
|
-
|
|
24
|
-
/**
|
|
25
|
-
* Json配置
|
|
26
|
-
*/
|
|
27
|
-
declare const jsonConfigs: eslint_config.Config[];
|
|
28
|
-
|
|
29
|
-
/**
|
|
30
|
-
* markdown配置
|
|
31
|
-
*/
|
|
32
|
-
declare const markdownConfigs: eslint_config.Config[];
|
|
33
|
-
|
|
34
|
-
/**
|
|
35
|
-
* prettier配置
|
|
36
|
-
*/
|
|
37
|
-
declare const prettierConfigs: eslint_config.Config[];
|
|
38
|
-
|
|
39
|
-
/**
|
|
40
|
-
* regexp配置
|
|
41
|
-
*/
|
|
42
|
-
declare const regexpConfigs: eslint_config.Config[];
|
|
43
|
-
|
|
44
|
-
/**
|
|
45
|
-
* package.json 属性排序
|
|
46
|
-
*/
|
|
47
|
-
declare const packageJsonSortConfigs: eslint_config.Config[];
|
|
6
|
+
type RuntimeEnvironment = "browser" | "node" | "universal";
|
|
48
7
|
|
|
49
|
-
/**
|
|
50
|
-
|
|
51
|
-
*/
|
|
52
|
-
declare const tsconfigJsonSortConfigs: eslint_config.Config[];
|
|
8
|
+
/** 项目允许使用的 Lodash 导入来源。 */
|
|
9
|
+
type LodashPreference = "lodash" | "lodash-unified";
|
|
53
10
|
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
* JS
|
|
70
|
-
*/
|
|
71
|
-
declare const CONST_JS = "**/*.?([cm])js";
|
|
72
|
-
/**
|
|
73
|
-
* JSX
|
|
74
|
-
*/
|
|
75
|
-
declare const CONST_JSX = "**/*.?([cm])jsx";
|
|
76
|
-
/**
|
|
77
|
-
* TS
|
|
78
|
-
*/
|
|
79
|
-
declare const CONST_TS = "**/*.?([cm])ts";
|
|
80
|
-
/**
|
|
81
|
-
* TSX
|
|
82
|
-
*/
|
|
83
|
-
declare const CONST_TSX = "**/*.?([cm])tsx";
|
|
84
|
-
/**
|
|
85
|
-
* .d.ts
|
|
86
|
-
*/
|
|
87
|
-
declare const CONST_DTS = "**/*.d.ts";
|
|
88
|
-
/**
|
|
89
|
-
* JSON
|
|
90
|
-
*/
|
|
91
|
-
declare const CONST_JSON = "**/*.json";
|
|
92
|
-
/**
|
|
93
|
-
* JSONC
|
|
94
|
-
*/
|
|
95
|
-
declare const CONST_JSONC = "**/*.jsonc";
|
|
96
|
-
/**
|
|
97
|
-
* JSON5
|
|
98
|
-
*/
|
|
99
|
-
declare const CONST_JSON5 = "**/*.json5";
|
|
100
|
-
/**
|
|
101
|
-
* MD
|
|
102
|
-
*/
|
|
103
|
-
declare const CONST_MD = "**/*.md";
|
|
104
|
-
/**
|
|
105
|
-
* VUE
|
|
106
|
-
*/
|
|
107
|
-
declare const CONST_VUE = "**/*.vue";
|
|
108
|
-
/**
|
|
109
|
-
* YAML
|
|
110
|
-
*/
|
|
111
|
-
declare const CONST_YAML = "**/*.y?(a)ml";
|
|
112
|
-
/**
|
|
113
|
-
* node_modules
|
|
114
|
-
*/
|
|
115
|
-
declare const CONST_NODE_MODULES = "**/node_modules";
|
|
116
|
-
/**
|
|
117
|
-
* 打包目录 dist
|
|
118
|
-
*/
|
|
119
|
-
declare const CONST_DIST = "**/dist";
|
|
120
|
-
/**
|
|
121
|
-
* 包管理 lock 文件
|
|
122
|
-
*/
|
|
123
|
-
declare const CONST_LOCKFILE: string[];
|
|
124
|
-
/**
|
|
125
|
-
* public
|
|
126
|
-
*/
|
|
127
|
-
declare const CONST_PUBLIC = "**/public";
|
|
128
|
-
/**
|
|
129
|
-
* TS 配置文件
|
|
130
|
-
*/
|
|
131
|
-
declare const CONST_TSCONFIG: string[];
|
|
11
|
+
interface TypeScriptConfigOptions {
|
|
12
|
+
/**
|
|
13
|
+
* 是否启用依赖 TypeScript 类型信息的规则;开启后会增加启动和检查成本。
|
|
14
|
+
* @default false
|
|
15
|
+
*/
|
|
16
|
+
typeChecked?: boolean;
|
|
17
|
+
/**
|
|
18
|
+
* 查找 tsconfig.json 的根目录。
|
|
19
|
+
*
|
|
20
|
+
* typescript-eslint 通常可从 `eslint.config.*` 调用栈推断;复杂 monorepo 可显式传入
|
|
21
|
+
* `import.meta.dirname`,避免从错误目录启动 Project Service。
|
|
22
|
+
* @default undefined
|
|
23
|
+
*/
|
|
24
|
+
tsconfigRootDir?: string;
|
|
25
|
+
}
|
|
132
26
|
|
|
133
|
-
|
|
134
|
-
|
|
27
|
+
interface FastConfigOptions {
|
|
28
|
+
/**
|
|
29
|
+
* 应用代码的运行环境;Vue/Vite 项目通常使用 `browser`。
|
|
30
|
+
* @default "browser"
|
|
31
|
+
*/
|
|
32
|
+
environment?: RuntimeEnvironment;
|
|
33
|
+
/**
|
|
34
|
+
* 项目额外提供的全局变量,例如测试运行器或宿主平台 API。
|
|
35
|
+
* @default undefined
|
|
36
|
+
*/
|
|
37
|
+
globals?: Linter.Globals;
|
|
38
|
+
/**
|
|
39
|
+
* 是否读取项目根目录的 .gitignore。
|
|
40
|
+
* @default true
|
|
41
|
+
*/
|
|
42
|
+
gitignore?: boolean;
|
|
43
|
+
/**
|
|
44
|
+
* 追加到内置集合的全局忽略模式。
|
|
45
|
+
* @default []
|
|
46
|
+
*/
|
|
47
|
+
ignores?: readonly string[];
|
|
48
|
+
/**
|
|
49
|
+
* 是否启用 import-x 规则。
|
|
50
|
+
* @default true
|
|
51
|
+
*/
|
|
52
|
+
imports?: boolean;
|
|
53
|
+
/**
|
|
54
|
+
* 是否处理 JavaScript 与 JSX 文件。
|
|
55
|
+
* @default true
|
|
56
|
+
*/
|
|
57
|
+
javascript?: boolean;
|
|
58
|
+
/**
|
|
59
|
+
* 是否启用 JSON、JSONC 与 JSON5 推荐规则;清单排序由独立选项控制。
|
|
60
|
+
* @default true
|
|
61
|
+
*/
|
|
62
|
+
json?: boolean;
|
|
63
|
+
/**
|
|
64
|
+
* 统一项目使用的 Lodash 包;`false` 表示不限制 `lodash`、`lodash-es` 或 `lodash-unified`。
|
|
65
|
+
* @default false
|
|
66
|
+
*/
|
|
67
|
+
lodash?: false | LodashPreference;
|
|
68
|
+
/**
|
|
69
|
+
* 是否启用 Markdown 规则。
|
|
70
|
+
* @default true
|
|
71
|
+
*/
|
|
72
|
+
markdown?: boolean;
|
|
73
|
+
/**
|
|
74
|
+
* 是否在末尾关闭与 Prettier 冲突的格式规则。
|
|
75
|
+
* @default true
|
|
76
|
+
*/
|
|
77
|
+
prettier?: boolean;
|
|
78
|
+
/**
|
|
79
|
+
* 是否启用正则表达式规则。
|
|
80
|
+
* @default true
|
|
81
|
+
*/
|
|
82
|
+
regexp?: boolean;
|
|
83
|
+
/**
|
|
84
|
+
* 应用于全部已启用代码文件的项目级规则,提供精确规则名与选项类型。
|
|
85
|
+
* @default undefined
|
|
86
|
+
*/
|
|
87
|
+
rules?: RuleOptions;
|
|
88
|
+
/**
|
|
89
|
+
* 是否按安全的固定顺序整理 package.json;启用后首次运行可能产生较大 diff。
|
|
90
|
+
* @default false
|
|
91
|
+
*/
|
|
92
|
+
sortPackageJson?: boolean;
|
|
93
|
+
/**
|
|
94
|
+
* 是否按 TypeScript 文档主题整理 tsconfig*.json。
|
|
95
|
+
* @default false
|
|
96
|
+
*/
|
|
97
|
+
sortTsconfig?: boolean;
|
|
98
|
+
/**
|
|
99
|
+
* TypeScript 支持;传入对象可开启类型感知规则。
|
|
100
|
+
* @default true
|
|
101
|
+
*/
|
|
102
|
+
typescript?: boolean | TypeScriptConfigOptions;
|
|
103
|
+
/**
|
|
104
|
+
* 是否启用 Vue 3 单文件组件支持。
|
|
105
|
+
* @default true
|
|
106
|
+
*/
|
|
107
|
+
vue?: boolean;
|
|
108
|
+
}
|
|
109
|
+
/** `fastConfig()` 使用的稳定默认值;对象被冻结,避免运行时被意外修改。 */
|
|
110
|
+
declare const defaultConfigOptions: Readonly<{
|
|
111
|
+
readonly environment: "browser";
|
|
112
|
+
readonly gitignore: true;
|
|
113
|
+
readonly imports: true;
|
|
114
|
+
readonly javascript: true;
|
|
115
|
+
readonly json: true;
|
|
116
|
+
readonly lodash: false;
|
|
117
|
+
readonly markdown: true;
|
|
118
|
+
readonly prettier: true;
|
|
119
|
+
readonly regexp: true;
|
|
120
|
+
readonly sortPackageJson: false;
|
|
121
|
+
readonly sortTsconfig: false;
|
|
122
|
+
readonly typescript: true;
|
|
123
|
+
readonly vue: true;
|
|
124
|
+
}>;
|
|
125
|
+
/**
|
|
126
|
+
* 创建面向 Vue 3、Vite、TypeScript、JavaScript 与 Node.js 项目的 ESLint Flat Config。
|
|
135
127
|
*
|
|
136
|
-
*
|
|
137
|
-
|
|
138
|
-
declare const PresetJavascriptConfigs: eslint_config.Config[];
|
|
139
|
-
/**
|
|
140
|
-
* JSON 预置配置
|
|
141
|
-
*/
|
|
142
|
-
declare const PresetJsonConfigs: eslint_config.Config[];
|
|
143
|
-
/**
|
|
144
|
-
* 基础预置配置
|
|
145
|
-
*
|
|
146
|
-
* @description javascript,typescript,json
|
|
147
|
-
*/
|
|
148
|
-
declare const PresetBasicConfigs: eslint_config.Config[];
|
|
149
|
-
/**
|
|
150
|
-
* 默认最全的配置
|
|
128
|
+
* 默认导出就是此函数。额外配置参数会放在内置配置之后,因此项目可以按文件范围
|
|
129
|
+
* 覆盖任何默认规则,而无需再次调用 ESLint 的 `defineConfig()`。
|
|
151
130
|
*/
|
|
152
|
-
declare const
|
|
131
|
+
declare const fastConfig: (options?: FastConfigOptions, ...overrides: Config[]) => Config[];
|
|
153
132
|
|
|
154
|
-
export {
|
|
133
|
+
export { type FastConfigOptions, type LodashPreference, RuleOptions, type RuntimeEnvironment, type TypeScriptConfigOptions, fastConfig as default, defaultConfigOptions, fastConfig };
|