@lincy/eslint-config 4.1.1 → 4.2.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/README.md +26 -20
- package/dist/index.cjs +963 -857
- package/dist/index.d.cts +175 -29
- package/dist/index.d.ts +175 -29
- package/dist/index.js +970 -868
- package/package.json +24 -17
package/dist/index.d.cts
CHANGED
|
@@ -6,7 +6,101 @@ 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';
|
|
8
8
|
import { Rules as Rules$1 } from 'eslint-plugin-antfu';
|
|
9
|
-
import { UnprefixedRuleOptions } from '@stylistic/eslint-plugin';
|
|
9
|
+
import { UnprefixedRuleOptions, StylisticCustomizeOptions } from '@stylistic/eslint-plugin';
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* Vendor types from Prettier so we don't rely on the dependency.
|
|
13
|
+
*/
|
|
14
|
+
type VendoredPrettierOptions = Partial<VendoredPrettierOptionsRequired>;
|
|
15
|
+
interface VendoredPrettierOptionsRequired {
|
|
16
|
+
/**
|
|
17
|
+
* Specify the number of spaces per indentation-level.
|
|
18
|
+
*/
|
|
19
|
+
tabWidth: number;
|
|
20
|
+
/**
|
|
21
|
+
* Indent lines with tabs instead of spaces
|
|
22
|
+
*/
|
|
23
|
+
useTabs?: boolean;
|
|
24
|
+
/**
|
|
25
|
+
* Print semicolons at the ends of statements.
|
|
26
|
+
*/
|
|
27
|
+
semi: boolean;
|
|
28
|
+
/**
|
|
29
|
+
* Use single quotes instead of double quotes.
|
|
30
|
+
*/
|
|
31
|
+
singleQuote: boolean;
|
|
32
|
+
/**
|
|
33
|
+
* Use single quotes in JSX.
|
|
34
|
+
*/
|
|
35
|
+
jsxSingleQuote: boolean;
|
|
36
|
+
/**
|
|
37
|
+
* Print trailing commas wherever possible.
|
|
38
|
+
*/
|
|
39
|
+
trailingComma: 'none' | 'es5' | 'all';
|
|
40
|
+
/**
|
|
41
|
+
* Print spaces between brackets in object literals.
|
|
42
|
+
*/
|
|
43
|
+
bracketSpacing: boolean;
|
|
44
|
+
/**
|
|
45
|
+
* Put the `>` of a multi-line HTML (HTML, JSX, Vue, Angular) element at the end of the last line instead of being
|
|
46
|
+
* alone on the next line (does not apply to self closing elements).
|
|
47
|
+
*/
|
|
48
|
+
bracketSameLine: boolean;
|
|
49
|
+
/**
|
|
50
|
+
* Put the `>` of a multi-line JSX element at the end of the last line instead of being alone on the next line.
|
|
51
|
+
* @deprecated use bracketSameLine instead
|
|
52
|
+
*/
|
|
53
|
+
jsxBracketSameLine: boolean;
|
|
54
|
+
/**
|
|
55
|
+
* Format only a segment of a file.
|
|
56
|
+
*/
|
|
57
|
+
rangeStart: number;
|
|
58
|
+
/**
|
|
59
|
+
* Format only a segment of a file.
|
|
60
|
+
* @default Number.POSITIVE_INFINITY
|
|
61
|
+
*/
|
|
62
|
+
rangeEnd: number;
|
|
63
|
+
/**
|
|
64
|
+
* By default, Prettier will wrap markdown text as-is since some services use a linebreak-sensitive renderer.
|
|
65
|
+
* In some cases you may want to rely on editor/viewer soft wrapping instead, so this option allows you to opt out.
|
|
66
|
+
* @default "preserve"
|
|
67
|
+
*/
|
|
68
|
+
proseWrap: 'always' | 'never' | 'preserve';
|
|
69
|
+
/**
|
|
70
|
+
* Include parentheses around a sole arrow function parameter.
|
|
71
|
+
* @default "always"
|
|
72
|
+
*/
|
|
73
|
+
arrowParens: 'avoid' | 'always';
|
|
74
|
+
/**
|
|
75
|
+
* Provide ability to support new languages to prettier.
|
|
76
|
+
*/
|
|
77
|
+
plugins: Array<string | any>;
|
|
78
|
+
/**
|
|
79
|
+
* How to handle whitespaces in HTML.
|
|
80
|
+
* @default "css"
|
|
81
|
+
*/
|
|
82
|
+
htmlWhitespaceSensitivity: 'css' | 'strict' | 'ignore';
|
|
83
|
+
/**
|
|
84
|
+
* Which end of line characters to apply.
|
|
85
|
+
* @default "lf"
|
|
86
|
+
*/
|
|
87
|
+
endOfLine: 'auto' | 'lf' | 'crlf' | 'cr';
|
|
88
|
+
/**
|
|
89
|
+
* Change when properties in objects are quoted.
|
|
90
|
+
* @default "as-needed"
|
|
91
|
+
*/
|
|
92
|
+
quoteProps: 'as-needed' | 'consistent' | 'preserve';
|
|
93
|
+
/**
|
|
94
|
+
* Whether or not to indent the code inside <script> and <style> tags in Vue files.
|
|
95
|
+
* @default false
|
|
96
|
+
*/
|
|
97
|
+
vueIndentScriptAndStyle: boolean;
|
|
98
|
+
/**
|
|
99
|
+
* Enforce single attribute per line in HTML, Vue and JSX.
|
|
100
|
+
* @default false
|
|
101
|
+
*/
|
|
102
|
+
singleAttributePerLine: boolean;
|
|
103
|
+
}
|
|
10
104
|
|
|
11
105
|
type WrapRuleConfig<T extends {
|
|
12
106
|
[key: string]: any;
|
|
@@ -36,6 +130,50 @@ interface OptionsFiles {
|
|
|
36
130
|
*/
|
|
37
131
|
files?: string[];
|
|
38
132
|
}
|
|
133
|
+
interface OptionsFormatters {
|
|
134
|
+
/**
|
|
135
|
+
* 启用对 CSS、Less、Sass 和 SCSS 的格式化支持.
|
|
136
|
+
*
|
|
137
|
+
* 目前仅支持Prettier.
|
|
138
|
+
*/
|
|
139
|
+
css?: 'prettier' | boolean;
|
|
140
|
+
/**
|
|
141
|
+
* 启用 HTML 格式支持.
|
|
142
|
+
*
|
|
143
|
+
* 目前仅支持Prettier.
|
|
144
|
+
*/
|
|
145
|
+
html?: 'prettier' | boolean;
|
|
146
|
+
/**
|
|
147
|
+
* 启用 TOML 格式支持.
|
|
148
|
+
*
|
|
149
|
+
* 目前仅支持dprint.
|
|
150
|
+
*/
|
|
151
|
+
toml?: 'dprint' | boolean;
|
|
152
|
+
/**
|
|
153
|
+
* 启用对 Markdown 的格式化支持.
|
|
154
|
+
*
|
|
155
|
+
* 同时支持 Prettier 和 dprint.
|
|
156
|
+
*
|
|
157
|
+
* 当设置为“true”时,将使用 Prettier.
|
|
158
|
+
*/
|
|
159
|
+
markdown?: 'prettier' | 'dprint' | boolean;
|
|
160
|
+
/**
|
|
161
|
+
* 启用 GraphQL 的格式化支持.
|
|
162
|
+
*/
|
|
163
|
+
graphql?: 'prettier' | boolean;
|
|
164
|
+
/**
|
|
165
|
+
* Prettier 的自定义选项.
|
|
166
|
+
*
|
|
167
|
+
* 默认情况下它是由我们自己的配置控制的.
|
|
168
|
+
*/
|
|
169
|
+
prettierOptions?: VendoredPrettierOptions;
|
|
170
|
+
/**
|
|
171
|
+
* dprint 的自定义选项.
|
|
172
|
+
*
|
|
173
|
+
* 默认情况下它是由我们自己的配置控制的.
|
|
174
|
+
*/
|
|
175
|
+
dprintOptions?: boolean;
|
|
176
|
+
}
|
|
39
177
|
interface OptionsComponentExts {
|
|
40
178
|
/**
|
|
41
179
|
* 组件的附加扩展
|
|
@@ -64,13 +202,7 @@ interface OptionsHasTypeScript {
|
|
|
64
202
|
interface OptionsStylistic {
|
|
65
203
|
stylistic?: boolean | StylisticConfig;
|
|
66
204
|
}
|
|
67
|
-
interface StylisticConfig {
|
|
68
|
-
/** 缩进 */
|
|
69
|
-
indent?: number | 'tab';
|
|
70
|
-
/** 单引号, 双引号 */
|
|
71
|
-
quotes?: 'single' | 'double';
|
|
72
|
-
/** 是否开启jsx贵州 */
|
|
73
|
-
jsx?: boolean;
|
|
205
|
+
interface StylisticConfig extends Pick<StylisticCustomizeOptions, 'indent' | 'quotes' | 'jsx' | 'semi'> {
|
|
74
206
|
}
|
|
75
207
|
interface StylisticOverridesConfig extends OptionsStylistic {
|
|
76
208
|
overrides?: FlatConfigItem['rules'];
|
|
@@ -118,7 +250,7 @@ interface OptionsConfig extends OptionsComponentExts {
|
|
|
118
250
|
*
|
|
119
251
|
* 传递对象以启用 TypeScript 语言服务器支持.
|
|
120
252
|
*
|
|
121
|
-
* @default
|
|
253
|
+
* @default 根据依赖关系自动检测
|
|
122
254
|
*/
|
|
123
255
|
typescript?: boolean | OptionsTypeScriptWithTypes | OptionsTypeScriptParserOptions | OptionsFiles;
|
|
124
256
|
/**
|
|
@@ -138,7 +270,7 @@ interface OptionsConfig extends OptionsComponentExts {
|
|
|
138
270
|
/**
|
|
139
271
|
* 启用 Vue 支持.
|
|
140
272
|
*
|
|
141
|
-
* @default
|
|
273
|
+
* @default 根据依赖关系自动检测
|
|
142
274
|
*/
|
|
143
275
|
vue?: boolean | OptionsFiles;
|
|
144
276
|
/**
|
|
@@ -149,7 +281,7 @@ interface OptionsConfig extends OptionsComponentExts {
|
|
|
149
281
|
* - `eslint-plugin-react-hooks`
|
|
150
282
|
* - `eslint-plugin-react-refresh`
|
|
151
283
|
*
|
|
152
|
-
* @default
|
|
284
|
+
* @default 根据依赖关系自动检测
|
|
153
285
|
*/
|
|
154
286
|
react?: boolean | OptionsReact | OptionsFiles;
|
|
155
287
|
/**
|
|
@@ -161,6 +293,15 @@ interface OptionsConfig extends OptionsComponentExts {
|
|
|
161
293
|
* @default false
|
|
162
294
|
*/
|
|
163
295
|
unocss?: boolean | OptionsUnoCSS;
|
|
296
|
+
/**
|
|
297
|
+
* 使用外部格式化程序格式化文件.
|
|
298
|
+
*
|
|
299
|
+
* 需要安装:
|
|
300
|
+
* - `eslint-plugin-format`
|
|
301
|
+
*
|
|
302
|
+
* @default false
|
|
303
|
+
*/
|
|
304
|
+
formatters?: boolean | OptionsFormatters;
|
|
164
305
|
/**
|
|
165
306
|
* 启用 JSONC 支持.
|
|
166
307
|
*
|
|
@@ -180,14 +321,14 @@ interface OptionsConfig extends OptionsComponentExts {
|
|
|
180
321
|
*/
|
|
181
322
|
markdown?: boolean | OptionsFiles;
|
|
182
323
|
/**
|
|
183
|
-
* 启用 stylistic
|
|
324
|
+
* 启用 stylistic 规则.
|
|
184
325
|
*
|
|
185
326
|
* @default true
|
|
186
327
|
*/
|
|
187
328
|
stylistic?: boolean | StylisticConfig;
|
|
188
329
|
/**
|
|
189
330
|
* 控制再编辑器中禁用某些规则.
|
|
190
|
-
* @default
|
|
331
|
+
* @default 基于 process.env 自动检测
|
|
191
332
|
*/
|
|
192
333
|
isInEditor?: boolean;
|
|
193
334
|
/**
|
|
@@ -208,7 +349,7 @@ interface OptionsConfig extends OptionsComponentExts {
|
|
|
208
349
|
}
|
|
209
350
|
|
|
210
351
|
/**
|
|
211
|
-
*
|
|
352
|
+
* 构造一个ESLint扁平化配置项数组。
|
|
212
353
|
*/
|
|
213
354
|
declare function lincy(options?: OptionsConfig & FlatConfigItem, ...userConfigs: Awaitable<UserConfigItem | UserConfigItem[]>[]): Promise<UserConfigItem[]>;
|
|
214
355
|
|
|
@@ -224,10 +365,21 @@ declare function jsdoc(options?: OptionsStylistic): Promise<FlatConfigItem[]>;
|
|
|
224
365
|
|
|
225
366
|
declare function jsonc(options?: OptionsFiles & OptionsStylistic & OptionsOverrides): Promise<FlatConfigItem[]>;
|
|
226
367
|
|
|
227
|
-
declare function markdown(options?: OptionsFiles & OptionsComponentExts & OptionsOverrides): Promise<FlatConfigItem[]>;
|
|
368
|
+
declare function markdown(options?: OptionsFiles & OptionsComponentExts & OptionsOverrides, formatMarkdown?: boolean): Promise<FlatConfigItem[]>;
|
|
369
|
+
|
|
370
|
+
/**
|
|
371
|
+
* Optional perfectionist plugin for props and items sorting.
|
|
372
|
+
*
|
|
373
|
+
* @see https://github.com/azat-io/eslint-plugin-perfectionist
|
|
374
|
+
*/
|
|
375
|
+
declare function perfectionist(): Promise<FlatConfigItem[]>;
|
|
376
|
+
|
|
377
|
+
declare function formatters(options?: OptionsFormatters | true, stylistic?: StylisticConfig): Promise<FlatConfigItem[]>;
|
|
228
378
|
|
|
229
379
|
declare function node(): Promise<FlatConfigItem[]>;
|
|
230
380
|
|
|
381
|
+
declare function react(options?: OptionsFiles & OptionsReact): Promise<FlatConfigItem[]>;
|
|
382
|
+
|
|
231
383
|
/**
|
|
232
384
|
* Sort package.json
|
|
233
385
|
*
|
|
@@ -241,29 +393,21 @@ declare function sortPackageJson(): Promise<FlatConfigItem[]>;
|
|
|
241
393
|
*/
|
|
242
394
|
declare function sortTsconfig(): FlatConfigItem[];
|
|
243
395
|
|
|
396
|
+
declare const StylisticConfigDefaults: StylisticConfig;
|
|
244
397
|
declare function stylistic(options?: StylisticOverridesConfig): Promise<FlatConfigItem[]>;
|
|
245
398
|
|
|
399
|
+
declare function test(options?: OptionsFiles & OptionsIsInEditor & OptionsOverrides): Promise<FlatConfigItem[]>;
|
|
400
|
+
|
|
246
401
|
declare function typescript(options?: OptionsFiles & OptionsComponentExts & OptionsOverrides & OptionsTypeScriptWithTypes & OptionsTypeScriptParserOptions): Promise<FlatConfigItem[]>;
|
|
247
402
|
|
|
248
403
|
declare function unicorn(): Promise<FlatConfigItem[]>;
|
|
249
404
|
|
|
405
|
+
declare function unocss(options?: OptionsUnoCSS): Promise<FlatConfigItem[]>;
|
|
406
|
+
|
|
250
407
|
declare function vue(options?: OptionsFiles & OptionsHasTypeScript & OptionsOverrides & OptionsStylistic): Promise<FlatConfigItem[]>;
|
|
251
408
|
|
|
252
409
|
declare function yaml(options?: OptionsFiles & OptionsOverrides & OptionsStylistic): Promise<FlatConfigItem[]>;
|
|
253
410
|
|
|
254
|
-
declare function test(options?: OptionsFiles & OptionsIsInEditor & OptionsOverrides): Promise<FlatConfigItem[]>;
|
|
255
|
-
|
|
256
|
-
/**
|
|
257
|
-
* Optional perfectionist plugin for props and items sorting.
|
|
258
|
-
*
|
|
259
|
-
* @see https://github.com/azat-io/eslint-plugin-perfectionist
|
|
260
|
-
*/
|
|
261
|
-
declare function perfectionist(): Promise<FlatConfigItem[]>;
|
|
262
|
-
|
|
263
|
-
declare function react(options?: OptionsFiles & OptionsReact): Promise<FlatConfigItem[]>;
|
|
264
|
-
|
|
265
|
-
declare function unocss(options?: OptionsUnoCSS): Promise<FlatConfigItem[]>;
|
|
266
|
-
|
|
267
411
|
/**
|
|
268
412
|
* Combine array and non-array configs into a single array.
|
|
269
413
|
*/
|
|
@@ -285,12 +429,14 @@ declare const GLOB_TS = "**/*.?([cm])ts";
|
|
|
285
429
|
declare const GLOB_TSX = "**/*.?([cm])tsx";
|
|
286
430
|
declare const GLOB_STYLE = "**/*.{c,le,sc}ss";
|
|
287
431
|
declare const GLOB_CSS = "**/*.css";
|
|
432
|
+
declare const GLOB_POSTCSS = "**/*.{p,post}css";
|
|
288
433
|
declare const GLOB_LESS = "**/*.less";
|
|
289
434
|
declare const GLOB_SCSS = "**/*.scss";
|
|
290
435
|
declare const GLOB_JSON = "**/*.json";
|
|
291
436
|
declare const GLOB_JSON5 = "**/*.json5";
|
|
292
437
|
declare const GLOB_JSONC = "**/*.jsonc";
|
|
293
438
|
declare const GLOB_MARKDOWN = "**/*.md";
|
|
439
|
+
declare const GLOB_MARKDOWN_IN_MARKDOWN = "**/*.md/*.md";
|
|
294
440
|
declare const GLOB_VUE = "**/*.vue";
|
|
295
441
|
declare const GLOB_YAML = "**/*.y?(a)ml";
|
|
296
442
|
declare const GLOB_HTML = "**/*.htm?(l)";
|
|
@@ -299,4 +445,4 @@ declare const GLOB_TESTS: string[];
|
|
|
299
445
|
declare const GLOB_ALL_SRC: string[];
|
|
300
446
|
declare const GLOB_EXCLUDE: string[];
|
|
301
447
|
|
|
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 };
|
|
448
|
+
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_MARKDOWN_IN_MARKDOWN, GLOB_POSTCSS, 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 OptionsFormatters, type OptionsHasTypeScript, type OptionsIgnores, type OptionsIsInEditor, type OptionsOverrides, type OptionsReact, type OptionsStylistic, type OptionsTypeScriptParserOptions, type OptionsTypeScriptWithTypes, type OptionsUnoCSS, type Rules, type StylisticConfig, StylisticConfigDefaults, type StylisticOverridesConfig, type UserConfigItem, type WrapRuleConfig, combine, comments, lincy as default, ensurePackages, formatters, 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
|
@@ -6,7 +6,101 @@ 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';
|
|
8
8
|
import { Rules as Rules$1 } from 'eslint-plugin-antfu';
|
|
9
|
-
import { UnprefixedRuleOptions } from '@stylistic/eslint-plugin';
|
|
9
|
+
import { UnprefixedRuleOptions, StylisticCustomizeOptions } from '@stylistic/eslint-plugin';
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* Vendor types from Prettier so we don't rely on the dependency.
|
|
13
|
+
*/
|
|
14
|
+
type VendoredPrettierOptions = Partial<VendoredPrettierOptionsRequired>;
|
|
15
|
+
interface VendoredPrettierOptionsRequired {
|
|
16
|
+
/**
|
|
17
|
+
* Specify the number of spaces per indentation-level.
|
|
18
|
+
*/
|
|
19
|
+
tabWidth: number;
|
|
20
|
+
/**
|
|
21
|
+
* Indent lines with tabs instead of spaces
|
|
22
|
+
*/
|
|
23
|
+
useTabs?: boolean;
|
|
24
|
+
/**
|
|
25
|
+
* Print semicolons at the ends of statements.
|
|
26
|
+
*/
|
|
27
|
+
semi: boolean;
|
|
28
|
+
/**
|
|
29
|
+
* Use single quotes instead of double quotes.
|
|
30
|
+
*/
|
|
31
|
+
singleQuote: boolean;
|
|
32
|
+
/**
|
|
33
|
+
* Use single quotes in JSX.
|
|
34
|
+
*/
|
|
35
|
+
jsxSingleQuote: boolean;
|
|
36
|
+
/**
|
|
37
|
+
* Print trailing commas wherever possible.
|
|
38
|
+
*/
|
|
39
|
+
trailingComma: 'none' | 'es5' | 'all';
|
|
40
|
+
/**
|
|
41
|
+
* Print spaces between brackets in object literals.
|
|
42
|
+
*/
|
|
43
|
+
bracketSpacing: boolean;
|
|
44
|
+
/**
|
|
45
|
+
* Put the `>` of a multi-line HTML (HTML, JSX, Vue, Angular) element at the end of the last line instead of being
|
|
46
|
+
* alone on the next line (does not apply to self closing elements).
|
|
47
|
+
*/
|
|
48
|
+
bracketSameLine: boolean;
|
|
49
|
+
/**
|
|
50
|
+
* Put the `>` of a multi-line JSX element at the end of the last line instead of being alone on the next line.
|
|
51
|
+
* @deprecated use bracketSameLine instead
|
|
52
|
+
*/
|
|
53
|
+
jsxBracketSameLine: boolean;
|
|
54
|
+
/**
|
|
55
|
+
* Format only a segment of a file.
|
|
56
|
+
*/
|
|
57
|
+
rangeStart: number;
|
|
58
|
+
/**
|
|
59
|
+
* Format only a segment of a file.
|
|
60
|
+
* @default Number.POSITIVE_INFINITY
|
|
61
|
+
*/
|
|
62
|
+
rangeEnd: number;
|
|
63
|
+
/**
|
|
64
|
+
* By default, Prettier will wrap markdown text as-is since some services use a linebreak-sensitive renderer.
|
|
65
|
+
* In some cases you may want to rely on editor/viewer soft wrapping instead, so this option allows you to opt out.
|
|
66
|
+
* @default "preserve"
|
|
67
|
+
*/
|
|
68
|
+
proseWrap: 'always' | 'never' | 'preserve';
|
|
69
|
+
/**
|
|
70
|
+
* Include parentheses around a sole arrow function parameter.
|
|
71
|
+
* @default "always"
|
|
72
|
+
*/
|
|
73
|
+
arrowParens: 'avoid' | 'always';
|
|
74
|
+
/**
|
|
75
|
+
* Provide ability to support new languages to prettier.
|
|
76
|
+
*/
|
|
77
|
+
plugins: Array<string | any>;
|
|
78
|
+
/**
|
|
79
|
+
* How to handle whitespaces in HTML.
|
|
80
|
+
* @default "css"
|
|
81
|
+
*/
|
|
82
|
+
htmlWhitespaceSensitivity: 'css' | 'strict' | 'ignore';
|
|
83
|
+
/**
|
|
84
|
+
* Which end of line characters to apply.
|
|
85
|
+
* @default "lf"
|
|
86
|
+
*/
|
|
87
|
+
endOfLine: 'auto' | 'lf' | 'crlf' | 'cr';
|
|
88
|
+
/**
|
|
89
|
+
* Change when properties in objects are quoted.
|
|
90
|
+
* @default "as-needed"
|
|
91
|
+
*/
|
|
92
|
+
quoteProps: 'as-needed' | 'consistent' | 'preserve';
|
|
93
|
+
/**
|
|
94
|
+
* Whether or not to indent the code inside <script> and <style> tags in Vue files.
|
|
95
|
+
* @default false
|
|
96
|
+
*/
|
|
97
|
+
vueIndentScriptAndStyle: boolean;
|
|
98
|
+
/**
|
|
99
|
+
* Enforce single attribute per line in HTML, Vue and JSX.
|
|
100
|
+
* @default false
|
|
101
|
+
*/
|
|
102
|
+
singleAttributePerLine: boolean;
|
|
103
|
+
}
|
|
10
104
|
|
|
11
105
|
type WrapRuleConfig<T extends {
|
|
12
106
|
[key: string]: any;
|
|
@@ -36,6 +130,50 @@ interface OptionsFiles {
|
|
|
36
130
|
*/
|
|
37
131
|
files?: string[];
|
|
38
132
|
}
|
|
133
|
+
interface OptionsFormatters {
|
|
134
|
+
/**
|
|
135
|
+
* 启用对 CSS、Less、Sass 和 SCSS 的格式化支持.
|
|
136
|
+
*
|
|
137
|
+
* 目前仅支持Prettier.
|
|
138
|
+
*/
|
|
139
|
+
css?: 'prettier' | boolean;
|
|
140
|
+
/**
|
|
141
|
+
* 启用 HTML 格式支持.
|
|
142
|
+
*
|
|
143
|
+
* 目前仅支持Prettier.
|
|
144
|
+
*/
|
|
145
|
+
html?: 'prettier' | boolean;
|
|
146
|
+
/**
|
|
147
|
+
* 启用 TOML 格式支持.
|
|
148
|
+
*
|
|
149
|
+
* 目前仅支持dprint.
|
|
150
|
+
*/
|
|
151
|
+
toml?: 'dprint' | boolean;
|
|
152
|
+
/**
|
|
153
|
+
* 启用对 Markdown 的格式化支持.
|
|
154
|
+
*
|
|
155
|
+
* 同时支持 Prettier 和 dprint.
|
|
156
|
+
*
|
|
157
|
+
* 当设置为“true”时,将使用 Prettier.
|
|
158
|
+
*/
|
|
159
|
+
markdown?: 'prettier' | 'dprint' | boolean;
|
|
160
|
+
/**
|
|
161
|
+
* 启用 GraphQL 的格式化支持.
|
|
162
|
+
*/
|
|
163
|
+
graphql?: 'prettier' | boolean;
|
|
164
|
+
/**
|
|
165
|
+
* Prettier 的自定义选项.
|
|
166
|
+
*
|
|
167
|
+
* 默认情况下它是由我们自己的配置控制的.
|
|
168
|
+
*/
|
|
169
|
+
prettierOptions?: VendoredPrettierOptions;
|
|
170
|
+
/**
|
|
171
|
+
* dprint 的自定义选项.
|
|
172
|
+
*
|
|
173
|
+
* 默认情况下它是由我们自己的配置控制的.
|
|
174
|
+
*/
|
|
175
|
+
dprintOptions?: boolean;
|
|
176
|
+
}
|
|
39
177
|
interface OptionsComponentExts {
|
|
40
178
|
/**
|
|
41
179
|
* 组件的附加扩展
|
|
@@ -64,13 +202,7 @@ interface OptionsHasTypeScript {
|
|
|
64
202
|
interface OptionsStylistic {
|
|
65
203
|
stylistic?: boolean | StylisticConfig;
|
|
66
204
|
}
|
|
67
|
-
interface StylisticConfig {
|
|
68
|
-
/** 缩进 */
|
|
69
|
-
indent?: number | 'tab';
|
|
70
|
-
/** 单引号, 双引号 */
|
|
71
|
-
quotes?: 'single' | 'double';
|
|
72
|
-
/** 是否开启jsx贵州 */
|
|
73
|
-
jsx?: boolean;
|
|
205
|
+
interface StylisticConfig extends Pick<StylisticCustomizeOptions, 'indent' | 'quotes' | 'jsx' | 'semi'> {
|
|
74
206
|
}
|
|
75
207
|
interface StylisticOverridesConfig extends OptionsStylistic {
|
|
76
208
|
overrides?: FlatConfigItem['rules'];
|
|
@@ -118,7 +250,7 @@ interface OptionsConfig extends OptionsComponentExts {
|
|
|
118
250
|
*
|
|
119
251
|
* 传递对象以启用 TypeScript 语言服务器支持.
|
|
120
252
|
*
|
|
121
|
-
* @default
|
|
253
|
+
* @default 根据依赖关系自动检测
|
|
122
254
|
*/
|
|
123
255
|
typescript?: boolean | OptionsTypeScriptWithTypes | OptionsTypeScriptParserOptions | OptionsFiles;
|
|
124
256
|
/**
|
|
@@ -138,7 +270,7 @@ interface OptionsConfig extends OptionsComponentExts {
|
|
|
138
270
|
/**
|
|
139
271
|
* 启用 Vue 支持.
|
|
140
272
|
*
|
|
141
|
-
* @default
|
|
273
|
+
* @default 根据依赖关系自动检测
|
|
142
274
|
*/
|
|
143
275
|
vue?: boolean | OptionsFiles;
|
|
144
276
|
/**
|
|
@@ -149,7 +281,7 @@ interface OptionsConfig extends OptionsComponentExts {
|
|
|
149
281
|
* - `eslint-plugin-react-hooks`
|
|
150
282
|
* - `eslint-plugin-react-refresh`
|
|
151
283
|
*
|
|
152
|
-
* @default
|
|
284
|
+
* @default 根据依赖关系自动检测
|
|
153
285
|
*/
|
|
154
286
|
react?: boolean | OptionsReact | OptionsFiles;
|
|
155
287
|
/**
|
|
@@ -161,6 +293,15 @@ interface OptionsConfig extends OptionsComponentExts {
|
|
|
161
293
|
* @default false
|
|
162
294
|
*/
|
|
163
295
|
unocss?: boolean | OptionsUnoCSS;
|
|
296
|
+
/**
|
|
297
|
+
* 使用外部格式化程序格式化文件.
|
|
298
|
+
*
|
|
299
|
+
* 需要安装:
|
|
300
|
+
* - `eslint-plugin-format`
|
|
301
|
+
*
|
|
302
|
+
* @default false
|
|
303
|
+
*/
|
|
304
|
+
formatters?: boolean | OptionsFormatters;
|
|
164
305
|
/**
|
|
165
306
|
* 启用 JSONC 支持.
|
|
166
307
|
*
|
|
@@ -180,14 +321,14 @@ interface OptionsConfig extends OptionsComponentExts {
|
|
|
180
321
|
*/
|
|
181
322
|
markdown?: boolean | OptionsFiles;
|
|
182
323
|
/**
|
|
183
|
-
* 启用 stylistic
|
|
324
|
+
* 启用 stylistic 规则.
|
|
184
325
|
*
|
|
185
326
|
* @default true
|
|
186
327
|
*/
|
|
187
328
|
stylistic?: boolean | StylisticConfig;
|
|
188
329
|
/**
|
|
189
330
|
* 控制再编辑器中禁用某些规则.
|
|
190
|
-
* @default
|
|
331
|
+
* @default 基于 process.env 自动检测
|
|
191
332
|
*/
|
|
192
333
|
isInEditor?: boolean;
|
|
193
334
|
/**
|
|
@@ -208,7 +349,7 @@ interface OptionsConfig extends OptionsComponentExts {
|
|
|
208
349
|
}
|
|
209
350
|
|
|
210
351
|
/**
|
|
211
|
-
*
|
|
352
|
+
* 构造一个ESLint扁平化配置项数组。
|
|
212
353
|
*/
|
|
213
354
|
declare function lincy(options?: OptionsConfig & FlatConfigItem, ...userConfigs: Awaitable<UserConfigItem | UserConfigItem[]>[]): Promise<UserConfigItem[]>;
|
|
214
355
|
|
|
@@ -224,10 +365,21 @@ declare function jsdoc(options?: OptionsStylistic): Promise<FlatConfigItem[]>;
|
|
|
224
365
|
|
|
225
366
|
declare function jsonc(options?: OptionsFiles & OptionsStylistic & OptionsOverrides): Promise<FlatConfigItem[]>;
|
|
226
367
|
|
|
227
|
-
declare function markdown(options?: OptionsFiles & OptionsComponentExts & OptionsOverrides): Promise<FlatConfigItem[]>;
|
|
368
|
+
declare function markdown(options?: OptionsFiles & OptionsComponentExts & OptionsOverrides, formatMarkdown?: boolean): Promise<FlatConfigItem[]>;
|
|
369
|
+
|
|
370
|
+
/**
|
|
371
|
+
* Optional perfectionist plugin for props and items sorting.
|
|
372
|
+
*
|
|
373
|
+
* @see https://github.com/azat-io/eslint-plugin-perfectionist
|
|
374
|
+
*/
|
|
375
|
+
declare function perfectionist(): Promise<FlatConfigItem[]>;
|
|
376
|
+
|
|
377
|
+
declare function formatters(options?: OptionsFormatters | true, stylistic?: StylisticConfig): Promise<FlatConfigItem[]>;
|
|
228
378
|
|
|
229
379
|
declare function node(): Promise<FlatConfigItem[]>;
|
|
230
380
|
|
|
381
|
+
declare function react(options?: OptionsFiles & OptionsReact): Promise<FlatConfigItem[]>;
|
|
382
|
+
|
|
231
383
|
/**
|
|
232
384
|
* Sort package.json
|
|
233
385
|
*
|
|
@@ -241,29 +393,21 @@ declare function sortPackageJson(): Promise<FlatConfigItem[]>;
|
|
|
241
393
|
*/
|
|
242
394
|
declare function sortTsconfig(): FlatConfigItem[];
|
|
243
395
|
|
|
396
|
+
declare const StylisticConfigDefaults: StylisticConfig;
|
|
244
397
|
declare function stylistic(options?: StylisticOverridesConfig): Promise<FlatConfigItem[]>;
|
|
245
398
|
|
|
399
|
+
declare function test(options?: OptionsFiles & OptionsIsInEditor & OptionsOverrides): Promise<FlatConfigItem[]>;
|
|
400
|
+
|
|
246
401
|
declare function typescript(options?: OptionsFiles & OptionsComponentExts & OptionsOverrides & OptionsTypeScriptWithTypes & OptionsTypeScriptParserOptions): Promise<FlatConfigItem[]>;
|
|
247
402
|
|
|
248
403
|
declare function unicorn(): Promise<FlatConfigItem[]>;
|
|
249
404
|
|
|
405
|
+
declare function unocss(options?: OptionsUnoCSS): Promise<FlatConfigItem[]>;
|
|
406
|
+
|
|
250
407
|
declare function vue(options?: OptionsFiles & OptionsHasTypeScript & OptionsOverrides & OptionsStylistic): Promise<FlatConfigItem[]>;
|
|
251
408
|
|
|
252
409
|
declare function yaml(options?: OptionsFiles & OptionsOverrides & OptionsStylistic): Promise<FlatConfigItem[]>;
|
|
253
410
|
|
|
254
|
-
declare function test(options?: OptionsFiles & OptionsIsInEditor & OptionsOverrides): Promise<FlatConfigItem[]>;
|
|
255
|
-
|
|
256
|
-
/**
|
|
257
|
-
* Optional perfectionist plugin for props and items sorting.
|
|
258
|
-
*
|
|
259
|
-
* @see https://github.com/azat-io/eslint-plugin-perfectionist
|
|
260
|
-
*/
|
|
261
|
-
declare function perfectionist(): Promise<FlatConfigItem[]>;
|
|
262
|
-
|
|
263
|
-
declare function react(options?: OptionsFiles & OptionsReact): Promise<FlatConfigItem[]>;
|
|
264
|
-
|
|
265
|
-
declare function unocss(options?: OptionsUnoCSS): Promise<FlatConfigItem[]>;
|
|
266
|
-
|
|
267
411
|
/**
|
|
268
412
|
* Combine array and non-array configs into a single array.
|
|
269
413
|
*/
|
|
@@ -285,12 +429,14 @@ declare const GLOB_TS = "**/*.?([cm])ts";
|
|
|
285
429
|
declare const GLOB_TSX = "**/*.?([cm])tsx";
|
|
286
430
|
declare const GLOB_STYLE = "**/*.{c,le,sc}ss";
|
|
287
431
|
declare const GLOB_CSS = "**/*.css";
|
|
432
|
+
declare const GLOB_POSTCSS = "**/*.{p,post}css";
|
|
288
433
|
declare const GLOB_LESS = "**/*.less";
|
|
289
434
|
declare const GLOB_SCSS = "**/*.scss";
|
|
290
435
|
declare const GLOB_JSON = "**/*.json";
|
|
291
436
|
declare const GLOB_JSON5 = "**/*.json5";
|
|
292
437
|
declare const GLOB_JSONC = "**/*.jsonc";
|
|
293
438
|
declare const GLOB_MARKDOWN = "**/*.md";
|
|
439
|
+
declare const GLOB_MARKDOWN_IN_MARKDOWN = "**/*.md/*.md";
|
|
294
440
|
declare const GLOB_VUE = "**/*.vue";
|
|
295
441
|
declare const GLOB_YAML = "**/*.y?(a)ml";
|
|
296
442
|
declare const GLOB_HTML = "**/*.htm?(l)";
|
|
@@ -299,4 +445,4 @@ declare const GLOB_TESTS: string[];
|
|
|
299
445
|
declare const GLOB_ALL_SRC: string[];
|
|
300
446
|
declare const GLOB_EXCLUDE: string[];
|
|
301
447
|
|
|
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 };
|
|
448
|
+
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_MARKDOWN_IN_MARKDOWN, GLOB_POSTCSS, 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 OptionsFormatters, type OptionsHasTypeScript, type OptionsIgnores, type OptionsIsInEditor, type OptionsOverrides, type OptionsReact, type OptionsStylistic, type OptionsTypeScriptParserOptions, type OptionsTypeScriptWithTypes, type OptionsUnoCSS, type Rules, type StylisticConfig, StylisticConfigDefaults, type StylisticOverridesConfig, type UserConfigItem, type WrapRuleConfig, combine, comments, lincy as default, ensurePackages, formatters, ignores, imports, interopDefault, javascript, jsdoc, jsonc, lincy, markdown, node, perfectionist, react, renameRules, sortPackageJson, sortTsconfig, stylistic, test, toArray, typescript, unicorn, unocss, vue, yaml };
|