@vinicunca/eslint-config 2.0.11 → 2.0.12

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,40 +1,29 @@
1
- import { MergeIntersection, EslintRules, Unprefix, ReactRules, TypeScriptRules, RenamePrefix, VitestRules, YmlRules, NRules, Prefix, ImportRules, JsoncRules, VueRules, UnicornRules, EslintCommentsRules, RuleConfig, FlatESLintConfigItem } from '@antfu/eslint-define-config';
1
+ import { RuleConfig, MergeIntersection, RenamePrefix, VitestRules, YmlRules, NRules, Prefix, ReactHooksRules, ReactRules, ImportRules, EslintRules, JsoncRules, VueRules, EslintCommentsRules, FlatESLintConfigItem } from '@antfu/eslint-define-config';
2
+ import { RuleOptions as RuleOptions$1 } from '@eslint-types/jsdoc/types';
3
+ import { RuleOptions } from '@eslint-types/typescript-eslint/types';
4
+ import { RuleOptions as RuleOptions$2 } from '@eslint-types/unicorn/types';
5
+ import { UnprefixedRuleOptions, StylisticCustomizeOptions } from '@stylistic/eslint-plugin';
2
6
  import { ParserOptions } from '@typescript-eslint/parser';
3
- import * as parser from '@typescript-eslint/parser';
4
- export { parser as parserTs };
5
7
  import { Rules as Rules$1 } from '@vinicunca/eslint-plugin-vinicunca';
6
8
  export { default as pluginVinicunca } from '@vinicunca/eslint-plugin-vinicunca';
7
- export { default as pluginStylistic } from '@stylistic/eslint-plugin';
8
- export { default as pluginTs } from '@typescript-eslint/eslint-plugin';
9
9
  export { default as pluginComments } from 'eslint-plugin-eslint-comments';
10
10
  import * as eslintPluginI from 'eslint-plugin-i';
11
11
  export { eslintPluginI as pluginImport };
12
- export { default as pluginJsdoc } from 'eslint-plugin-jsdoc';
13
- import * as eslintPluginJsonc from 'eslint-plugin-jsonc';
14
- export { eslintPluginJsonc as pluginJsonc };
15
- export { default as pluginMarkdown } from 'eslint-plugin-markdown';
16
12
  export { default as pluginNode } from 'eslint-plugin-n';
17
- export { default as pluginNoOnlyTests } from 'eslint-plugin-no-only-tests';
18
13
  export { default as pluginPerfectionist } from 'eslint-plugin-perfectionist';
19
- export { default as pluginReact } from 'eslint-plugin-react';
20
- export { default as pluginReactHooks } from 'eslint-plugin-react-hooks';
21
14
  export { default as pluginUnicorn } from 'eslint-plugin-unicorn';
22
15
  export { default as pluginUnusedImports } from 'eslint-plugin-unused-imports';
23
- export { default as pluginVitest } from 'eslint-plugin-vitest';
24
- export { default as pluginVue } from 'eslint-plugin-vue';
25
- import * as eslintPluginYml from 'eslint-plugin-yml';
26
- export { eslintPluginYml as pluginYaml };
27
- export { default as parserJsonc } from 'jsonc-eslint-parser';
28
- export { default as parserVue } from 'vue-eslint-parser';
29
- export { default as parserYaml } from 'yaml-eslint-parser';
30
-
31
- type MergedRules = MergeIntersection<EslintRules & Unprefix<ReactRules, 'react/'> & Unprefix<TypeScriptRules, '@typescript-eslint/'>>;
32
- type StylisticRules = Pick<MergedRules, 'array-bracket-newline' | 'array-bracket-spacing' | 'array-element-newline' | 'arrow-spacing' | 'block-spacing' | 'block-spacing' | 'brace-style' | 'brace-style' | 'comma-dangle' | 'comma-dangle' | 'comma-spacing' | 'comma-spacing' | 'comma-style' | 'computed-property-spacing' | 'dot-location' | 'eol-last' | 'func-call-spacing' | 'func-call-spacing' | 'function-call-argument-newline' | 'function-paren-newline' | 'generator-star-spacing' | 'implicit-arrow-linebreak' | 'indent' | 'indent' | 'jsx-child-element-spacing' | 'jsx-closing-bracket-location' | 'jsx-closing-tag-location' | 'jsx-curly-brace-presence' | 'jsx-curly-newline' | 'jsx-curly-spacing' | 'jsx-equals-spacing' | 'jsx-first-prop-new-line' | 'jsx-indent' | 'jsx-indent-props' | 'jsx-max-props-per-line' | 'jsx-newline' | 'jsx-one-expression-per-line' | 'jsx-props-no-multi-spaces' | 'jsx-quotes' | 'jsx-sort-props' | 'jsx-space-before-closing' | 'jsx-tag-spacing' | 'jsx-wrap-multilines' | 'key-spacing' | 'key-spacing' | 'keyword-spacing' | 'keyword-spacing' | 'linebreak-style' | 'lines-around-comment' | 'lines-around-comment' | 'lines-around-directive' | 'lines-between-class-members' | 'lines-between-class-members' | 'max-len' | 'max-statements-per-line' | 'member-delimiter-style' | 'multiline-ternary' | 'new-parens' | 'newline-after-var' | 'newline-before-return' | 'newline-per-chained-call' | 'no-confusing-arrow' | 'no-extra-parens' | 'no-extra-semi' | 'no-floating-decimal' | 'no-mixed-operators' | 'no-mixed-spaces-and-tabs' | 'no-multi-spaces' | 'no-multiple-empty-lines' | 'no-spaced-func' | 'no-tabs' | 'no-trailing-spaces' | 'no-whitespace-before-property' | 'nonblock-statement-body-position' | 'object-curly-newline' | 'object-curly-spacing' | 'object-curly-spacing' | 'object-property-newline' | 'one-var-declaration-per-line' | 'operator-linebreak' | 'padded-blocks' | 'padding-line-between-statements' | 'padding-line-between-statements' | 'quote-props' | 'quotes' | 'quotes' | 'rest-spread-spacing' | 'semi' | 'semi' | 'semi-spacing' | 'semi-style' | 'space-before-blocks' | 'space-before-blocks' | 'space-before-function-paren' | 'space-before-function-paren' | 'space-in-parens' | 'space-infix-ops' | 'space-infix-ops' | 'space-unary-ops' | 'spaced-comment' | 'switch-colon-spacing' | 'template-curly-spacing' | 'template-tag-spacing' | 'type-annotation-spacing' | 'wrap-iife' | 'wrap-regex' | 'yield-star-spacing'>;
33
-
34
- type Rules = MergeIntersection<RenamePrefix<TypeScriptRules, '@typescript-eslint/', 'ts/'> & RenamePrefix<VitestRules, 'vitest/', 'test/'> & RenamePrefix<YmlRules, 'yml/', 'yaml/'> & RenamePrefix<NRules, 'n/', 'node/'> & Prefix<StylisticRules, 'style/'> & Prefix<Rules$1, 'vinicunca/'> & ImportRules & EslintRules & JsoncRules & VueRules & UnicornRules & EslintCommentsRules & {
16
+
17
+ type WrapRuleConfig<T extends {
18
+ [key: string]: any;
19
+ }> = {
20
+ [K in keyof T]: T[K] extends RuleConfig ? T[K] : RuleConfig<T[K]>;
21
+ };
22
+ type Awaitable<T> = Promise<T> | T;
23
+ 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, 'vinicunca/'> & ReactHooksRules & ReactRules & RuleOptions$1 & ImportRules & EslintRules & JsoncRules & VueRules & RuleOptions$2 & EslintCommentsRules & {
35
24
  'test/no-only-tests': RuleConfig<[]>;
36
- }>;
37
- type ConfigItem = Omit<FlatESLintConfigItem<Rules, false>, 'plugins'> & {
25
+ }>>;
26
+ type FlatConfigItem = Omit<FlatESLintConfigItem<Rules, false>, 'plugins'> & {
38
27
  /**
39
28
  * The name of the configuration object.
40
29
  */
@@ -46,6 +35,65 @@ type ConfigItem = Omit<FlatESLintConfigItem<Rules, false>, 'plugins'> & {
46
35
  */
47
36
  plugins?: Record<string, any>;
48
37
  };
38
+ interface OptionsFiles {
39
+ /**
40
+ * Override the `files` option to provide custom globs.
41
+ */
42
+ files?: string[];
43
+ }
44
+ interface OptionsComponentExts {
45
+ /**
46
+ * Additional extensions for components.
47
+ *
48
+ * @example ['vue']
49
+ * @default []
50
+ */
51
+ componentExts?: string[];
52
+ }
53
+ interface OptionsTypeScriptParserOptions {
54
+ /**
55
+ * Additional parser options for TypeScript.
56
+ */
57
+ parserOptions?: Partial<ParserOptions>;
58
+ }
59
+ interface OptionsHasTypeScript {
60
+ typescript?: OptionsConfig['typescript'];
61
+ }
62
+ interface OptionsTypeScriptWithTypes {
63
+ /**
64
+ * When this options is provided, type aware rules will be enabled.
65
+ * @see https://typescript-eslint.io/linting/typed-linting/
66
+ */
67
+ tsconfigPath?: string[];
68
+ }
69
+ interface OptionsStylistic {
70
+ stylistic?: StylisticConfig | boolean;
71
+ }
72
+ interface StylisticConfig extends Pick<StylisticCustomizeOptions, 'indent' | 'jsx' | 'quotes' | 'semi'> {
73
+ }
74
+ interface OptionsOverrides {
75
+ overrides?: FlatConfigItem['rules'];
76
+ }
77
+ interface OptionsIsInEditor {
78
+ isInEditor?: boolean;
79
+ }
80
+ interface OptionsUnoCSS {
81
+ /**
82
+ * Enable attributify support.
83
+ * @default true
84
+ */
85
+ attributify?: boolean;
86
+ /**
87
+ * Enable strict mode by throwing errors about blocklisted classes.
88
+ * @default false
89
+ */
90
+ strict?: boolean;
91
+ }
92
+ interface OptionsIgnores {
93
+ enableGitignore?: boolean;
94
+ items?: string[];
95
+ replace?: boolean;
96
+ }
49
97
  interface OptionsConfig extends OptionsComponentExts {
50
98
  /**
51
99
  * Additional options for the ignore rules.
@@ -80,14 +128,14 @@ interface OptionsConfig extends OptionsComponentExts {
80
128
  * Provide overrides for rules for each integration.
81
129
  */
82
130
  overrides?: {
83
- javascript?: ConfigItem['rules'];
84
- jsonc?: ConfigItem['rules'];
85
- markdown?: ConfigItem['rules'];
86
- react?: ConfigItem['rules'];
87
- test?: ConfigItem['rules'];
88
- typescript?: ConfigItem['rules'];
89
- vue?: ConfigItem['rules'];
90
- yaml?: ConfigItem['rules'];
131
+ javascript?: FlatConfigItem['rules'];
132
+ jsonc?: FlatConfigItem['rules'];
133
+ markdown?: FlatConfigItem['rules'];
134
+ react?: FlatConfigItem['rules'];
135
+ test?: FlatConfigItem['rules'];
136
+ typescript?: FlatConfigItem['rules'];
137
+ vue?: FlatConfigItem['rules'];
138
+ yaml?: FlatConfigItem['rules'];
91
139
  };
92
140
  /**
93
141
  * Enable react support.
@@ -101,7 +149,7 @@ interface OptionsConfig extends OptionsComponentExts {
101
149
  *
102
150
  * @default true
103
151
  */
104
- stylistic?: boolean;
152
+ stylistic?: StylisticConfig | boolean;
105
153
  /**
106
154
  * Enable test support.
107
155
  *
@@ -118,6 +166,15 @@ interface OptionsConfig extends OptionsComponentExts {
118
166
  typescript?: OptionsTypeScriptWithTypes & OptionsTypeScriptParserOptions & {
119
167
  enabled?: boolean;
120
168
  };
169
+ /**
170
+ * Enable unocss rules.
171
+ *
172
+ * Requires installing:
173
+ * - `@unocss/eslint-plugin`
174
+ *
175
+ * @default false
176
+ */
177
+ unocss?: OptionsUnoCSS | boolean;
121
178
  /**
122
179
  * Enable Vue support.
123
180
  *
@@ -131,98 +188,67 @@ interface OptionsConfig extends OptionsComponentExts {
131
188
  */
132
189
  yaml?: boolean;
133
190
  }
134
- interface OptionsOverrides {
135
- overrides?: ConfigItem['rules'];
136
- }
137
- interface OptionsIsInEditor {
138
- isInEditor?: boolean;
139
- }
140
- interface OptionsIgnores {
141
- enableGitignore?: boolean;
142
- items?: string[];
143
- replace?: boolean;
144
- }
145
- interface OptionsComponentExts {
146
- /**
147
- * Additional extensions for components.
148
- *
149
- * @example ['vue']
150
- * @default []
151
- */
152
- componentExts?: string[];
153
- }
154
- interface OptionsTypeScriptParserOptions {
155
- /**
156
- * Additional parser options for TypeScript.
157
- */
158
- parserOptions?: Partial<ParserOptions>;
159
- }
160
- interface OptionsTypeScriptWithTypes {
161
- /**
162
- * When this options is provided, type aware rules will be enabled.
163
- * @see https://typescript-eslint.io/linting/typed-linting/
164
- */
165
- tsconfigPath?: string[];
166
- }
167
- interface OptionsHasTypeScript {
168
- typescript?: OptionsConfig['typescript'];
169
- }
170
191
 
171
192
  declare function vinicuncaESLint({ options, userConfigs }?: {
172
- options?: OptionsConfig & ConfigItem;
173
- userConfigs?: (ConfigItem | ConfigItem[])[];
174
- }): ConfigItem[];
193
+ options?: OptionsConfig & FlatConfigItem;
194
+ userConfigs?: Awaitable<FlatConfigItem | FlatConfigItem[]>[];
195
+ }): Promise<FlatConfigItem[]>;
175
196
 
176
- declare function comments(): ConfigItem[];
197
+ declare function comments(): Promise<FlatConfigItem[]>;
177
198
 
178
- declare function ignores({ enableGitignore, items, replace, }?: OptionsIgnores): ConfigItem[];
199
+ declare function ignores({ enableGitignore, items, replace, }?: OptionsIgnores): Promise<FlatConfigItem[]>;
179
200
 
180
- declare function imports(): ConfigItem[];
201
+ declare function imports(): Promise<FlatConfigItem[]>;
181
202
 
182
- declare function javascript(options?: OptionsIsInEditor & OptionsOverrides): ConfigItem[];
203
+ declare function javascript(options?: OptionsIsInEditor & OptionsOverrides): Promise<FlatConfigItem[]>;
183
204
 
184
- declare function jsdoc(): ConfigItem[];
205
+ declare function jsdoc(): Promise<FlatConfigItem[]>;
185
206
 
186
- declare function jsonc(options?: OptionsOverrides): ConfigItem[];
207
+ declare function jsonc(options?: OptionsFiles & OptionsStylistic & OptionsOverrides): Promise<FlatConfigItem[]>;
187
208
 
188
- declare function markdown(options?: OptionsComponentExts & OptionsOverrides): ConfigItem[];
209
+ declare function markdown(options?: OptionsFiles & OptionsComponentExts & OptionsOverrides): Promise<FlatConfigItem[]>;
189
210
 
190
- declare function node(): ConfigItem[];
211
+ declare function node(): Promise<FlatConfigItem[]>;
191
212
 
192
- declare function react(options?: OptionsOverrides): ConfigItem[];
213
+ declare function react(options?: OptionsHasTypeScript & OptionsOverrides & OptionsFiles): Promise<FlatConfigItem[]>;
193
214
 
194
215
  /**
195
216
  * Sort package.json
196
217
  *
197
218
  * Requires `jsonc` config
198
219
  */
199
- declare function sortPackageJson(): ConfigItem[];
220
+ declare function sortPackageJson(): Promise<FlatConfigItem[]>;
200
221
  /**
201
222
  * Sort tsconfig.json
202
223
  *
203
224
  * Requires `jsonc` config
204
225
  */
205
- declare function sortTsconfig(): ConfigItem[];
226
+ declare function sortTsconfig(): FlatConfigItem[];
227
+
228
+ declare function stylistic(options?: StylisticConfig): Promise<FlatConfigItem[]>;
206
229
 
207
- declare function stylistic(): ConfigItem[];
230
+ declare function test(options?: OptionsFiles & OptionsIsInEditor & OptionsOverrides): Promise<FlatConfigItem[]>;
208
231
 
209
- declare function test(options?: OptionsIsInEditor & OptionsOverrides): ConfigItem[];
232
+ declare function typescript(options?: OptionsFiles & OptionsComponentExts & OptionsOverrides & OptionsTypeScriptWithTypes & OptionsTypeScriptParserOptions): Promise<FlatConfigItem[]>;
210
233
 
211
- declare function typescript(options?: OptionsComponentExts & OptionsOverrides & OptionsTypeScriptWithTypes & OptionsTypeScriptParserOptions): ConfigItem[];
234
+ declare function unicorn(options?: OptionsOverrides): Promise<FlatConfigItem[]>;
212
235
 
213
- declare function unicorn(options?: OptionsOverrides): ConfigItem[];
236
+ declare function unocss(options?: OptionsUnoCSS): Promise<FlatConfigItem[]>;
214
237
 
215
- declare function vue(options?: OptionsHasTypeScript & OptionsOverrides): ConfigItem[];
238
+ declare function vue(options?: OptionsHasTypeScript & OptionsOverrides & OptionsStylistic & OptionsFiles): Promise<FlatConfigItem[]>;
216
239
 
217
- declare function yaml(options?: OptionsOverrides): ConfigItem[];
240
+ declare function yaml(options?: OptionsOverrides & OptionsStylistic & OptionsFiles): Promise<FlatConfigItem[]>;
218
241
 
219
242
  /**
220
243
  * Combine array and non-array configs into a single array.
221
244
  */
222
- declare function combineConfigs(...configs: (ConfigItem | ConfigItem[])[]): ConfigItem[];
245
+ declare function combineConfigs(...configs: Awaitable<FlatConfigItem | FlatConfigItem[]>[]): Promise<FlatConfigItem[]>;
223
246
  declare function renameRules(rules: Record<string, any>, from: string, to: string): {
224
247
  [k: string]: any;
225
248
  };
249
+ declare function interopDefault<T>(m: Awaitable<T>): Promise<T extends {
250
+ default: infer U;
251
+ } ? U : T>;
226
252
 
227
253
  declare const GLOB_JS = "**/*.?([cm])js";
228
254
  declare const GLOB_JSX = "**/*.?([cm])jsx";
@@ -238,6 +264,7 @@ declare const GLOB_JSON5 = "**/*.json5";
238
264
  declare const GLOB_JSONC = "**/*.jsonc";
239
265
  declare const GLOB_YAML = "**/*.y?(a)ml";
240
266
  declare const GLOB_MARKDOWN = "**/*.md";
267
+ declare const GLOB_MARKDOWN_IN_MARKDOWN = "**/*.md/*.md";
241
268
  declare const GLOB_MARKDOWN_CODE = "**/*.md/**/*.?([cm])[jt]s?(x)";
242
269
 
243
- export { type ConfigItem, GLOB_EXCLUDE, GLOB_JS, GLOB_JSON, GLOB_JSON5, GLOB_JSONC, GLOB_JSX, GLOB_MARKDOWN, GLOB_MARKDOWN_CODE, GLOB_SRC, GLOB_SRC_EXT, GLOB_TESTS, GLOB_TS, GLOB_TSX, GLOB_VUE, GLOB_YAML, type OptionsComponentExts, type OptionsConfig, type OptionsHasTypeScript, type OptionsIgnores, type OptionsIsInEditor, type OptionsOverrides, type OptionsTypeScriptParserOptions, type OptionsTypeScriptWithTypes, type Rules, combineConfigs, comments, vinicuncaESLint as default, ignores, imports, javascript, jsdoc, jsonc, markdown, node, react, renameRules, sortPackageJson, sortTsconfig, stylistic, test, typescript, unicorn, vinicuncaESLint, vue, yaml };
270
+ export { type Awaitable, type FlatConfigItem, GLOB_EXCLUDE, GLOB_JS, GLOB_JSON, GLOB_JSON5, GLOB_JSONC, GLOB_JSX, GLOB_MARKDOWN, GLOB_MARKDOWN_CODE, GLOB_MARKDOWN_IN_MARKDOWN, GLOB_SRC, GLOB_SRC_EXT, 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 OptionsStylistic, type OptionsTypeScriptParserOptions, type OptionsTypeScriptWithTypes, type OptionsUnoCSS, type Rules, type StylisticConfig, type WrapRuleConfig, combineConfigs, comments, ignores, imports, interopDefault, javascript, jsdoc, jsonc, markdown, node, react, renameRules, sortPackageJson, sortTsconfig, stylistic, test, typescript, unicorn, unocss, vinicuncaESLint, vue, yaml };
package/dist/index.d.ts CHANGED
@@ -1,40 +1,29 @@
1
- import { MergeIntersection, EslintRules, Unprefix, ReactRules, TypeScriptRules, RenamePrefix, VitestRules, YmlRules, NRules, Prefix, ImportRules, JsoncRules, VueRules, UnicornRules, EslintCommentsRules, RuleConfig, FlatESLintConfigItem } from '@antfu/eslint-define-config';
1
+ import { RuleConfig, MergeIntersection, RenamePrefix, VitestRules, YmlRules, NRules, Prefix, ReactHooksRules, ReactRules, ImportRules, EslintRules, JsoncRules, VueRules, EslintCommentsRules, FlatESLintConfigItem } from '@antfu/eslint-define-config';
2
+ import { RuleOptions as RuleOptions$1 } from '@eslint-types/jsdoc/types';
3
+ import { RuleOptions } from '@eslint-types/typescript-eslint/types';
4
+ import { RuleOptions as RuleOptions$2 } from '@eslint-types/unicorn/types';
5
+ import { UnprefixedRuleOptions, StylisticCustomizeOptions } from '@stylistic/eslint-plugin';
2
6
  import { ParserOptions } from '@typescript-eslint/parser';
3
- import * as parser from '@typescript-eslint/parser';
4
- export { parser as parserTs };
5
7
  import { Rules as Rules$1 } from '@vinicunca/eslint-plugin-vinicunca';
6
8
  export { default as pluginVinicunca } from '@vinicunca/eslint-plugin-vinicunca';
7
- export { default as pluginStylistic } from '@stylistic/eslint-plugin';
8
- export { default as pluginTs } from '@typescript-eslint/eslint-plugin';
9
9
  export { default as pluginComments } from 'eslint-plugin-eslint-comments';
10
10
  import * as eslintPluginI from 'eslint-plugin-i';
11
11
  export { eslintPluginI as pluginImport };
12
- export { default as pluginJsdoc } from 'eslint-plugin-jsdoc';
13
- import * as eslintPluginJsonc from 'eslint-plugin-jsonc';
14
- export { eslintPluginJsonc as pluginJsonc };
15
- export { default as pluginMarkdown } from 'eslint-plugin-markdown';
16
12
  export { default as pluginNode } from 'eslint-plugin-n';
17
- export { default as pluginNoOnlyTests } from 'eslint-plugin-no-only-tests';
18
13
  export { default as pluginPerfectionist } from 'eslint-plugin-perfectionist';
19
- export { default as pluginReact } from 'eslint-plugin-react';
20
- export { default as pluginReactHooks } from 'eslint-plugin-react-hooks';
21
14
  export { default as pluginUnicorn } from 'eslint-plugin-unicorn';
22
15
  export { default as pluginUnusedImports } from 'eslint-plugin-unused-imports';
23
- export { default as pluginVitest } from 'eslint-plugin-vitest';
24
- export { default as pluginVue } from 'eslint-plugin-vue';
25
- import * as eslintPluginYml from 'eslint-plugin-yml';
26
- export { eslintPluginYml as pluginYaml };
27
- export { default as parserJsonc } from 'jsonc-eslint-parser';
28
- export { default as parserVue } from 'vue-eslint-parser';
29
- export { default as parserYaml } from 'yaml-eslint-parser';
30
-
31
- type MergedRules = MergeIntersection<EslintRules & Unprefix<ReactRules, 'react/'> & Unprefix<TypeScriptRules, '@typescript-eslint/'>>;
32
- type StylisticRules = Pick<MergedRules, 'array-bracket-newline' | 'array-bracket-spacing' | 'array-element-newline' | 'arrow-spacing' | 'block-spacing' | 'block-spacing' | 'brace-style' | 'brace-style' | 'comma-dangle' | 'comma-dangle' | 'comma-spacing' | 'comma-spacing' | 'comma-style' | 'computed-property-spacing' | 'dot-location' | 'eol-last' | 'func-call-spacing' | 'func-call-spacing' | 'function-call-argument-newline' | 'function-paren-newline' | 'generator-star-spacing' | 'implicit-arrow-linebreak' | 'indent' | 'indent' | 'jsx-child-element-spacing' | 'jsx-closing-bracket-location' | 'jsx-closing-tag-location' | 'jsx-curly-brace-presence' | 'jsx-curly-newline' | 'jsx-curly-spacing' | 'jsx-equals-spacing' | 'jsx-first-prop-new-line' | 'jsx-indent' | 'jsx-indent-props' | 'jsx-max-props-per-line' | 'jsx-newline' | 'jsx-one-expression-per-line' | 'jsx-props-no-multi-spaces' | 'jsx-quotes' | 'jsx-sort-props' | 'jsx-space-before-closing' | 'jsx-tag-spacing' | 'jsx-wrap-multilines' | 'key-spacing' | 'key-spacing' | 'keyword-spacing' | 'keyword-spacing' | 'linebreak-style' | 'lines-around-comment' | 'lines-around-comment' | 'lines-around-directive' | 'lines-between-class-members' | 'lines-between-class-members' | 'max-len' | 'max-statements-per-line' | 'member-delimiter-style' | 'multiline-ternary' | 'new-parens' | 'newline-after-var' | 'newline-before-return' | 'newline-per-chained-call' | 'no-confusing-arrow' | 'no-extra-parens' | 'no-extra-semi' | 'no-floating-decimal' | 'no-mixed-operators' | 'no-mixed-spaces-and-tabs' | 'no-multi-spaces' | 'no-multiple-empty-lines' | 'no-spaced-func' | 'no-tabs' | 'no-trailing-spaces' | 'no-whitespace-before-property' | 'nonblock-statement-body-position' | 'object-curly-newline' | 'object-curly-spacing' | 'object-curly-spacing' | 'object-property-newline' | 'one-var-declaration-per-line' | 'operator-linebreak' | 'padded-blocks' | 'padding-line-between-statements' | 'padding-line-between-statements' | 'quote-props' | 'quotes' | 'quotes' | 'rest-spread-spacing' | 'semi' | 'semi' | 'semi-spacing' | 'semi-style' | 'space-before-blocks' | 'space-before-blocks' | 'space-before-function-paren' | 'space-before-function-paren' | 'space-in-parens' | 'space-infix-ops' | 'space-infix-ops' | 'space-unary-ops' | 'spaced-comment' | 'switch-colon-spacing' | 'template-curly-spacing' | 'template-tag-spacing' | 'type-annotation-spacing' | 'wrap-iife' | 'wrap-regex' | 'yield-star-spacing'>;
33
-
34
- type Rules = MergeIntersection<RenamePrefix<TypeScriptRules, '@typescript-eslint/', 'ts/'> & RenamePrefix<VitestRules, 'vitest/', 'test/'> & RenamePrefix<YmlRules, 'yml/', 'yaml/'> & RenamePrefix<NRules, 'n/', 'node/'> & Prefix<StylisticRules, 'style/'> & Prefix<Rules$1, 'vinicunca/'> & ImportRules & EslintRules & JsoncRules & VueRules & UnicornRules & EslintCommentsRules & {
16
+
17
+ type WrapRuleConfig<T extends {
18
+ [key: string]: any;
19
+ }> = {
20
+ [K in keyof T]: T[K] extends RuleConfig ? T[K] : RuleConfig<T[K]>;
21
+ };
22
+ type Awaitable<T> = Promise<T> | T;
23
+ 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, 'vinicunca/'> & ReactHooksRules & ReactRules & RuleOptions$1 & ImportRules & EslintRules & JsoncRules & VueRules & RuleOptions$2 & EslintCommentsRules & {
35
24
  'test/no-only-tests': RuleConfig<[]>;
36
- }>;
37
- type ConfigItem = Omit<FlatESLintConfigItem<Rules, false>, 'plugins'> & {
25
+ }>>;
26
+ type FlatConfigItem = Omit<FlatESLintConfigItem<Rules, false>, 'plugins'> & {
38
27
  /**
39
28
  * The name of the configuration object.
40
29
  */
@@ -46,6 +35,65 @@ type ConfigItem = Omit<FlatESLintConfigItem<Rules, false>, 'plugins'> & {
46
35
  */
47
36
  plugins?: Record<string, any>;
48
37
  };
38
+ interface OptionsFiles {
39
+ /**
40
+ * Override the `files` option to provide custom globs.
41
+ */
42
+ files?: string[];
43
+ }
44
+ interface OptionsComponentExts {
45
+ /**
46
+ * Additional extensions for components.
47
+ *
48
+ * @example ['vue']
49
+ * @default []
50
+ */
51
+ componentExts?: string[];
52
+ }
53
+ interface OptionsTypeScriptParserOptions {
54
+ /**
55
+ * Additional parser options for TypeScript.
56
+ */
57
+ parserOptions?: Partial<ParserOptions>;
58
+ }
59
+ interface OptionsHasTypeScript {
60
+ typescript?: OptionsConfig['typescript'];
61
+ }
62
+ interface OptionsTypeScriptWithTypes {
63
+ /**
64
+ * When this options is provided, type aware rules will be enabled.
65
+ * @see https://typescript-eslint.io/linting/typed-linting/
66
+ */
67
+ tsconfigPath?: string[];
68
+ }
69
+ interface OptionsStylistic {
70
+ stylistic?: StylisticConfig | boolean;
71
+ }
72
+ interface StylisticConfig extends Pick<StylisticCustomizeOptions, 'indent' | 'jsx' | 'quotes' | 'semi'> {
73
+ }
74
+ interface OptionsOverrides {
75
+ overrides?: FlatConfigItem['rules'];
76
+ }
77
+ interface OptionsIsInEditor {
78
+ isInEditor?: boolean;
79
+ }
80
+ interface OptionsUnoCSS {
81
+ /**
82
+ * Enable attributify support.
83
+ * @default true
84
+ */
85
+ attributify?: boolean;
86
+ /**
87
+ * Enable strict mode by throwing errors about blocklisted classes.
88
+ * @default false
89
+ */
90
+ strict?: boolean;
91
+ }
92
+ interface OptionsIgnores {
93
+ enableGitignore?: boolean;
94
+ items?: string[];
95
+ replace?: boolean;
96
+ }
49
97
  interface OptionsConfig extends OptionsComponentExts {
50
98
  /**
51
99
  * Additional options for the ignore rules.
@@ -80,14 +128,14 @@ interface OptionsConfig extends OptionsComponentExts {
80
128
  * Provide overrides for rules for each integration.
81
129
  */
82
130
  overrides?: {
83
- javascript?: ConfigItem['rules'];
84
- jsonc?: ConfigItem['rules'];
85
- markdown?: ConfigItem['rules'];
86
- react?: ConfigItem['rules'];
87
- test?: ConfigItem['rules'];
88
- typescript?: ConfigItem['rules'];
89
- vue?: ConfigItem['rules'];
90
- yaml?: ConfigItem['rules'];
131
+ javascript?: FlatConfigItem['rules'];
132
+ jsonc?: FlatConfigItem['rules'];
133
+ markdown?: FlatConfigItem['rules'];
134
+ react?: FlatConfigItem['rules'];
135
+ test?: FlatConfigItem['rules'];
136
+ typescript?: FlatConfigItem['rules'];
137
+ vue?: FlatConfigItem['rules'];
138
+ yaml?: FlatConfigItem['rules'];
91
139
  };
92
140
  /**
93
141
  * Enable react support.
@@ -101,7 +149,7 @@ interface OptionsConfig extends OptionsComponentExts {
101
149
  *
102
150
  * @default true
103
151
  */
104
- stylistic?: boolean;
152
+ stylistic?: StylisticConfig | boolean;
105
153
  /**
106
154
  * Enable test support.
107
155
  *
@@ -118,6 +166,15 @@ interface OptionsConfig extends OptionsComponentExts {
118
166
  typescript?: OptionsTypeScriptWithTypes & OptionsTypeScriptParserOptions & {
119
167
  enabled?: boolean;
120
168
  };
169
+ /**
170
+ * Enable unocss rules.
171
+ *
172
+ * Requires installing:
173
+ * - `@unocss/eslint-plugin`
174
+ *
175
+ * @default false
176
+ */
177
+ unocss?: OptionsUnoCSS | boolean;
121
178
  /**
122
179
  * Enable Vue support.
123
180
  *
@@ -131,98 +188,67 @@ interface OptionsConfig extends OptionsComponentExts {
131
188
  */
132
189
  yaml?: boolean;
133
190
  }
134
- interface OptionsOverrides {
135
- overrides?: ConfigItem['rules'];
136
- }
137
- interface OptionsIsInEditor {
138
- isInEditor?: boolean;
139
- }
140
- interface OptionsIgnores {
141
- enableGitignore?: boolean;
142
- items?: string[];
143
- replace?: boolean;
144
- }
145
- interface OptionsComponentExts {
146
- /**
147
- * Additional extensions for components.
148
- *
149
- * @example ['vue']
150
- * @default []
151
- */
152
- componentExts?: string[];
153
- }
154
- interface OptionsTypeScriptParserOptions {
155
- /**
156
- * Additional parser options for TypeScript.
157
- */
158
- parserOptions?: Partial<ParserOptions>;
159
- }
160
- interface OptionsTypeScriptWithTypes {
161
- /**
162
- * When this options is provided, type aware rules will be enabled.
163
- * @see https://typescript-eslint.io/linting/typed-linting/
164
- */
165
- tsconfigPath?: string[];
166
- }
167
- interface OptionsHasTypeScript {
168
- typescript?: OptionsConfig['typescript'];
169
- }
170
191
 
171
192
  declare function vinicuncaESLint({ options, userConfigs }?: {
172
- options?: OptionsConfig & ConfigItem;
173
- userConfigs?: (ConfigItem | ConfigItem[])[];
174
- }): ConfigItem[];
193
+ options?: OptionsConfig & FlatConfigItem;
194
+ userConfigs?: Awaitable<FlatConfigItem | FlatConfigItem[]>[];
195
+ }): Promise<FlatConfigItem[]>;
175
196
 
176
- declare function comments(): ConfigItem[];
197
+ declare function comments(): Promise<FlatConfigItem[]>;
177
198
 
178
- declare function ignores({ enableGitignore, items, replace, }?: OptionsIgnores): ConfigItem[];
199
+ declare function ignores({ enableGitignore, items, replace, }?: OptionsIgnores): Promise<FlatConfigItem[]>;
179
200
 
180
- declare function imports(): ConfigItem[];
201
+ declare function imports(): Promise<FlatConfigItem[]>;
181
202
 
182
- declare function javascript(options?: OptionsIsInEditor & OptionsOverrides): ConfigItem[];
203
+ declare function javascript(options?: OptionsIsInEditor & OptionsOverrides): Promise<FlatConfigItem[]>;
183
204
 
184
- declare function jsdoc(): ConfigItem[];
205
+ declare function jsdoc(): Promise<FlatConfigItem[]>;
185
206
 
186
- declare function jsonc(options?: OptionsOverrides): ConfigItem[];
207
+ declare function jsonc(options?: OptionsFiles & OptionsStylistic & OptionsOverrides): Promise<FlatConfigItem[]>;
187
208
 
188
- declare function markdown(options?: OptionsComponentExts & OptionsOverrides): ConfigItem[];
209
+ declare function markdown(options?: OptionsFiles & OptionsComponentExts & OptionsOverrides): Promise<FlatConfigItem[]>;
189
210
 
190
- declare function node(): ConfigItem[];
211
+ declare function node(): Promise<FlatConfigItem[]>;
191
212
 
192
- declare function react(options?: OptionsOverrides): ConfigItem[];
213
+ declare function react(options?: OptionsHasTypeScript & OptionsOverrides & OptionsFiles): Promise<FlatConfigItem[]>;
193
214
 
194
215
  /**
195
216
  * Sort package.json
196
217
  *
197
218
  * Requires `jsonc` config
198
219
  */
199
- declare function sortPackageJson(): ConfigItem[];
220
+ declare function sortPackageJson(): Promise<FlatConfigItem[]>;
200
221
  /**
201
222
  * Sort tsconfig.json
202
223
  *
203
224
  * Requires `jsonc` config
204
225
  */
205
- declare function sortTsconfig(): ConfigItem[];
226
+ declare function sortTsconfig(): FlatConfigItem[];
227
+
228
+ declare function stylistic(options?: StylisticConfig): Promise<FlatConfigItem[]>;
206
229
 
207
- declare function stylistic(): ConfigItem[];
230
+ declare function test(options?: OptionsFiles & OptionsIsInEditor & OptionsOverrides): Promise<FlatConfigItem[]>;
208
231
 
209
- declare function test(options?: OptionsIsInEditor & OptionsOverrides): ConfigItem[];
232
+ declare function typescript(options?: OptionsFiles & OptionsComponentExts & OptionsOverrides & OptionsTypeScriptWithTypes & OptionsTypeScriptParserOptions): Promise<FlatConfigItem[]>;
210
233
 
211
- declare function typescript(options?: OptionsComponentExts & OptionsOverrides & OptionsTypeScriptWithTypes & OptionsTypeScriptParserOptions): ConfigItem[];
234
+ declare function unicorn(options?: OptionsOverrides): Promise<FlatConfigItem[]>;
212
235
 
213
- declare function unicorn(options?: OptionsOverrides): ConfigItem[];
236
+ declare function unocss(options?: OptionsUnoCSS): Promise<FlatConfigItem[]>;
214
237
 
215
- declare function vue(options?: OptionsHasTypeScript & OptionsOverrides): ConfigItem[];
238
+ declare function vue(options?: OptionsHasTypeScript & OptionsOverrides & OptionsStylistic & OptionsFiles): Promise<FlatConfigItem[]>;
216
239
 
217
- declare function yaml(options?: OptionsOverrides): ConfigItem[];
240
+ declare function yaml(options?: OptionsOverrides & OptionsStylistic & OptionsFiles): Promise<FlatConfigItem[]>;
218
241
 
219
242
  /**
220
243
  * Combine array and non-array configs into a single array.
221
244
  */
222
- declare function combineConfigs(...configs: (ConfigItem | ConfigItem[])[]): ConfigItem[];
245
+ declare function combineConfigs(...configs: Awaitable<FlatConfigItem | FlatConfigItem[]>[]): Promise<FlatConfigItem[]>;
223
246
  declare function renameRules(rules: Record<string, any>, from: string, to: string): {
224
247
  [k: string]: any;
225
248
  };
249
+ declare function interopDefault<T>(m: Awaitable<T>): Promise<T extends {
250
+ default: infer U;
251
+ } ? U : T>;
226
252
 
227
253
  declare const GLOB_JS = "**/*.?([cm])js";
228
254
  declare const GLOB_JSX = "**/*.?([cm])jsx";
@@ -238,6 +264,7 @@ declare const GLOB_JSON5 = "**/*.json5";
238
264
  declare const GLOB_JSONC = "**/*.jsonc";
239
265
  declare const GLOB_YAML = "**/*.y?(a)ml";
240
266
  declare const GLOB_MARKDOWN = "**/*.md";
267
+ declare const GLOB_MARKDOWN_IN_MARKDOWN = "**/*.md/*.md";
241
268
  declare const GLOB_MARKDOWN_CODE = "**/*.md/**/*.?([cm])[jt]s?(x)";
242
269
 
243
- export { type ConfigItem, GLOB_EXCLUDE, GLOB_JS, GLOB_JSON, GLOB_JSON5, GLOB_JSONC, GLOB_JSX, GLOB_MARKDOWN, GLOB_MARKDOWN_CODE, GLOB_SRC, GLOB_SRC_EXT, GLOB_TESTS, GLOB_TS, GLOB_TSX, GLOB_VUE, GLOB_YAML, type OptionsComponentExts, type OptionsConfig, type OptionsHasTypeScript, type OptionsIgnores, type OptionsIsInEditor, type OptionsOverrides, type OptionsTypeScriptParserOptions, type OptionsTypeScriptWithTypes, type Rules, combineConfigs, comments, vinicuncaESLint as default, ignores, imports, javascript, jsdoc, jsonc, markdown, node, react, renameRules, sortPackageJson, sortTsconfig, stylistic, test, typescript, unicorn, vinicuncaESLint, vue, yaml };
270
+ export { type Awaitable, type FlatConfigItem, GLOB_EXCLUDE, GLOB_JS, GLOB_JSON, GLOB_JSON5, GLOB_JSONC, GLOB_JSX, GLOB_MARKDOWN, GLOB_MARKDOWN_CODE, GLOB_MARKDOWN_IN_MARKDOWN, GLOB_SRC, GLOB_SRC_EXT, 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 OptionsStylistic, type OptionsTypeScriptParserOptions, type OptionsTypeScriptWithTypes, type OptionsUnoCSS, type Rules, type StylisticConfig, type WrapRuleConfig, combineConfigs, comments, ignores, imports, interopDefault, javascript, jsdoc, jsonc, markdown, node, react, renameRules, sortPackageJson, sortTsconfig, stylistic, test, typescript, unicorn, unocss, vinicuncaESLint, vue, yaml };