@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/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
- export { default as parserTs } from '@typescript-eslint/parser';
5
- export { default as pluginAntfu } from 'eslint-plugin-antfu';
6
- export { default as pluginComments } from 'eslint-plugin-eslint-comments';
7
- export { default as pluginImport } from 'eslint-plugin-i';
8
- export { default as pluginJsdoc } from 'eslint-plugin-jsdoc';
9
- export { default as pluginJsonc } from 'eslint-plugin-jsonc';
10
- export { default as pluginMarkdown } from 'eslint-plugin-markdown';
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?: FlatESLintConfigItem['rules'];
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?: FlatESLintConfigItem['rules'];
137
- typescript?: FlatESLintConfigItem['rules'];
138
- test?: FlatESLintConfigItem['rules'];
139
- vue?: FlatESLintConfigItem['rules'];
140
- react?: FlatESLintConfigItem['rules'];
141
- astro?: FlatESLintConfigItem['rules'];
142
- jsonc?: FlatESLintConfigItem['rules'];
143
- markdown?: FlatESLintConfigItem['rules'];
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 & FlatESLintConfigItem, ...userConfigs: (FlatESLintConfigItem | FlatESLintConfigItem[])[]): FlatESLintConfigItem[];
192
+ declare function coderwyd(options?: OptionsConfig & FlatConfigItem, ...userConfigs: Awaitable<UserConfigItem | UserConfigItem[]>[]): Promise<UserConfigItem[]>;
152
193
 
153
- declare function comments(): FlatESLintConfigItem[];
194
+ declare function comments(): Promise<FlatConfigItem[]>;
154
195
 
155
- declare function ignores(): FlatESLintConfigItem[];
196
+ declare function ignores(): Promise<FlatConfigItem[]>;
156
197
 
157
- declare function imports(options?: OptionsStylistic): FlatESLintConfigItem[];
198
+ declare function imports(options?: OptionsStylistic): Promise<FlatConfigItem[]>;
158
199
 
159
- declare function javascript(options?: OptionsIsInEditor & OptionsOverrides): FlatESLintConfigItem[];
200
+ declare function javascript(options?: OptionsIsInEditor & OptionsOverrides): Promise<FlatConfigItem[]>;
160
201
 
161
- declare function jsdoc(options?: OptionsStylistic): FlatESLintConfigItem[];
202
+ declare function jsdoc(options?: OptionsStylistic): Promise<FlatConfigItem[]>;
162
203
 
163
- declare function jsonc(options?: OptionsStylistic & OptionsOverrides): FlatESLintConfigItem[];
204
+ declare function jsonc(options?: OptionsFiles & OptionsStylistic & OptionsOverrides): Promise<FlatConfigItem[]>;
164
205
 
165
- declare function markdown(options?: OptionsComponentExts & OptionsOverrides): FlatESLintConfigItem[];
206
+ declare function markdown(options?: OptionsFiles & OptionsComponentExts & OptionsOverrides): Promise<FlatConfigItem[]>;
166
207
 
167
- declare function node(): FlatESLintConfigItem[];
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(): FlatESLintConfigItem[];
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(): FlatESLintConfigItem[];
221
+ declare function sortTsconfig(): FlatConfigItem[];
181
222
 
182
- declare function stylistic(): FlatESLintConfigItem[];
223
+ declare function stylistic(options?: StylisticConfig): Promise<FlatConfigItem[]>;
183
224
 
184
- declare function typescript(options?: OptionsComponentExts & OptionsOverrides & OptionsTypeScriptWithTypes & OptionsTypeScriptParserOptions): FlatESLintConfigItem[];
225
+ declare function typescript(options?: OptionsFiles & OptionsComponentExts & OptionsOverrides & OptionsTypeScriptWithTypes & OptionsTypeScriptParserOptions): Promise<FlatConfigItem[]>;
185
226
 
186
- declare function unicorn(): FlatESLintConfigItem[];
227
+ declare function unicorn(): Promise<FlatConfigItem[]>;
187
228
 
188
- declare function getVueVersion(): number;
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): FlatESLintConfigItem[];
231
+ declare function yaml(options?: OptionsOverrides & OptionsStylistic & OptionsFiles): Promise<FlatConfigItem[]>;
192
232
 
193
- declare function test(options?: OptionsIsInEditor & OptionsOverrides): FlatESLintConfigItem[];
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
- * Combine array and non-array configs into a single array.
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 combine(...configs: (FlatESLintConfigItem | FlatESLintConfigItem[])[]): FlatESLintConfigItem[];
203
- declare function renameRules(rules: Record<string, any>, from: string, to: string): {
204
- [k: string]: any;
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
- export { GLOB_ALL_SRC, GLOB_ASTRO, 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, OptionsComponentExts, OptionsConfig, OptionsHasTypeScript, OptionsIsInEditor, OptionsOverrides, OptionsStylistic, OptionsTypeScriptParserOptions, OptionsTypeScriptWithTypes, astro, coderwyd, combine, comments, coderwyd as default, getVueVersion, ignores, imports, javascript, jsdoc, jsonc, markdown, node, react, renameRules, sortPackageJson, sortTsconfig, stylistic, test, typescript, unicorn, vue, yaml };
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
- export { default as parserTs } from '@typescript-eslint/parser';
5
- export { default as pluginAntfu } from 'eslint-plugin-antfu';
6
- export { default as pluginComments } from 'eslint-plugin-eslint-comments';
7
- export { default as pluginImport } from 'eslint-plugin-i';
8
- export { default as pluginJsdoc } from 'eslint-plugin-jsdoc';
9
- export { default as pluginJsonc } from 'eslint-plugin-jsonc';
10
- export { default as pluginMarkdown } from 'eslint-plugin-markdown';
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?: FlatESLintConfigItem['rules'];
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?: FlatESLintConfigItem['rules'];
137
- typescript?: FlatESLintConfigItem['rules'];
138
- test?: FlatESLintConfigItem['rules'];
139
- vue?: FlatESLintConfigItem['rules'];
140
- react?: FlatESLintConfigItem['rules'];
141
- astro?: FlatESLintConfigItem['rules'];
142
- jsonc?: FlatESLintConfigItem['rules'];
143
- markdown?: FlatESLintConfigItem['rules'];
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 & FlatESLintConfigItem, ...userConfigs: (FlatESLintConfigItem | FlatESLintConfigItem[])[]): FlatESLintConfigItem[];
192
+ declare function coderwyd(options?: OptionsConfig & FlatConfigItem, ...userConfigs: Awaitable<UserConfigItem | UserConfigItem[]>[]): Promise<UserConfigItem[]>;
152
193
 
153
- declare function comments(): FlatESLintConfigItem[];
194
+ declare function comments(): Promise<FlatConfigItem[]>;
154
195
 
155
- declare function ignores(): FlatESLintConfigItem[];
196
+ declare function ignores(): Promise<FlatConfigItem[]>;
156
197
 
157
- declare function imports(options?: OptionsStylistic): FlatESLintConfigItem[];
198
+ declare function imports(options?: OptionsStylistic): Promise<FlatConfigItem[]>;
158
199
 
159
- declare function javascript(options?: OptionsIsInEditor & OptionsOverrides): FlatESLintConfigItem[];
200
+ declare function javascript(options?: OptionsIsInEditor & OptionsOverrides): Promise<FlatConfigItem[]>;
160
201
 
161
- declare function jsdoc(options?: OptionsStylistic): FlatESLintConfigItem[];
202
+ declare function jsdoc(options?: OptionsStylistic): Promise<FlatConfigItem[]>;
162
203
 
163
- declare function jsonc(options?: OptionsStylistic & OptionsOverrides): FlatESLintConfigItem[];
204
+ declare function jsonc(options?: OptionsFiles & OptionsStylistic & OptionsOverrides): Promise<FlatConfigItem[]>;
164
205
 
165
- declare function markdown(options?: OptionsComponentExts & OptionsOverrides): FlatESLintConfigItem[];
206
+ declare function markdown(options?: OptionsFiles & OptionsComponentExts & OptionsOverrides): Promise<FlatConfigItem[]>;
166
207
 
167
- declare function node(): FlatESLintConfigItem[];
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(): FlatESLintConfigItem[];
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(): FlatESLintConfigItem[];
221
+ declare function sortTsconfig(): FlatConfigItem[];
181
222
 
182
- declare function stylistic(): FlatESLintConfigItem[];
223
+ declare function stylistic(options?: StylisticConfig): Promise<FlatConfigItem[]>;
183
224
 
184
- declare function typescript(options?: OptionsComponentExts & OptionsOverrides & OptionsTypeScriptWithTypes & OptionsTypeScriptParserOptions): FlatESLintConfigItem[];
225
+ declare function typescript(options?: OptionsFiles & OptionsComponentExts & OptionsOverrides & OptionsTypeScriptWithTypes & OptionsTypeScriptParserOptions): Promise<FlatConfigItem[]>;
185
226
 
186
- declare function unicorn(): FlatESLintConfigItem[];
227
+ declare function unicorn(): Promise<FlatConfigItem[]>;
187
228
 
188
- declare function getVueVersion(): number;
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): FlatESLintConfigItem[];
231
+ declare function yaml(options?: OptionsOverrides & OptionsStylistic & OptionsFiles): Promise<FlatConfigItem[]>;
192
232
 
193
- declare function test(options?: OptionsIsInEditor & OptionsOverrides): FlatESLintConfigItem[];
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
- * Combine array and non-array configs into a single array.
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 combine(...configs: (FlatESLintConfigItem | FlatESLintConfigItem[])[]): FlatESLintConfigItem[];
203
- declare function renameRules(rules: Record<string, any>, from: string, to: string): {
204
- [k: string]: any;
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
- export { GLOB_ALL_SRC, GLOB_ASTRO, 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, OptionsComponentExts, OptionsConfig, OptionsHasTypeScript, OptionsIsInEditor, OptionsOverrides, OptionsStylistic, OptionsTypeScriptParserOptions, OptionsTypeScriptWithTypes, astro, coderwyd, combine, comments, coderwyd as default, getVueVersion, ignores, imports, javascript, jsdoc, jsonc, markdown, node, react, renameRules, sortPackageJson, sortTsconfig, stylistic, test, typescript, unicorn, vue, yaml };
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 };