@lincy/eslint-config 4.0.2 → 4.1.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/README.md +101 -44
- package/dist/index.cjs +200 -97
- package/dist/index.d.cts +75 -35
- package/dist/index.d.ts +75 -35
- package/dist/index.js +196 -95
- package/package.json +38 -15
package/dist/index.d.cts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Linter } from 'eslint';
|
|
2
2
|
import { FlatGitignoreOptions } from 'eslint-config-flat-gitignore';
|
|
3
3
|
import { ParserOptions } from '@typescript-eslint/parser';
|
|
4
|
-
import { RuleConfig, MergeIntersection, RenamePrefix, VitestRules, YmlRules, NRules, Prefix, ImportRules, EslintRules, JsoncRules, VueRules, EslintCommentsRules, FlatESLintConfigItem } from '@antfu/eslint-define-config';
|
|
4
|
+
import { RuleConfig, MergeIntersection, RenamePrefix, VitestRules, YmlRules, NRules, Prefix, ReactHooksRules, ReactRules, ImportRules, EslintRules, JsoncRules, VueRules, EslintCommentsRules, FlatESLintConfigItem } from '@antfu/eslint-define-config';
|
|
5
5
|
import { RuleOptions as RuleOptions$1 } from '@eslint-types/jsdoc/types';
|
|
6
6
|
import { RuleOptions } from '@eslint-types/typescript-eslint/types';
|
|
7
7
|
import { RuleOptions as RuleOptions$2 } from '@eslint-types/unicorn/types';
|
|
@@ -14,12 +14,12 @@ type WrapRuleConfig<T extends {
|
|
|
14
14
|
[K in keyof T]: T[K] extends RuleConfig ? T[K] : RuleConfig<T[K]>;
|
|
15
15
|
};
|
|
16
16
|
type Awaitable<T> = T | Promise<T>;
|
|
17
|
-
type Rules = WrapRuleConfig<MergeIntersection<RenamePrefix<RuleOptions, '@typescript-eslint/', 'ts/'> & RenamePrefix<VitestRules, 'vitest/', 'test/'> & RenamePrefix<YmlRules, 'yml/', 'yaml/'> & RenamePrefix<NRules, 'n/', 'node/'> & Prefix<UnprefixedRuleOptions, 'style/'> & Prefix<Rules$1, 'antfu/'> & RuleOptions$1 & ImportRules & EslintRules & JsoncRules & VueRules & RuleOptions$2 & EslintCommentsRules & {
|
|
17
|
+
type Rules = WrapRuleConfig<MergeIntersection<RenamePrefix<RuleOptions, '@typescript-eslint/', 'ts/'> & RenamePrefix<VitestRules, 'vitest/', 'test/'> & RenamePrefix<YmlRules, 'yml/', 'yaml/'> & RenamePrefix<NRules, 'n/', 'node/'> & Prefix<UnprefixedRuleOptions, 'style/'> & Prefix<Rules$1, 'antfu/'> & ReactHooksRules & ReactRules & RuleOptions$1 & ImportRules & EslintRules & JsoncRules & VueRules & RuleOptions$2 & EslintCommentsRules & {
|
|
18
18
|
'test/no-only-tests': RuleConfig<[]>;
|
|
19
19
|
}>>;
|
|
20
20
|
type FlatConfigItem = Omit<FlatESLintConfigItem<Rules, false>, 'plugins'> & {
|
|
21
21
|
/**
|
|
22
|
-
*
|
|
22
|
+
* 每个配置项的自定义名称
|
|
23
23
|
*/
|
|
24
24
|
name?: string;
|
|
25
25
|
/**
|
|
@@ -30,9 +30,15 @@ type FlatConfigItem = Omit<FlatESLintConfigItem<Rules, false>, 'plugins'> & {
|
|
|
30
30
|
plugins?: Record<string, any>;
|
|
31
31
|
};
|
|
32
32
|
type UserConfigItem = FlatConfigItem | Linter.FlatConfig;
|
|
33
|
+
interface OptionsFiles {
|
|
34
|
+
/**
|
|
35
|
+
* 自定义 glob 覆盖 “files” 选项
|
|
36
|
+
*/
|
|
37
|
+
files?: string[];
|
|
38
|
+
}
|
|
33
39
|
interface OptionsComponentExts {
|
|
34
40
|
/**
|
|
35
|
-
*
|
|
41
|
+
* 组件的附加扩展
|
|
36
42
|
*
|
|
37
43
|
* @example ['vue']
|
|
38
44
|
* @default []
|
|
@@ -41,13 +47,13 @@ interface OptionsComponentExts {
|
|
|
41
47
|
}
|
|
42
48
|
interface OptionsTypeScriptParserOptions {
|
|
43
49
|
/**
|
|
44
|
-
*
|
|
50
|
+
* TypeScript 的附加解析器选项。
|
|
45
51
|
*/
|
|
46
52
|
parserOptions?: Partial<ParserOptions>;
|
|
47
53
|
}
|
|
48
54
|
interface OptionsTypeScriptWithTypes {
|
|
49
55
|
/**
|
|
50
|
-
*
|
|
56
|
+
* 提供此选项后,将启用类型感知规则。
|
|
51
57
|
* @see https://typescript-eslint.io/linting/typed-linting/
|
|
52
58
|
*/
|
|
53
59
|
tsconfigPath?: string | string[];
|
|
@@ -59,8 +65,11 @@ interface OptionsStylistic {
|
|
|
59
65
|
stylistic?: boolean | StylisticConfig;
|
|
60
66
|
}
|
|
61
67
|
interface StylisticConfig {
|
|
68
|
+
/** 缩进 */
|
|
62
69
|
indent?: number | 'tab';
|
|
70
|
+
/** 单引号, 双引号 */
|
|
63
71
|
quotes?: 'single' | 'double';
|
|
72
|
+
/** 是否开启jsx贵州 */
|
|
64
73
|
jsx?: boolean;
|
|
65
74
|
}
|
|
66
75
|
interface StylisticOverridesConfig extends OptionsStylistic {
|
|
@@ -76,13 +85,27 @@ interface OptionsIsInEditor {
|
|
|
76
85
|
isInEditor?: boolean;
|
|
77
86
|
}
|
|
78
87
|
interface OptionsReact {
|
|
88
|
+
typescript?: boolean;
|
|
79
89
|
jsx?: boolean;
|
|
90
|
+
/** react 版本 */
|
|
80
91
|
version?: string;
|
|
81
92
|
overrides?: FlatConfigItem['rules'];
|
|
82
93
|
}
|
|
94
|
+
interface OptionsUnoCSS {
|
|
95
|
+
/**
|
|
96
|
+
* 启用 attributify 支持.
|
|
97
|
+
* @default true
|
|
98
|
+
*/
|
|
99
|
+
attributify?: boolean;
|
|
100
|
+
/**
|
|
101
|
+
* 启用严格模式,抛出有关阻止列表类的错误.
|
|
102
|
+
* @default false
|
|
103
|
+
*/
|
|
104
|
+
strict?: boolean;
|
|
105
|
+
}
|
|
83
106
|
interface OptionsConfig extends OptionsComponentExts {
|
|
84
107
|
/**
|
|
85
|
-
*
|
|
108
|
+
* 启用 gitignore 支持.
|
|
86
109
|
*
|
|
87
110
|
* Passing an object to configure the options.
|
|
88
111
|
*
|
|
@@ -91,70 +114,84 @@ interface OptionsConfig extends OptionsComponentExts {
|
|
|
91
114
|
*/
|
|
92
115
|
gitignore?: boolean | FlatGitignoreOptions;
|
|
93
116
|
/**
|
|
94
|
-
*
|
|
117
|
+
* 启用 TypeScript 支持.
|
|
95
118
|
*
|
|
96
|
-
*
|
|
119
|
+
* 传递对象以启用 TypeScript 语言服务器支持.
|
|
97
120
|
*
|
|
98
121
|
* @default auto-detect based on the dependencies
|
|
99
122
|
*/
|
|
100
|
-
typescript?: boolean | OptionsTypeScriptWithTypes | OptionsTypeScriptParserOptions;
|
|
123
|
+
typescript?: boolean | OptionsTypeScriptWithTypes | OptionsTypeScriptParserOptions | OptionsFiles;
|
|
101
124
|
/**
|
|
102
|
-
*
|
|
125
|
+
* 启用 JSX 相关规则.
|
|
103
126
|
*
|
|
104
|
-
*
|
|
127
|
+
* 目前仅包含风格规则.
|
|
105
128
|
*
|
|
106
129
|
* @default true
|
|
107
130
|
*/
|
|
108
131
|
jsx?: boolean;
|
|
109
132
|
/**
|
|
110
|
-
*
|
|
133
|
+
* 启用 test 支持.
|
|
111
134
|
*
|
|
112
135
|
* @default true
|
|
113
136
|
*/
|
|
114
|
-
test?: boolean;
|
|
137
|
+
test?: boolean | OptionsFiles;
|
|
115
138
|
/**
|
|
116
|
-
*
|
|
139
|
+
* 启用 Vue 支持.
|
|
117
140
|
*
|
|
118
141
|
* @default auto-detect based on the dependencies
|
|
119
142
|
*/
|
|
120
|
-
vue?: boolean;
|
|
143
|
+
vue?: boolean | OptionsFiles;
|
|
121
144
|
/**
|
|
122
|
-
*
|
|
145
|
+
* 启用 React 支持.
|
|
146
|
+
*
|
|
147
|
+
* 需要安装:
|
|
148
|
+
* - `eslint-plugin-react`
|
|
149
|
+
* - `eslint-plugin-react-hooks`
|
|
150
|
+
* - `eslint-plugin-react-refresh`
|
|
123
151
|
*
|
|
124
152
|
* @default auto-detect based on the dependencies
|
|
125
153
|
*/
|
|
126
|
-
react?: boolean;
|
|
154
|
+
react?: boolean | OptionsReact | OptionsFiles;
|
|
155
|
+
/**
|
|
156
|
+
* 启用 unocss rules.
|
|
157
|
+
*
|
|
158
|
+
* 需要安装:
|
|
159
|
+
* - `@unocss/eslint-plugin`
|
|
160
|
+
*
|
|
161
|
+
* @default false
|
|
162
|
+
*/
|
|
163
|
+
unocss?: boolean | OptionsUnoCSS;
|
|
127
164
|
/**
|
|
128
|
-
*
|
|
165
|
+
* 启用 JSONC 支持.
|
|
129
166
|
*
|
|
130
167
|
* @default true
|
|
131
168
|
*/
|
|
132
|
-
jsonc?: boolean;
|
|
169
|
+
jsonc?: boolean | OptionsFiles;
|
|
133
170
|
/**
|
|
134
|
-
*
|
|
171
|
+
* 启用 YAML 支持.
|
|
135
172
|
*
|
|
136
173
|
* @default true
|
|
137
174
|
*/
|
|
138
|
-
yaml?: boolean;
|
|
175
|
+
yaml?: boolean | OptionsFiles;
|
|
139
176
|
/**
|
|
140
|
-
*
|
|
177
|
+
* 启用 Markdown 支持.
|
|
141
178
|
*
|
|
142
179
|
* @default true
|
|
143
180
|
*/
|
|
144
|
-
markdown?: boolean;
|
|
181
|
+
markdown?: boolean | OptionsFiles;
|
|
145
182
|
/**
|
|
146
|
-
*
|
|
183
|
+
* 启用 stylistic rules.
|
|
147
184
|
*
|
|
148
185
|
* @default true
|
|
149
186
|
*/
|
|
150
187
|
stylistic?: boolean | StylisticConfig;
|
|
151
188
|
/**
|
|
152
|
-
*
|
|
189
|
+
* 控制再编辑器中禁用某些规则.
|
|
153
190
|
* @default auto-detect based on the process.env
|
|
154
191
|
*/
|
|
155
192
|
isInEditor?: boolean;
|
|
156
193
|
/**
|
|
157
|
-
*
|
|
194
|
+
* 为每个集成提供规则覆盖
|
|
158
195
|
*/
|
|
159
196
|
overrides?: {
|
|
160
197
|
javascript?: FlatConfigItem['rules'];
|
|
@@ -185,9 +222,9 @@ declare function javascript(options?: OptionsIsInEditor & OptionsOverrides): Pro
|
|
|
185
222
|
|
|
186
223
|
declare function jsdoc(options?: OptionsStylistic): Promise<FlatConfigItem[]>;
|
|
187
224
|
|
|
188
|
-
declare function jsonc(options?: OptionsStylistic & OptionsOverrides): Promise<FlatConfigItem[]>;
|
|
225
|
+
declare function jsonc(options?: OptionsFiles & OptionsStylistic & OptionsOverrides): Promise<FlatConfigItem[]>;
|
|
189
226
|
|
|
190
|
-
declare function markdown(options?: OptionsComponentExts & OptionsOverrides): Promise<FlatConfigItem[]>;
|
|
227
|
+
declare function markdown(options?: OptionsFiles & OptionsComponentExts & OptionsOverrides): Promise<FlatConfigItem[]>;
|
|
191
228
|
|
|
192
229
|
declare function node(): Promise<FlatConfigItem[]>;
|
|
193
230
|
|
|
@@ -206,15 +243,15 @@ declare function sortTsconfig(): FlatConfigItem[];
|
|
|
206
243
|
|
|
207
244
|
declare function stylistic(options?: StylisticOverridesConfig): Promise<FlatConfigItem[]>;
|
|
208
245
|
|
|
209
|
-
declare function typescript(options?: OptionsComponentExts & OptionsOverrides & OptionsTypeScriptWithTypes & OptionsTypeScriptParserOptions): Promise<FlatConfigItem[]>;
|
|
246
|
+
declare function typescript(options?: OptionsFiles & OptionsComponentExts & OptionsOverrides & OptionsTypeScriptWithTypes & OptionsTypeScriptParserOptions): Promise<FlatConfigItem[]>;
|
|
210
247
|
|
|
211
248
|
declare function unicorn(): Promise<FlatConfigItem[]>;
|
|
212
249
|
|
|
213
|
-
declare function vue(options?: OptionsHasTypeScript & OptionsOverrides & OptionsStylistic): Promise<FlatConfigItem[]>;
|
|
250
|
+
declare function vue(options?: OptionsFiles & OptionsHasTypeScript & OptionsOverrides & OptionsStylistic): Promise<FlatConfigItem[]>;
|
|
214
251
|
|
|
215
|
-
declare function yaml(options?: OptionsOverrides & OptionsStylistic): Promise<FlatConfigItem[]>;
|
|
252
|
+
declare function yaml(options?: OptionsFiles & OptionsOverrides & OptionsStylistic): Promise<FlatConfigItem[]>;
|
|
216
253
|
|
|
217
|
-
declare function test(options?: OptionsIsInEditor & OptionsOverrides): Promise<FlatConfigItem[]>;
|
|
254
|
+
declare function test(options?: OptionsFiles & OptionsIsInEditor & OptionsOverrides): Promise<FlatConfigItem[]>;
|
|
218
255
|
|
|
219
256
|
/**
|
|
220
257
|
* Optional perfectionist plugin for props and items sorting.
|
|
@@ -223,7 +260,9 @@ declare function test(options?: OptionsIsInEditor & OptionsOverrides): Promise<F
|
|
|
223
260
|
*/
|
|
224
261
|
declare function perfectionist(): Promise<FlatConfigItem[]>;
|
|
225
262
|
|
|
226
|
-
declare function react(options?: OptionsReact): Promise<FlatConfigItem[]>;
|
|
263
|
+
declare function react(options?: OptionsFiles & OptionsReact): Promise<FlatConfigItem[]>;
|
|
264
|
+
|
|
265
|
+
declare function unocss(options?: OptionsUnoCSS): Promise<FlatConfigItem[]>;
|
|
227
266
|
|
|
228
267
|
/**
|
|
229
268
|
* Combine array and non-array configs into a single array.
|
|
@@ -236,6 +275,7 @@ declare function toArray<T>(value: T | T[]): T[];
|
|
|
236
275
|
declare function interopDefault<T>(m: Awaitable<T>): Promise<T extends {
|
|
237
276
|
default: infer U;
|
|
238
277
|
} ? U : T>;
|
|
278
|
+
declare function ensurePackages(packages: string[]): Promise<void>;
|
|
239
279
|
|
|
240
280
|
declare const GLOB_SRC_EXT = "?([cm])[jt]s?(x)";
|
|
241
281
|
declare const GLOB_SRC = "**/*.?([cm])[jt]s?(x)";
|
|
@@ -259,4 +299,4 @@ declare const GLOB_TESTS: string[];
|
|
|
259
299
|
declare const GLOB_ALL_SRC: string[];
|
|
260
300
|
declare const GLOB_EXCLUDE: string[];
|
|
261
301
|
|
|
262
|
-
export { type Awaitable, type FlatConfigItem, GLOB_ALL_SRC, GLOB_CSS, GLOB_EXCLUDE, GLOB_HTML, GLOB_JS, GLOB_JSON, GLOB_JSON5, GLOB_JSONC, GLOB_JSX, GLOB_LESS, GLOB_MARKDOWN, GLOB_MARKDOWN_CODE, GLOB_SCSS, GLOB_SRC, GLOB_SRC_EXT, GLOB_STYLE, GLOB_TESTS, GLOB_TS, GLOB_TSX, GLOB_VUE, GLOB_YAML, type OptionsComponentExts, type OptionsConfig, type OptionsHasTypeScript, type OptionsIgnores, type OptionsIsInEditor, type OptionsOverrides, type OptionsReact, type OptionsStylistic, type OptionsTypeScriptParserOptions, type OptionsTypeScriptWithTypes, type Rules, type StylisticConfig, type StylisticOverridesConfig, type UserConfigItem, type WrapRuleConfig, combine, comments, lincy as default, ignores, imports, interopDefault, javascript, jsdoc, jsonc, lincy, markdown, node, perfectionist, react, renameRules, sortPackageJson, sortTsconfig, stylistic, test, toArray, typescript, unicorn, vue, yaml };
|
|
302
|
+
export { type Awaitable, type FlatConfigItem, GLOB_ALL_SRC, GLOB_CSS, GLOB_EXCLUDE, GLOB_HTML, GLOB_JS, GLOB_JSON, GLOB_JSON5, GLOB_JSONC, GLOB_JSX, GLOB_LESS, GLOB_MARKDOWN, GLOB_MARKDOWN_CODE, GLOB_SCSS, GLOB_SRC, GLOB_SRC_EXT, GLOB_STYLE, GLOB_TESTS, GLOB_TS, GLOB_TSX, GLOB_VUE, GLOB_YAML, type OptionsComponentExts, type OptionsConfig, type OptionsFiles, type OptionsHasTypeScript, type OptionsIgnores, type OptionsIsInEditor, type OptionsOverrides, type OptionsReact, type OptionsStylistic, type OptionsTypeScriptParserOptions, type OptionsTypeScriptWithTypes, type OptionsUnoCSS, type Rules, type StylisticConfig, type StylisticOverridesConfig, type UserConfigItem, type WrapRuleConfig, combine, comments, lincy as default, ensurePackages, ignores, imports, interopDefault, javascript, jsdoc, jsonc, lincy, markdown, node, perfectionist, react, renameRules, sortPackageJson, sortTsconfig, stylistic, test, toArray, typescript, unicorn, unocss, vue, yaml };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Linter } from 'eslint';
|
|
2
2
|
import { FlatGitignoreOptions } from 'eslint-config-flat-gitignore';
|
|
3
3
|
import { ParserOptions } from '@typescript-eslint/parser';
|
|
4
|
-
import { RuleConfig, MergeIntersection, RenamePrefix, VitestRules, YmlRules, NRules, Prefix, ImportRules, EslintRules, JsoncRules, VueRules, EslintCommentsRules, FlatESLintConfigItem } from '@antfu/eslint-define-config';
|
|
4
|
+
import { RuleConfig, MergeIntersection, RenamePrefix, VitestRules, YmlRules, NRules, Prefix, ReactHooksRules, ReactRules, ImportRules, EslintRules, JsoncRules, VueRules, EslintCommentsRules, FlatESLintConfigItem } from '@antfu/eslint-define-config';
|
|
5
5
|
import { RuleOptions as RuleOptions$1 } from '@eslint-types/jsdoc/types';
|
|
6
6
|
import { RuleOptions } from '@eslint-types/typescript-eslint/types';
|
|
7
7
|
import { RuleOptions as RuleOptions$2 } from '@eslint-types/unicorn/types';
|
|
@@ -14,12 +14,12 @@ type WrapRuleConfig<T extends {
|
|
|
14
14
|
[K in keyof T]: T[K] extends RuleConfig ? T[K] : RuleConfig<T[K]>;
|
|
15
15
|
};
|
|
16
16
|
type Awaitable<T> = T | Promise<T>;
|
|
17
|
-
type Rules = WrapRuleConfig<MergeIntersection<RenamePrefix<RuleOptions, '@typescript-eslint/', 'ts/'> & RenamePrefix<VitestRules, 'vitest/', 'test/'> & RenamePrefix<YmlRules, 'yml/', 'yaml/'> & RenamePrefix<NRules, 'n/', 'node/'> & Prefix<UnprefixedRuleOptions, 'style/'> & Prefix<Rules$1, 'antfu/'> & RuleOptions$1 & ImportRules & EslintRules & JsoncRules & VueRules & RuleOptions$2 & EslintCommentsRules & {
|
|
17
|
+
type Rules = WrapRuleConfig<MergeIntersection<RenamePrefix<RuleOptions, '@typescript-eslint/', 'ts/'> & RenamePrefix<VitestRules, 'vitest/', 'test/'> & RenamePrefix<YmlRules, 'yml/', 'yaml/'> & RenamePrefix<NRules, 'n/', 'node/'> & Prefix<UnprefixedRuleOptions, 'style/'> & Prefix<Rules$1, 'antfu/'> & ReactHooksRules & ReactRules & RuleOptions$1 & ImportRules & EslintRules & JsoncRules & VueRules & RuleOptions$2 & EslintCommentsRules & {
|
|
18
18
|
'test/no-only-tests': RuleConfig<[]>;
|
|
19
19
|
}>>;
|
|
20
20
|
type FlatConfigItem = Omit<FlatESLintConfigItem<Rules, false>, 'plugins'> & {
|
|
21
21
|
/**
|
|
22
|
-
*
|
|
22
|
+
* 每个配置项的自定义名称
|
|
23
23
|
*/
|
|
24
24
|
name?: string;
|
|
25
25
|
/**
|
|
@@ -30,9 +30,15 @@ type FlatConfigItem = Omit<FlatESLintConfigItem<Rules, false>, 'plugins'> & {
|
|
|
30
30
|
plugins?: Record<string, any>;
|
|
31
31
|
};
|
|
32
32
|
type UserConfigItem = FlatConfigItem | Linter.FlatConfig;
|
|
33
|
+
interface OptionsFiles {
|
|
34
|
+
/**
|
|
35
|
+
* 自定义 glob 覆盖 “files” 选项
|
|
36
|
+
*/
|
|
37
|
+
files?: string[];
|
|
38
|
+
}
|
|
33
39
|
interface OptionsComponentExts {
|
|
34
40
|
/**
|
|
35
|
-
*
|
|
41
|
+
* 组件的附加扩展
|
|
36
42
|
*
|
|
37
43
|
* @example ['vue']
|
|
38
44
|
* @default []
|
|
@@ -41,13 +47,13 @@ interface OptionsComponentExts {
|
|
|
41
47
|
}
|
|
42
48
|
interface OptionsTypeScriptParserOptions {
|
|
43
49
|
/**
|
|
44
|
-
*
|
|
50
|
+
* TypeScript 的附加解析器选项。
|
|
45
51
|
*/
|
|
46
52
|
parserOptions?: Partial<ParserOptions>;
|
|
47
53
|
}
|
|
48
54
|
interface OptionsTypeScriptWithTypes {
|
|
49
55
|
/**
|
|
50
|
-
*
|
|
56
|
+
* 提供此选项后,将启用类型感知规则。
|
|
51
57
|
* @see https://typescript-eslint.io/linting/typed-linting/
|
|
52
58
|
*/
|
|
53
59
|
tsconfigPath?: string | string[];
|
|
@@ -59,8 +65,11 @@ interface OptionsStylistic {
|
|
|
59
65
|
stylistic?: boolean | StylisticConfig;
|
|
60
66
|
}
|
|
61
67
|
interface StylisticConfig {
|
|
68
|
+
/** 缩进 */
|
|
62
69
|
indent?: number | 'tab';
|
|
70
|
+
/** 单引号, 双引号 */
|
|
63
71
|
quotes?: 'single' | 'double';
|
|
72
|
+
/** 是否开启jsx贵州 */
|
|
64
73
|
jsx?: boolean;
|
|
65
74
|
}
|
|
66
75
|
interface StylisticOverridesConfig extends OptionsStylistic {
|
|
@@ -76,13 +85,27 @@ interface OptionsIsInEditor {
|
|
|
76
85
|
isInEditor?: boolean;
|
|
77
86
|
}
|
|
78
87
|
interface OptionsReact {
|
|
88
|
+
typescript?: boolean;
|
|
79
89
|
jsx?: boolean;
|
|
90
|
+
/** react 版本 */
|
|
80
91
|
version?: string;
|
|
81
92
|
overrides?: FlatConfigItem['rules'];
|
|
82
93
|
}
|
|
94
|
+
interface OptionsUnoCSS {
|
|
95
|
+
/**
|
|
96
|
+
* 启用 attributify 支持.
|
|
97
|
+
* @default true
|
|
98
|
+
*/
|
|
99
|
+
attributify?: boolean;
|
|
100
|
+
/**
|
|
101
|
+
* 启用严格模式,抛出有关阻止列表类的错误.
|
|
102
|
+
* @default false
|
|
103
|
+
*/
|
|
104
|
+
strict?: boolean;
|
|
105
|
+
}
|
|
83
106
|
interface OptionsConfig extends OptionsComponentExts {
|
|
84
107
|
/**
|
|
85
|
-
*
|
|
108
|
+
* 启用 gitignore 支持.
|
|
86
109
|
*
|
|
87
110
|
* Passing an object to configure the options.
|
|
88
111
|
*
|
|
@@ -91,70 +114,84 @@ interface OptionsConfig extends OptionsComponentExts {
|
|
|
91
114
|
*/
|
|
92
115
|
gitignore?: boolean | FlatGitignoreOptions;
|
|
93
116
|
/**
|
|
94
|
-
*
|
|
117
|
+
* 启用 TypeScript 支持.
|
|
95
118
|
*
|
|
96
|
-
*
|
|
119
|
+
* 传递对象以启用 TypeScript 语言服务器支持.
|
|
97
120
|
*
|
|
98
121
|
* @default auto-detect based on the dependencies
|
|
99
122
|
*/
|
|
100
|
-
typescript?: boolean | OptionsTypeScriptWithTypes | OptionsTypeScriptParserOptions;
|
|
123
|
+
typescript?: boolean | OptionsTypeScriptWithTypes | OptionsTypeScriptParserOptions | OptionsFiles;
|
|
101
124
|
/**
|
|
102
|
-
*
|
|
125
|
+
* 启用 JSX 相关规则.
|
|
103
126
|
*
|
|
104
|
-
*
|
|
127
|
+
* 目前仅包含风格规则.
|
|
105
128
|
*
|
|
106
129
|
* @default true
|
|
107
130
|
*/
|
|
108
131
|
jsx?: boolean;
|
|
109
132
|
/**
|
|
110
|
-
*
|
|
133
|
+
* 启用 test 支持.
|
|
111
134
|
*
|
|
112
135
|
* @default true
|
|
113
136
|
*/
|
|
114
|
-
test?: boolean;
|
|
137
|
+
test?: boolean | OptionsFiles;
|
|
115
138
|
/**
|
|
116
|
-
*
|
|
139
|
+
* 启用 Vue 支持.
|
|
117
140
|
*
|
|
118
141
|
* @default auto-detect based on the dependencies
|
|
119
142
|
*/
|
|
120
|
-
vue?: boolean;
|
|
143
|
+
vue?: boolean | OptionsFiles;
|
|
121
144
|
/**
|
|
122
|
-
*
|
|
145
|
+
* 启用 React 支持.
|
|
146
|
+
*
|
|
147
|
+
* 需要安装:
|
|
148
|
+
* - `eslint-plugin-react`
|
|
149
|
+
* - `eslint-plugin-react-hooks`
|
|
150
|
+
* - `eslint-plugin-react-refresh`
|
|
123
151
|
*
|
|
124
152
|
* @default auto-detect based on the dependencies
|
|
125
153
|
*/
|
|
126
|
-
react?: boolean;
|
|
154
|
+
react?: boolean | OptionsReact | OptionsFiles;
|
|
155
|
+
/**
|
|
156
|
+
* 启用 unocss rules.
|
|
157
|
+
*
|
|
158
|
+
* 需要安装:
|
|
159
|
+
* - `@unocss/eslint-plugin`
|
|
160
|
+
*
|
|
161
|
+
* @default false
|
|
162
|
+
*/
|
|
163
|
+
unocss?: boolean | OptionsUnoCSS;
|
|
127
164
|
/**
|
|
128
|
-
*
|
|
165
|
+
* 启用 JSONC 支持.
|
|
129
166
|
*
|
|
130
167
|
* @default true
|
|
131
168
|
*/
|
|
132
|
-
jsonc?: boolean;
|
|
169
|
+
jsonc?: boolean | OptionsFiles;
|
|
133
170
|
/**
|
|
134
|
-
*
|
|
171
|
+
* 启用 YAML 支持.
|
|
135
172
|
*
|
|
136
173
|
* @default true
|
|
137
174
|
*/
|
|
138
|
-
yaml?: boolean;
|
|
175
|
+
yaml?: boolean | OptionsFiles;
|
|
139
176
|
/**
|
|
140
|
-
*
|
|
177
|
+
* 启用 Markdown 支持.
|
|
141
178
|
*
|
|
142
179
|
* @default true
|
|
143
180
|
*/
|
|
144
|
-
markdown?: boolean;
|
|
181
|
+
markdown?: boolean | OptionsFiles;
|
|
145
182
|
/**
|
|
146
|
-
*
|
|
183
|
+
* 启用 stylistic rules.
|
|
147
184
|
*
|
|
148
185
|
* @default true
|
|
149
186
|
*/
|
|
150
187
|
stylistic?: boolean | StylisticConfig;
|
|
151
188
|
/**
|
|
152
|
-
*
|
|
189
|
+
* 控制再编辑器中禁用某些规则.
|
|
153
190
|
* @default auto-detect based on the process.env
|
|
154
191
|
*/
|
|
155
192
|
isInEditor?: boolean;
|
|
156
193
|
/**
|
|
157
|
-
*
|
|
194
|
+
* 为每个集成提供规则覆盖
|
|
158
195
|
*/
|
|
159
196
|
overrides?: {
|
|
160
197
|
javascript?: FlatConfigItem['rules'];
|
|
@@ -185,9 +222,9 @@ declare function javascript(options?: OptionsIsInEditor & OptionsOverrides): Pro
|
|
|
185
222
|
|
|
186
223
|
declare function jsdoc(options?: OptionsStylistic): Promise<FlatConfigItem[]>;
|
|
187
224
|
|
|
188
|
-
declare function jsonc(options?: OptionsStylistic & OptionsOverrides): Promise<FlatConfigItem[]>;
|
|
225
|
+
declare function jsonc(options?: OptionsFiles & OptionsStylistic & OptionsOverrides): Promise<FlatConfigItem[]>;
|
|
189
226
|
|
|
190
|
-
declare function markdown(options?: OptionsComponentExts & OptionsOverrides): Promise<FlatConfigItem[]>;
|
|
227
|
+
declare function markdown(options?: OptionsFiles & OptionsComponentExts & OptionsOverrides): Promise<FlatConfigItem[]>;
|
|
191
228
|
|
|
192
229
|
declare function node(): Promise<FlatConfigItem[]>;
|
|
193
230
|
|
|
@@ -206,15 +243,15 @@ declare function sortTsconfig(): FlatConfigItem[];
|
|
|
206
243
|
|
|
207
244
|
declare function stylistic(options?: StylisticOverridesConfig): Promise<FlatConfigItem[]>;
|
|
208
245
|
|
|
209
|
-
declare function typescript(options?: OptionsComponentExts & OptionsOverrides & OptionsTypeScriptWithTypes & OptionsTypeScriptParserOptions): Promise<FlatConfigItem[]>;
|
|
246
|
+
declare function typescript(options?: OptionsFiles & OptionsComponentExts & OptionsOverrides & OptionsTypeScriptWithTypes & OptionsTypeScriptParserOptions): Promise<FlatConfigItem[]>;
|
|
210
247
|
|
|
211
248
|
declare function unicorn(): Promise<FlatConfigItem[]>;
|
|
212
249
|
|
|
213
|
-
declare function vue(options?: OptionsHasTypeScript & OptionsOverrides & OptionsStylistic): Promise<FlatConfigItem[]>;
|
|
250
|
+
declare function vue(options?: OptionsFiles & OptionsHasTypeScript & OptionsOverrides & OptionsStylistic): Promise<FlatConfigItem[]>;
|
|
214
251
|
|
|
215
|
-
declare function yaml(options?: OptionsOverrides & OptionsStylistic): Promise<FlatConfigItem[]>;
|
|
252
|
+
declare function yaml(options?: OptionsFiles & OptionsOverrides & OptionsStylistic): Promise<FlatConfigItem[]>;
|
|
216
253
|
|
|
217
|
-
declare function test(options?: OptionsIsInEditor & OptionsOverrides): Promise<FlatConfigItem[]>;
|
|
254
|
+
declare function test(options?: OptionsFiles & OptionsIsInEditor & OptionsOverrides): Promise<FlatConfigItem[]>;
|
|
218
255
|
|
|
219
256
|
/**
|
|
220
257
|
* Optional perfectionist plugin for props and items sorting.
|
|
@@ -223,7 +260,9 @@ declare function test(options?: OptionsIsInEditor & OptionsOverrides): Promise<F
|
|
|
223
260
|
*/
|
|
224
261
|
declare function perfectionist(): Promise<FlatConfigItem[]>;
|
|
225
262
|
|
|
226
|
-
declare function react(options?: OptionsReact): Promise<FlatConfigItem[]>;
|
|
263
|
+
declare function react(options?: OptionsFiles & OptionsReact): Promise<FlatConfigItem[]>;
|
|
264
|
+
|
|
265
|
+
declare function unocss(options?: OptionsUnoCSS): Promise<FlatConfigItem[]>;
|
|
227
266
|
|
|
228
267
|
/**
|
|
229
268
|
* Combine array and non-array configs into a single array.
|
|
@@ -236,6 +275,7 @@ declare function toArray<T>(value: T | T[]): T[];
|
|
|
236
275
|
declare function interopDefault<T>(m: Awaitable<T>): Promise<T extends {
|
|
237
276
|
default: infer U;
|
|
238
277
|
} ? U : T>;
|
|
278
|
+
declare function ensurePackages(packages: string[]): Promise<void>;
|
|
239
279
|
|
|
240
280
|
declare const GLOB_SRC_EXT = "?([cm])[jt]s?(x)";
|
|
241
281
|
declare const GLOB_SRC = "**/*.?([cm])[jt]s?(x)";
|
|
@@ -259,4 +299,4 @@ declare const GLOB_TESTS: string[];
|
|
|
259
299
|
declare const GLOB_ALL_SRC: string[];
|
|
260
300
|
declare const GLOB_EXCLUDE: string[];
|
|
261
301
|
|
|
262
|
-
export { type Awaitable, type FlatConfigItem, GLOB_ALL_SRC, GLOB_CSS, GLOB_EXCLUDE, GLOB_HTML, GLOB_JS, GLOB_JSON, GLOB_JSON5, GLOB_JSONC, GLOB_JSX, GLOB_LESS, GLOB_MARKDOWN, GLOB_MARKDOWN_CODE, GLOB_SCSS, GLOB_SRC, GLOB_SRC_EXT, GLOB_STYLE, GLOB_TESTS, GLOB_TS, GLOB_TSX, GLOB_VUE, GLOB_YAML, type OptionsComponentExts, type OptionsConfig, type OptionsHasTypeScript, type OptionsIgnores, type OptionsIsInEditor, type OptionsOverrides, type OptionsReact, type OptionsStylistic, type OptionsTypeScriptParserOptions, type OptionsTypeScriptWithTypes, type Rules, type StylisticConfig, type StylisticOverridesConfig, type UserConfigItem, type WrapRuleConfig, combine, comments, lincy as default, ignores, imports, interopDefault, javascript, jsdoc, jsonc, lincy, markdown, node, perfectionist, react, renameRules, sortPackageJson, sortTsconfig, stylistic, test, toArray, typescript, unicorn, vue, yaml };
|
|
302
|
+
export { type Awaitable, type FlatConfigItem, GLOB_ALL_SRC, GLOB_CSS, GLOB_EXCLUDE, GLOB_HTML, GLOB_JS, GLOB_JSON, GLOB_JSON5, GLOB_JSONC, GLOB_JSX, GLOB_LESS, GLOB_MARKDOWN, GLOB_MARKDOWN_CODE, GLOB_SCSS, GLOB_SRC, GLOB_SRC_EXT, GLOB_STYLE, GLOB_TESTS, GLOB_TS, GLOB_TSX, GLOB_VUE, GLOB_YAML, type OptionsComponentExts, type OptionsConfig, type OptionsFiles, type OptionsHasTypeScript, type OptionsIgnores, type OptionsIsInEditor, type OptionsOverrides, type OptionsReact, type OptionsStylistic, type OptionsTypeScriptParserOptions, type OptionsTypeScriptWithTypes, type OptionsUnoCSS, type Rules, type StylisticConfig, type StylisticOverridesConfig, type UserConfigItem, type WrapRuleConfig, combine, comments, lincy as default, ensurePackages, ignores, imports, interopDefault, javascript, jsdoc, jsonc, lincy, markdown, node, perfectionist, react, renameRules, sortPackageJson, sortTsconfig, stylistic, test, toArray, typescript, unicorn, unocss, vue, yaml };
|