@coderwyd/eslint-config 1.1.0-beta.2 → 1.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 +39 -9
- package/bin/index.js +3 -0
- package/dist/cli.cjs +268 -0
- package/dist/cli.d.cts +2 -0
- package/dist/cli.d.ts +2 -0
- package/dist/cli.js +239 -0
- package/dist/index.cjs +553 -492
- package/dist/index.d.cts +130 -78
- package/dist/index.d.ts +130 -78
- package/dist/index.js +553 -473
- package/package.json +76 -37
package/dist/index.d.cts
CHANGED
|
@@ -1,29 +1,41 @@
|
|
|
1
|
-
import { FlatESLintConfigItem } from 'eslint-define-config';
|
|
2
1
|
import { FlatGitignoreOptions } from 'eslint-config-flat-gitignore';
|
|
3
2
|
import { ParserOptions } from '@typescript-eslint/parser';
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
export { default as pluginNode } from 'eslint-plugin-n';
|
|
12
|
-
export { default as pluginStylistic } from '@stylistic/eslint-plugin';
|
|
13
|
-
export { default as pluginTs } from '@typescript-eslint/eslint-plugin';
|
|
14
|
-
export { default as pluginUnicorn } from 'eslint-plugin-unicorn';
|
|
15
|
-
export { default as pluginUnusedImports } from 'eslint-plugin-unused-imports';
|
|
16
|
-
export { default as pluginVue } from 'eslint-plugin-vue';
|
|
17
|
-
export { default as pluginYaml } from 'eslint-plugin-yml';
|
|
18
|
-
export { default as pluginNoOnlyTests } from 'eslint-plugin-no-only-tests';
|
|
19
|
-
export { default as pluginReact } from 'eslint-plugin-react';
|
|
20
|
-
export { default as pluginReactHooks } from 'eslint-plugin-react-hooks';
|
|
21
|
-
export { default as pluginAstro } from 'eslint-plugin-astro';
|
|
22
|
-
export { default as parserVue } from 'vue-eslint-parser';
|
|
23
|
-
export { default as parserYaml } from 'yaml-eslint-parser';
|
|
24
|
-
export { default as parserJsonc } from 'jsonc-eslint-parser';
|
|
25
|
-
export { default as parserAstro } from 'astro-eslint-parser';
|
|
3
|
+
import { Linter } from 'eslint';
|
|
4
|
+
import { RuleConfig, MergeIntersection, RenamePrefix, VitestRules, YmlRules, NRules, Prefix, ReactHooksRules, ReactRules, ImportRules, EslintRules, JsoncRules, VueRules, EslintCommentsRules, FlatESLintConfigItem } from '@antfu/eslint-define-config';
|
|
5
|
+
import { RuleOptions as RuleOptions$1 } from '@eslint-types/jsdoc/types';
|
|
6
|
+
import { RuleOptions } from '@eslint-types/typescript-eslint/types';
|
|
7
|
+
import { RuleOptions as RuleOptions$2 } from '@eslint-types/unicorn/types';
|
|
8
|
+
import { Rules as Rules$1 } from 'eslint-plugin-antfu';
|
|
9
|
+
import { UnprefixedRuleOptions, StylisticCustomizeOptions } from '@stylistic/eslint-plugin';
|
|
26
10
|
|
|
11
|
+
type WrapRuleConfig<T extends {
|
|
12
|
+
[key: string]: any;
|
|
13
|
+
}> = {
|
|
14
|
+
[K in keyof T]: T[K] extends RuleConfig ? T[K] : RuleConfig<T[K]>;
|
|
15
|
+
};
|
|
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/'> & ReactHooksRules & ReactRules & RuleOptions$1 & ImportRules & EslintRules & JsoncRules & VueRules & RuleOptions$2 & EslintCommentsRules & {
|
|
18
|
+
'test/no-only-tests': RuleConfig<[]>;
|
|
19
|
+
}>>;
|
|
20
|
+
type FlatConfigItem = Omit<FlatESLintConfigItem<Rules, false>, 'plugins'> & {
|
|
21
|
+
/**
|
|
22
|
+
* Custom name of each config item
|
|
23
|
+
*/
|
|
24
|
+
name?: string;
|
|
25
|
+
/**
|
|
26
|
+
* An object containing a name-value mapping of plugin names to plugin objects. When `files` is specified, these plugins are only available to the matching files.
|
|
27
|
+
*
|
|
28
|
+
* @see [Using plugins in your configuration](https://eslint.org/docs/latest/user-guide/configuring/configuration-files-new#using-plugins-in-your-configuration)
|
|
29
|
+
*/
|
|
30
|
+
plugins?: Record<string, any>;
|
|
31
|
+
};
|
|
32
|
+
type UserConfigItem = FlatConfigItem | Linter.FlatConfig;
|
|
33
|
+
interface OptionsFiles {
|
|
34
|
+
/**
|
|
35
|
+
* Override the `files` option to provide custom globs.
|
|
36
|
+
*/
|
|
37
|
+
files?: string[];
|
|
38
|
+
}
|
|
27
39
|
interface OptionsComponentExts {
|
|
28
40
|
/**
|
|
29
41
|
* Additional extensions for components.
|
|
@@ -44,20 +56,34 @@ interface OptionsTypeScriptWithTypes {
|
|
|
44
56
|
* When this options is provided, type aware rules will be enabled.
|
|
45
57
|
* @see https://typescript-eslint.io/linting/typed-linting/
|
|
46
58
|
*/
|
|
47
|
-
tsconfigPath?: string;
|
|
59
|
+
tsconfigPath?: string | string[];
|
|
48
60
|
}
|
|
49
61
|
interface OptionsHasTypeScript {
|
|
50
62
|
typescript?: boolean;
|
|
51
63
|
}
|
|
52
64
|
interface OptionsStylistic {
|
|
53
|
-
stylistic?: boolean;
|
|
65
|
+
stylistic?: boolean | StylisticConfig;
|
|
66
|
+
}
|
|
67
|
+
interface StylisticConfig extends Pick<StylisticCustomizeOptions, 'indent' | 'quotes' | 'jsx' | 'semi'> {
|
|
54
68
|
}
|
|
55
69
|
interface OptionsOverrides {
|
|
56
|
-
overrides?:
|
|
70
|
+
overrides?: FlatConfigItem['rules'];
|
|
57
71
|
}
|
|
58
72
|
interface OptionsIsInEditor {
|
|
59
73
|
isInEditor?: boolean;
|
|
60
74
|
}
|
|
75
|
+
interface OptionsUnoCSS {
|
|
76
|
+
/**
|
|
77
|
+
* Enable attributify support.
|
|
78
|
+
* @default true
|
|
79
|
+
*/
|
|
80
|
+
attributify?: boolean;
|
|
81
|
+
/**
|
|
82
|
+
* Enable strict mode by throwing errors about blocklisted classes.
|
|
83
|
+
* @default false
|
|
84
|
+
*/
|
|
85
|
+
strict?: boolean;
|
|
86
|
+
}
|
|
61
87
|
interface OptionsConfig extends OptionsComponentExts {
|
|
62
88
|
/**
|
|
63
89
|
* Enable gitignore support.
|
|
@@ -75,7 +101,15 @@ interface OptionsConfig extends OptionsComponentExts {
|
|
|
75
101
|
*
|
|
76
102
|
* @default auto-detect based on the dependencies
|
|
77
103
|
*/
|
|
78
|
-
typescript?: boolean | OptionsTypeScriptWithTypes;
|
|
104
|
+
typescript?: boolean | OptionsTypeScriptWithTypes | OptionsTypeScriptParserOptions;
|
|
105
|
+
/**
|
|
106
|
+
* Enable JSX related rules.
|
|
107
|
+
*
|
|
108
|
+
* Currently only stylistic rules are included.
|
|
109
|
+
*
|
|
110
|
+
* @default true
|
|
111
|
+
*/
|
|
112
|
+
jsx?: boolean;
|
|
79
113
|
/**
|
|
80
114
|
* Enable test support.
|
|
81
115
|
*
|
|
@@ -88,18 +122,6 @@ interface OptionsConfig extends OptionsComponentExts {
|
|
|
88
122
|
* @default auto-detect based on the dependencies
|
|
89
123
|
*/
|
|
90
124
|
vue?: boolean;
|
|
91
|
-
/**
|
|
92
|
-
* Enable React support.
|
|
93
|
-
*
|
|
94
|
-
* @default auto-detect based on the dependencies
|
|
95
|
-
*/
|
|
96
|
-
react?: boolean;
|
|
97
|
-
/**
|
|
98
|
-
* Enable Astro support.
|
|
99
|
-
*
|
|
100
|
-
* @default auto-detect based on the dependencies
|
|
101
|
-
*/
|
|
102
|
-
astro?: boolean;
|
|
103
125
|
/**
|
|
104
126
|
* Enable JSONC support.
|
|
105
127
|
*
|
|
@@ -123,7 +145,27 @@ interface OptionsConfig extends OptionsComponentExts {
|
|
|
123
145
|
*
|
|
124
146
|
* @default true
|
|
125
147
|
*/
|
|
126
|
-
stylistic?: boolean;
|
|
148
|
+
stylistic?: boolean | StylisticConfig;
|
|
149
|
+
/**
|
|
150
|
+
* Enable react rules.
|
|
151
|
+
*
|
|
152
|
+
* Requires installing:
|
|
153
|
+
* - `eslint-plugin-react`
|
|
154
|
+
* - `eslint-plugin-react-hooks`
|
|
155
|
+
* - `eslint-plugin-react-refresh`
|
|
156
|
+
*
|
|
157
|
+
* @default false
|
|
158
|
+
*/
|
|
159
|
+
react?: boolean;
|
|
160
|
+
/**
|
|
161
|
+
* Enable unocss rules.
|
|
162
|
+
*
|
|
163
|
+
* Requires installing:
|
|
164
|
+
* - `@unocss/eslint-plugin`
|
|
165
|
+
*
|
|
166
|
+
* @default false
|
|
167
|
+
*/
|
|
168
|
+
unocss?: boolean | OptionsUnoCSS;
|
|
127
169
|
/**
|
|
128
170
|
* Control to disable some rules in editors.
|
|
129
171
|
* @default auto-detect based on the process.env
|
|
@@ -133,76 +175,73 @@ interface OptionsConfig extends OptionsComponentExts {
|
|
|
133
175
|
* Provide overrides for rules for each integration.
|
|
134
176
|
*/
|
|
135
177
|
overrides?: {
|
|
136
|
-
javascript?:
|
|
137
|
-
typescript?:
|
|
138
|
-
test?:
|
|
139
|
-
vue?:
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
yaml?: FlatESLintConfigItem['rules'];
|
|
178
|
+
javascript?: FlatConfigItem['rules'];
|
|
179
|
+
typescript?: FlatConfigItem['rules'];
|
|
180
|
+
test?: FlatConfigItem['rules'];
|
|
181
|
+
vue?: FlatConfigItem['rules'];
|
|
182
|
+
jsonc?: FlatConfigItem['rules'];
|
|
183
|
+
markdown?: FlatConfigItem['rules'];
|
|
184
|
+
yaml?: FlatConfigItem['rules'];
|
|
185
|
+
react?: FlatConfigItem['rules'];
|
|
145
186
|
};
|
|
146
187
|
}
|
|
147
188
|
|
|
148
189
|
/**
|
|
149
190
|
* Construct an array of ESLint flat config items.
|
|
150
191
|
*/
|
|
151
|
-
declare function coderwyd(options?: OptionsConfig &
|
|
192
|
+
declare function coderwyd(options?: OptionsConfig & FlatConfigItem, ...userConfigs: Awaitable<UserConfigItem | UserConfigItem[]>[]): Promise<UserConfigItem[]>;
|
|
152
193
|
|
|
153
|
-
declare function comments():
|
|
194
|
+
declare function comments(): Promise<FlatConfigItem[]>;
|
|
154
195
|
|
|
155
|
-
declare function ignores():
|
|
196
|
+
declare function ignores(): Promise<FlatConfigItem[]>;
|
|
156
197
|
|
|
157
|
-
declare function imports(options?: OptionsStylistic):
|
|
198
|
+
declare function imports(options?: OptionsStylistic): Promise<FlatConfigItem[]>;
|
|
158
199
|
|
|
159
|
-
declare function javascript(options?: OptionsIsInEditor & OptionsOverrides):
|
|
200
|
+
declare function javascript(options?: OptionsIsInEditor & OptionsOverrides): Promise<FlatConfigItem[]>;
|
|
160
201
|
|
|
161
|
-
declare function jsdoc(options?: OptionsStylistic):
|
|
202
|
+
declare function jsdoc(options?: OptionsStylistic): Promise<FlatConfigItem[]>;
|
|
162
203
|
|
|
163
|
-
declare function jsonc(options?: OptionsStylistic & OptionsOverrides):
|
|
204
|
+
declare function jsonc(options?: OptionsFiles & OptionsStylistic & OptionsOverrides): Promise<FlatConfigItem[]>;
|
|
164
205
|
|
|
165
|
-
declare function markdown(options?: OptionsComponentExts & OptionsOverrides):
|
|
206
|
+
declare function markdown(options?: OptionsFiles & OptionsComponentExts & OptionsOverrides): Promise<FlatConfigItem[]>;
|
|
166
207
|
|
|
167
|
-
declare function node():
|
|
208
|
+
declare function node(): Promise<FlatConfigItem[]>;
|
|
168
209
|
|
|
169
210
|
/**
|
|
170
211
|
* Sort package.json
|
|
171
212
|
*
|
|
172
213
|
* Requires `jsonc` config
|
|
173
214
|
*/
|
|
174
|
-
declare function sortPackageJson():
|
|
215
|
+
declare function sortPackageJson(): Promise<FlatConfigItem[]>;
|
|
175
216
|
/**
|
|
176
217
|
* Sort tsconfig.json
|
|
177
218
|
*
|
|
178
219
|
* Requires `jsonc` config
|
|
179
220
|
*/
|
|
180
|
-
declare function sortTsconfig():
|
|
221
|
+
declare function sortTsconfig(): FlatConfigItem[];
|
|
181
222
|
|
|
182
|
-
declare function stylistic():
|
|
223
|
+
declare function stylistic(options?: StylisticConfig): Promise<FlatConfigItem[]>;
|
|
183
224
|
|
|
184
|
-
declare function typescript(options?: OptionsComponentExts & OptionsOverrides & OptionsTypeScriptWithTypes & OptionsTypeScriptParserOptions):
|
|
225
|
+
declare function typescript(options?: OptionsFiles & OptionsComponentExts & OptionsOverrides & OptionsTypeScriptWithTypes & OptionsTypeScriptParserOptions): Promise<FlatConfigItem[]>;
|
|
185
226
|
|
|
186
|
-
declare function unicorn():
|
|
227
|
+
declare function unicorn(): Promise<FlatConfigItem[]>;
|
|
187
228
|
|
|
188
|
-
declare function
|
|
189
|
-
declare function vue(options?: OptionsHasTypeScript & OptionsOverrides & OptionsStylistic): FlatESLintConfigItem[];
|
|
229
|
+
declare function vue(options?: OptionsHasTypeScript & OptionsOverrides & OptionsStylistic & OptionsFiles): Promise<FlatConfigItem[]>;
|
|
190
230
|
|
|
191
|
-
declare function yaml(options?: OptionsOverrides & OptionsStylistic):
|
|
231
|
+
declare function yaml(options?: OptionsOverrides & OptionsStylistic & OptionsFiles): Promise<FlatConfigItem[]>;
|
|
192
232
|
|
|
193
|
-
declare function test(options?: OptionsIsInEditor & OptionsOverrides):
|
|
194
|
-
|
|
195
|
-
declare function react(options?: OptionsHasTypeScript & OptionsOverrides): FlatESLintConfigItem[];
|
|
196
|
-
|
|
197
|
-
declare function astro(options?: OptionsHasTypeScript & OptionsOverrides): FlatESLintConfigItem[];
|
|
233
|
+
declare function test(options?: OptionsFiles & OptionsIsInEditor & OptionsOverrides): Promise<FlatConfigItem[]>;
|
|
198
234
|
|
|
199
235
|
/**
|
|
200
|
-
*
|
|
236
|
+
* Optional perfectionist plugin for props and items sorting.
|
|
237
|
+
*
|
|
238
|
+
* @see https://github.com/azat-io/eslint-plugin-perfectionist
|
|
201
239
|
*/
|
|
202
|
-
declare function
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
240
|
+
declare function perfectionist(): Promise<FlatConfigItem[]>;
|
|
241
|
+
|
|
242
|
+
declare function react(options?: OptionsHasTypeScript & OptionsOverrides & OptionsFiles): Promise<FlatConfigItem[]>;
|
|
243
|
+
|
|
244
|
+
declare function unocss(options?: OptionsUnoCSS): Promise<FlatConfigItem[]>;
|
|
206
245
|
|
|
207
246
|
declare const GLOB_SRC_EXT = "?([cm])[jt]s?(x)";
|
|
208
247
|
declare const GLOB_SRC = "**/*.?([cm])[jt]s?(x)";
|
|
@@ -221,10 +260,23 @@ declare const GLOB_MARKDOWN = "**/*.md";
|
|
|
221
260
|
declare const GLOB_VUE = "**/*.vue";
|
|
222
261
|
declare const GLOB_YAML = "**/*.y?(a)ml";
|
|
223
262
|
declare const GLOB_HTML = "**/*.htm?(l)";
|
|
224
|
-
declare const GLOB_ASTRO = "**/*.astro";
|
|
225
263
|
declare const GLOB_MARKDOWN_CODE = "**/*.md/**/*.?([cm])[jt]s?(x)";
|
|
226
264
|
declare const GLOB_TESTS: string[];
|
|
227
265
|
declare const GLOB_ALL_SRC: string[];
|
|
228
266
|
declare const GLOB_EXCLUDE: string[];
|
|
229
267
|
|
|
230
|
-
|
|
268
|
+
/**
|
|
269
|
+
* Combine array and non-array configs into a single array.
|
|
270
|
+
*/
|
|
271
|
+
declare function combine(...configs: Awaitable<UserConfigItem | UserConfigItem[]>[]): Promise<UserConfigItem[]>;
|
|
272
|
+
declare function renameRules(rules: Record<string, any>, from: string, to: string): {
|
|
273
|
+
[k: string]: any;
|
|
274
|
+
};
|
|
275
|
+
declare function getVueVersion(): number;
|
|
276
|
+
declare function toArray<T>(value: T | T[]): T[];
|
|
277
|
+
declare function interopDefault<T>(m: Awaitable<T>): Promise<T extends {
|
|
278
|
+
default: infer U;
|
|
279
|
+
} ? U : T>;
|
|
280
|
+
declare function ensurePackages(packages: string[]): Promise<void>;
|
|
281
|
+
|
|
282
|
+
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 OptionsIsInEditor, type OptionsOverrides, type OptionsStylistic, type OptionsTypeScriptParserOptions, type OptionsTypeScriptWithTypes, type OptionsUnoCSS, type Rules, type StylisticConfig, type UserConfigItem, type WrapRuleConfig, coderwyd, combine, comments, coderwyd as default, ensurePackages, getVueVersion, ignores, imports, interopDefault, javascript, jsdoc, jsonc, markdown, node, perfectionist, react, renameRules, sortPackageJson, sortTsconfig, stylistic, test, toArray, typescript, unicorn, unocss, vue, yaml };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,29 +1,41 @@
|
|
|
1
|
-
import { FlatESLintConfigItem } from 'eslint-define-config';
|
|
2
1
|
import { FlatGitignoreOptions } from 'eslint-config-flat-gitignore';
|
|
3
2
|
import { ParserOptions } from '@typescript-eslint/parser';
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
export { default as pluginNode } from 'eslint-plugin-n';
|
|
12
|
-
export { default as pluginStylistic } from '@stylistic/eslint-plugin';
|
|
13
|
-
export { default as pluginTs } from '@typescript-eslint/eslint-plugin';
|
|
14
|
-
export { default as pluginUnicorn } from 'eslint-plugin-unicorn';
|
|
15
|
-
export { default as pluginUnusedImports } from 'eslint-plugin-unused-imports';
|
|
16
|
-
export { default as pluginVue } from 'eslint-plugin-vue';
|
|
17
|
-
export { default as pluginYaml } from 'eslint-plugin-yml';
|
|
18
|
-
export { default as pluginNoOnlyTests } from 'eslint-plugin-no-only-tests';
|
|
19
|
-
export { default as pluginReact } from 'eslint-plugin-react';
|
|
20
|
-
export { default as pluginReactHooks } from 'eslint-plugin-react-hooks';
|
|
21
|
-
export { default as pluginAstro } from 'eslint-plugin-astro';
|
|
22
|
-
export { default as parserVue } from 'vue-eslint-parser';
|
|
23
|
-
export { default as parserYaml } from 'yaml-eslint-parser';
|
|
24
|
-
export { default as parserJsonc } from 'jsonc-eslint-parser';
|
|
25
|
-
export { default as parserAstro } from 'astro-eslint-parser';
|
|
3
|
+
import { Linter } from 'eslint';
|
|
4
|
+
import { RuleConfig, MergeIntersection, RenamePrefix, VitestRules, YmlRules, NRules, Prefix, ReactHooksRules, ReactRules, ImportRules, EslintRules, JsoncRules, VueRules, EslintCommentsRules, FlatESLintConfigItem } from '@antfu/eslint-define-config';
|
|
5
|
+
import { RuleOptions as RuleOptions$1 } from '@eslint-types/jsdoc/types';
|
|
6
|
+
import { RuleOptions } from '@eslint-types/typescript-eslint/types';
|
|
7
|
+
import { RuleOptions as RuleOptions$2 } from '@eslint-types/unicorn/types';
|
|
8
|
+
import { Rules as Rules$1 } from 'eslint-plugin-antfu';
|
|
9
|
+
import { UnprefixedRuleOptions, StylisticCustomizeOptions } from '@stylistic/eslint-plugin';
|
|
26
10
|
|
|
11
|
+
type WrapRuleConfig<T extends {
|
|
12
|
+
[key: string]: any;
|
|
13
|
+
}> = {
|
|
14
|
+
[K in keyof T]: T[K] extends RuleConfig ? T[K] : RuleConfig<T[K]>;
|
|
15
|
+
};
|
|
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/'> & ReactHooksRules & ReactRules & RuleOptions$1 & ImportRules & EslintRules & JsoncRules & VueRules & RuleOptions$2 & EslintCommentsRules & {
|
|
18
|
+
'test/no-only-tests': RuleConfig<[]>;
|
|
19
|
+
}>>;
|
|
20
|
+
type FlatConfigItem = Omit<FlatESLintConfigItem<Rules, false>, 'plugins'> & {
|
|
21
|
+
/**
|
|
22
|
+
* Custom name of each config item
|
|
23
|
+
*/
|
|
24
|
+
name?: string;
|
|
25
|
+
/**
|
|
26
|
+
* An object containing a name-value mapping of plugin names to plugin objects. When `files` is specified, these plugins are only available to the matching files.
|
|
27
|
+
*
|
|
28
|
+
* @see [Using plugins in your configuration](https://eslint.org/docs/latest/user-guide/configuring/configuration-files-new#using-plugins-in-your-configuration)
|
|
29
|
+
*/
|
|
30
|
+
plugins?: Record<string, any>;
|
|
31
|
+
};
|
|
32
|
+
type UserConfigItem = FlatConfigItem | Linter.FlatConfig;
|
|
33
|
+
interface OptionsFiles {
|
|
34
|
+
/**
|
|
35
|
+
* Override the `files` option to provide custom globs.
|
|
36
|
+
*/
|
|
37
|
+
files?: string[];
|
|
38
|
+
}
|
|
27
39
|
interface OptionsComponentExts {
|
|
28
40
|
/**
|
|
29
41
|
* Additional extensions for components.
|
|
@@ -44,20 +56,34 @@ interface OptionsTypeScriptWithTypes {
|
|
|
44
56
|
* When this options is provided, type aware rules will be enabled.
|
|
45
57
|
* @see https://typescript-eslint.io/linting/typed-linting/
|
|
46
58
|
*/
|
|
47
|
-
tsconfigPath?: string;
|
|
59
|
+
tsconfigPath?: string | string[];
|
|
48
60
|
}
|
|
49
61
|
interface OptionsHasTypeScript {
|
|
50
62
|
typescript?: boolean;
|
|
51
63
|
}
|
|
52
64
|
interface OptionsStylistic {
|
|
53
|
-
stylistic?: boolean;
|
|
65
|
+
stylistic?: boolean | StylisticConfig;
|
|
66
|
+
}
|
|
67
|
+
interface StylisticConfig extends Pick<StylisticCustomizeOptions, 'indent' | 'quotes' | 'jsx' | 'semi'> {
|
|
54
68
|
}
|
|
55
69
|
interface OptionsOverrides {
|
|
56
|
-
overrides?:
|
|
70
|
+
overrides?: FlatConfigItem['rules'];
|
|
57
71
|
}
|
|
58
72
|
interface OptionsIsInEditor {
|
|
59
73
|
isInEditor?: boolean;
|
|
60
74
|
}
|
|
75
|
+
interface OptionsUnoCSS {
|
|
76
|
+
/**
|
|
77
|
+
* Enable attributify support.
|
|
78
|
+
* @default true
|
|
79
|
+
*/
|
|
80
|
+
attributify?: boolean;
|
|
81
|
+
/**
|
|
82
|
+
* Enable strict mode by throwing errors about blocklisted classes.
|
|
83
|
+
* @default false
|
|
84
|
+
*/
|
|
85
|
+
strict?: boolean;
|
|
86
|
+
}
|
|
61
87
|
interface OptionsConfig extends OptionsComponentExts {
|
|
62
88
|
/**
|
|
63
89
|
* Enable gitignore support.
|
|
@@ -75,7 +101,15 @@ interface OptionsConfig extends OptionsComponentExts {
|
|
|
75
101
|
*
|
|
76
102
|
* @default auto-detect based on the dependencies
|
|
77
103
|
*/
|
|
78
|
-
typescript?: boolean | OptionsTypeScriptWithTypes;
|
|
104
|
+
typescript?: boolean | OptionsTypeScriptWithTypes | OptionsTypeScriptParserOptions;
|
|
105
|
+
/**
|
|
106
|
+
* Enable JSX related rules.
|
|
107
|
+
*
|
|
108
|
+
* Currently only stylistic rules are included.
|
|
109
|
+
*
|
|
110
|
+
* @default true
|
|
111
|
+
*/
|
|
112
|
+
jsx?: boolean;
|
|
79
113
|
/**
|
|
80
114
|
* Enable test support.
|
|
81
115
|
*
|
|
@@ -88,18 +122,6 @@ interface OptionsConfig extends OptionsComponentExts {
|
|
|
88
122
|
* @default auto-detect based on the dependencies
|
|
89
123
|
*/
|
|
90
124
|
vue?: boolean;
|
|
91
|
-
/**
|
|
92
|
-
* Enable React support.
|
|
93
|
-
*
|
|
94
|
-
* @default auto-detect based on the dependencies
|
|
95
|
-
*/
|
|
96
|
-
react?: boolean;
|
|
97
|
-
/**
|
|
98
|
-
* Enable Astro support.
|
|
99
|
-
*
|
|
100
|
-
* @default auto-detect based on the dependencies
|
|
101
|
-
*/
|
|
102
|
-
astro?: boolean;
|
|
103
125
|
/**
|
|
104
126
|
* Enable JSONC support.
|
|
105
127
|
*
|
|
@@ -123,7 +145,27 @@ interface OptionsConfig extends OptionsComponentExts {
|
|
|
123
145
|
*
|
|
124
146
|
* @default true
|
|
125
147
|
*/
|
|
126
|
-
stylistic?: boolean;
|
|
148
|
+
stylistic?: boolean | StylisticConfig;
|
|
149
|
+
/**
|
|
150
|
+
* Enable react rules.
|
|
151
|
+
*
|
|
152
|
+
* Requires installing:
|
|
153
|
+
* - `eslint-plugin-react`
|
|
154
|
+
* - `eslint-plugin-react-hooks`
|
|
155
|
+
* - `eslint-plugin-react-refresh`
|
|
156
|
+
*
|
|
157
|
+
* @default false
|
|
158
|
+
*/
|
|
159
|
+
react?: boolean;
|
|
160
|
+
/**
|
|
161
|
+
* Enable unocss rules.
|
|
162
|
+
*
|
|
163
|
+
* Requires installing:
|
|
164
|
+
* - `@unocss/eslint-plugin`
|
|
165
|
+
*
|
|
166
|
+
* @default false
|
|
167
|
+
*/
|
|
168
|
+
unocss?: boolean | OptionsUnoCSS;
|
|
127
169
|
/**
|
|
128
170
|
* Control to disable some rules in editors.
|
|
129
171
|
* @default auto-detect based on the process.env
|
|
@@ -133,76 +175,73 @@ interface OptionsConfig extends OptionsComponentExts {
|
|
|
133
175
|
* Provide overrides for rules for each integration.
|
|
134
176
|
*/
|
|
135
177
|
overrides?: {
|
|
136
|
-
javascript?:
|
|
137
|
-
typescript?:
|
|
138
|
-
test?:
|
|
139
|
-
vue?:
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
yaml?: FlatESLintConfigItem['rules'];
|
|
178
|
+
javascript?: FlatConfigItem['rules'];
|
|
179
|
+
typescript?: FlatConfigItem['rules'];
|
|
180
|
+
test?: FlatConfigItem['rules'];
|
|
181
|
+
vue?: FlatConfigItem['rules'];
|
|
182
|
+
jsonc?: FlatConfigItem['rules'];
|
|
183
|
+
markdown?: FlatConfigItem['rules'];
|
|
184
|
+
yaml?: FlatConfigItem['rules'];
|
|
185
|
+
react?: FlatConfigItem['rules'];
|
|
145
186
|
};
|
|
146
187
|
}
|
|
147
188
|
|
|
148
189
|
/**
|
|
149
190
|
* Construct an array of ESLint flat config items.
|
|
150
191
|
*/
|
|
151
|
-
declare function coderwyd(options?: OptionsConfig &
|
|
192
|
+
declare function coderwyd(options?: OptionsConfig & FlatConfigItem, ...userConfigs: Awaitable<UserConfigItem | UserConfigItem[]>[]): Promise<UserConfigItem[]>;
|
|
152
193
|
|
|
153
|
-
declare function comments():
|
|
194
|
+
declare function comments(): Promise<FlatConfigItem[]>;
|
|
154
195
|
|
|
155
|
-
declare function ignores():
|
|
196
|
+
declare function ignores(): Promise<FlatConfigItem[]>;
|
|
156
197
|
|
|
157
|
-
declare function imports(options?: OptionsStylistic):
|
|
198
|
+
declare function imports(options?: OptionsStylistic): Promise<FlatConfigItem[]>;
|
|
158
199
|
|
|
159
|
-
declare function javascript(options?: OptionsIsInEditor & OptionsOverrides):
|
|
200
|
+
declare function javascript(options?: OptionsIsInEditor & OptionsOverrides): Promise<FlatConfigItem[]>;
|
|
160
201
|
|
|
161
|
-
declare function jsdoc(options?: OptionsStylistic):
|
|
202
|
+
declare function jsdoc(options?: OptionsStylistic): Promise<FlatConfigItem[]>;
|
|
162
203
|
|
|
163
|
-
declare function jsonc(options?: OptionsStylistic & OptionsOverrides):
|
|
204
|
+
declare function jsonc(options?: OptionsFiles & OptionsStylistic & OptionsOverrides): Promise<FlatConfigItem[]>;
|
|
164
205
|
|
|
165
|
-
declare function markdown(options?: OptionsComponentExts & OptionsOverrides):
|
|
206
|
+
declare function markdown(options?: OptionsFiles & OptionsComponentExts & OptionsOverrides): Promise<FlatConfigItem[]>;
|
|
166
207
|
|
|
167
|
-
declare function node():
|
|
208
|
+
declare function node(): Promise<FlatConfigItem[]>;
|
|
168
209
|
|
|
169
210
|
/**
|
|
170
211
|
* Sort package.json
|
|
171
212
|
*
|
|
172
213
|
* Requires `jsonc` config
|
|
173
214
|
*/
|
|
174
|
-
declare function sortPackageJson():
|
|
215
|
+
declare function sortPackageJson(): Promise<FlatConfigItem[]>;
|
|
175
216
|
/**
|
|
176
217
|
* Sort tsconfig.json
|
|
177
218
|
*
|
|
178
219
|
* Requires `jsonc` config
|
|
179
220
|
*/
|
|
180
|
-
declare function sortTsconfig():
|
|
221
|
+
declare function sortTsconfig(): FlatConfigItem[];
|
|
181
222
|
|
|
182
|
-
declare function stylistic():
|
|
223
|
+
declare function stylistic(options?: StylisticConfig): Promise<FlatConfigItem[]>;
|
|
183
224
|
|
|
184
|
-
declare function typescript(options?: OptionsComponentExts & OptionsOverrides & OptionsTypeScriptWithTypes & OptionsTypeScriptParserOptions):
|
|
225
|
+
declare function typescript(options?: OptionsFiles & OptionsComponentExts & OptionsOverrides & OptionsTypeScriptWithTypes & OptionsTypeScriptParserOptions): Promise<FlatConfigItem[]>;
|
|
185
226
|
|
|
186
|
-
declare function unicorn():
|
|
227
|
+
declare function unicorn(): Promise<FlatConfigItem[]>;
|
|
187
228
|
|
|
188
|
-
declare function
|
|
189
|
-
declare function vue(options?: OptionsHasTypeScript & OptionsOverrides & OptionsStylistic): FlatESLintConfigItem[];
|
|
229
|
+
declare function vue(options?: OptionsHasTypeScript & OptionsOverrides & OptionsStylistic & OptionsFiles): Promise<FlatConfigItem[]>;
|
|
190
230
|
|
|
191
|
-
declare function yaml(options?: OptionsOverrides & OptionsStylistic):
|
|
231
|
+
declare function yaml(options?: OptionsOverrides & OptionsStylistic & OptionsFiles): Promise<FlatConfigItem[]>;
|
|
192
232
|
|
|
193
|
-
declare function test(options?: OptionsIsInEditor & OptionsOverrides):
|
|
194
|
-
|
|
195
|
-
declare function react(options?: OptionsHasTypeScript & OptionsOverrides): FlatESLintConfigItem[];
|
|
196
|
-
|
|
197
|
-
declare function astro(options?: OptionsHasTypeScript & OptionsOverrides): FlatESLintConfigItem[];
|
|
233
|
+
declare function test(options?: OptionsFiles & OptionsIsInEditor & OptionsOverrides): Promise<FlatConfigItem[]>;
|
|
198
234
|
|
|
199
235
|
/**
|
|
200
|
-
*
|
|
236
|
+
* Optional perfectionist plugin for props and items sorting.
|
|
237
|
+
*
|
|
238
|
+
* @see https://github.com/azat-io/eslint-plugin-perfectionist
|
|
201
239
|
*/
|
|
202
|
-
declare function
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
240
|
+
declare function perfectionist(): Promise<FlatConfigItem[]>;
|
|
241
|
+
|
|
242
|
+
declare function react(options?: OptionsHasTypeScript & OptionsOverrides & OptionsFiles): Promise<FlatConfigItem[]>;
|
|
243
|
+
|
|
244
|
+
declare function unocss(options?: OptionsUnoCSS): Promise<FlatConfigItem[]>;
|
|
206
245
|
|
|
207
246
|
declare const GLOB_SRC_EXT = "?([cm])[jt]s?(x)";
|
|
208
247
|
declare const GLOB_SRC = "**/*.?([cm])[jt]s?(x)";
|
|
@@ -221,10 +260,23 @@ declare const GLOB_MARKDOWN = "**/*.md";
|
|
|
221
260
|
declare const GLOB_VUE = "**/*.vue";
|
|
222
261
|
declare const GLOB_YAML = "**/*.y?(a)ml";
|
|
223
262
|
declare const GLOB_HTML = "**/*.htm?(l)";
|
|
224
|
-
declare const GLOB_ASTRO = "**/*.astro";
|
|
225
263
|
declare const GLOB_MARKDOWN_CODE = "**/*.md/**/*.?([cm])[jt]s?(x)";
|
|
226
264
|
declare const GLOB_TESTS: string[];
|
|
227
265
|
declare const GLOB_ALL_SRC: string[];
|
|
228
266
|
declare const GLOB_EXCLUDE: string[];
|
|
229
267
|
|
|
230
|
-
|
|
268
|
+
/**
|
|
269
|
+
* Combine array and non-array configs into a single array.
|
|
270
|
+
*/
|
|
271
|
+
declare function combine(...configs: Awaitable<UserConfigItem | UserConfigItem[]>[]): Promise<UserConfigItem[]>;
|
|
272
|
+
declare function renameRules(rules: Record<string, any>, from: string, to: string): {
|
|
273
|
+
[k: string]: any;
|
|
274
|
+
};
|
|
275
|
+
declare function getVueVersion(): number;
|
|
276
|
+
declare function toArray<T>(value: T | T[]): T[];
|
|
277
|
+
declare function interopDefault<T>(m: Awaitable<T>): Promise<T extends {
|
|
278
|
+
default: infer U;
|
|
279
|
+
} ? U : T>;
|
|
280
|
+
declare function ensurePackages(packages: string[]): Promise<void>;
|
|
281
|
+
|
|
282
|
+
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 OptionsIsInEditor, type OptionsOverrides, type OptionsStylistic, type OptionsTypeScriptParserOptions, type OptionsTypeScriptWithTypes, type OptionsUnoCSS, type Rules, type StylisticConfig, type UserConfigItem, type WrapRuleConfig, coderwyd, combine, comments, coderwyd as default, ensurePackages, getVueVersion, ignores, imports, interopDefault, javascript, jsdoc, jsonc, markdown, node, perfectionist, react, renameRules, sortPackageJson, sortTsconfig, stylistic, test, toArray, typescript, unicorn, unocss, vue, yaml };
|