@coderwyd/eslint-config 1.1.0-beta.3 → 1.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +4 -4
- 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 +414 -556
- package/dist/index.d.cts +116 -131
- package/dist/index.d.ts +116 -131
- package/dist/index.js +415 -537
- package/package.json +75 -41
package/dist/index.d.cts
CHANGED
|
@@ -1,91 +1,40 @@
|
|
|
1
1
|
import { FlatGitignoreOptions } from 'eslint-config-flat-gitignore';
|
|
2
2
|
import { ParserOptions } from '@typescript-eslint/parser';
|
|
3
|
-
import
|
|
4
|
-
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
import
|
|
10
|
-
export { eslintPluginI as pluginImport };
|
|
11
|
-
export { default as pluginJsdoc } from 'eslint-plugin-jsdoc';
|
|
12
|
-
import * as eslintPluginJsonc from 'eslint-plugin-jsonc';
|
|
13
|
-
export { eslintPluginJsonc as pluginJsonc };
|
|
14
|
-
export { default as pluginMarkdown } from 'eslint-plugin-markdown';
|
|
15
|
-
export { default as pluginNode } from 'eslint-plugin-n';
|
|
16
|
-
export { default as pluginStylistic } from '@stylistic/eslint-plugin';
|
|
17
|
-
export { default as pluginTs } from '@typescript-eslint/eslint-plugin';
|
|
18
|
-
export { default as pluginUnicorn } from 'eslint-plugin-unicorn';
|
|
19
|
-
export { default as pluginUnusedImports } from 'eslint-plugin-unused-imports';
|
|
20
|
-
import * as eslintPluginYml from 'eslint-plugin-yml';
|
|
21
|
-
export { eslintPluginYml as pluginYaml };
|
|
22
|
-
export { default as pluginNoOnlyTests } from 'eslint-plugin-no-only-tests';
|
|
23
|
-
export { default as pluginVitest } from 'eslint-plugin-vitest';
|
|
24
|
-
export { default as pluginVue } from 'eslint-plugin-vue';
|
|
25
|
-
export { default as pluginReact } from 'eslint-plugin-react';
|
|
26
|
-
export { default as pluginReactHooks } from 'eslint-plugin-react-hooks';
|
|
27
|
-
export { default as pluginAstro } from 'eslint-plugin-astro';
|
|
28
|
-
export { default as parserVue } from 'vue-eslint-parser';
|
|
29
|
-
export { default as parserYaml } from 'yaml-eslint-parser';
|
|
30
|
-
export { default as parserJsonc } from 'jsonc-eslint-parser';
|
|
31
|
-
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';
|
|
32
10
|
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
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'> & {
|
|
39
21
|
/**
|
|
40
|
-
*
|
|
22
|
+
* Custom name of each config item
|
|
41
23
|
*/
|
|
42
24
|
name?: string;
|
|
43
|
-
/**
|
|
44
|
-
* An array of glob patterns indicating the files that the configuration object should apply to. If not specified, the configuration object applies to all files.
|
|
45
|
-
*
|
|
46
|
-
* @see [Ignore Patterns](https://eslint.org/docs/latest/user-guide/configuring/configuration-files-new#excluding-files-with-ignores)
|
|
47
|
-
*/
|
|
48
|
-
files?: string[];
|
|
49
|
-
/**
|
|
50
|
-
* An array of glob patterns indicating the files that the configuration object should not apply to. If not specified, the configuration object applies to all files matched by files.
|
|
51
|
-
*
|
|
52
|
-
* @see [Ignore Patterns](https://eslint.org/docs/latest/user-guide/configuring/configuration-files-new#excluding-files-with-ignores)
|
|
53
|
-
*/
|
|
54
|
-
ignores?: string[];
|
|
55
|
-
/**
|
|
56
|
-
* An object containing settings related to how JavaScript is configured for linting.
|
|
57
|
-
*
|
|
58
|
-
* @see [Configuring language options](https://eslint.org/docs/latest/user-guide/configuring/configuration-files-new#configuring-language-options)
|
|
59
|
-
*/
|
|
60
|
-
languageOptions?: LanguageOptions;
|
|
61
|
-
/**
|
|
62
|
-
* An object containing settings related to the linting process.
|
|
63
|
-
*/
|
|
64
|
-
linterOptions?: LinterOptions;
|
|
65
|
-
/**
|
|
66
|
-
* Either an object containing `preprocess()` and `postprocess()` methods or a string indicating the name of a processor inside of a plugin (i.e., `"pluginName/processorName"`).
|
|
67
|
-
*
|
|
68
|
-
* @see [Using processors](https://eslint.org/docs/latest/user-guide/configuring/configuration-files-new#using-processors)
|
|
69
|
-
*/
|
|
70
|
-
processor?: string | Linter.Processor;
|
|
71
25
|
/**
|
|
72
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.
|
|
73
27
|
*
|
|
74
28
|
* @see [Using plugins in your configuration](https://eslint.org/docs/latest/user-guide/configuring/configuration-files-new#using-plugins-in-your-configuration)
|
|
75
29
|
*/
|
|
76
|
-
plugins?: Record<string,
|
|
30
|
+
plugins?: Record<string, any>;
|
|
31
|
+
};
|
|
32
|
+
type UserConfigItem = FlatConfigItem | Linter.FlatConfig;
|
|
33
|
+
interface OptionsFiles {
|
|
77
34
|
/**
|
|
78
|
-
*
|
|
79
|
-
*
|
|
80
|
-
* @see [Configuring rules](https://eslint.org/docs/latest/user-guide/configuring/configuration-files-new#configuring-rules)
|
|
35
|
+
* Override the `files` option to provide custom globs.
|
|
81
36
|
*/
|
|
82
|
-
|
|
83
|
-
/**
|
|
84
|
-
* An object containing name-value pairs of information that should be available to all rules.
|
|
85
|
-
*
|
|
86
|
-
* @see [Configuring shared settings](https://eslint.org/docs/latest/user-guide/configuring/configuration-files-new#configuring-shared-settings)
|
|
87
|
-
*/
|
|
88
|
-
settings?: Record<string, any>;
|
|
37
|
+
files?: string[];
|
|
89
38
|
}
|
|
90
39
|
interface OptionsComponentExts {
|
|
91
40
|
/**
|
|
@@ -107,7 +56,7 @@ interface OptionsTypeScriptWithTypes {
|
|
|
107
56
|
* When this options is provided, type aware rules will be enabled.
|
|
108
57
|
* @see https://typescript-eslint.io/linting/typed-linting/
|
|
109
58
|
*/
|
|
110
|
-
tsconfigPath?: string;
|
|
59
|
+
tsconfigPath?: string | string[];
|
|
111
60
|
}
|
|
112
61
|
interface OptionsHasTypeScript {
|
|
113
62
|
typescript?: boolean;
|
|
@@ -115,16 +64,26 @@ interface OptionsHasTypeScript {
|
|
|
115
64
|
interface OptionsStylistic {
|
|
116
65
|
stylistic?: boolean | StylisticConfig;
|
|
117
66
|
}
|
|
118
|
-
interface StylisticConfig {
|
|
119
|
-
indent?: number | 'tab';
|
|
120
|
-
quotes?: 'single' | 'double';
|
|
67
|
+
interface StylisticConfig extends Pick<StylisticCustomizeOptions, 'indent' | 'quotes' | 'jsx' | 'semi'> {
|
|
121
68
|
}
|
|
122
69
|
interface OptionsOverrides {
|
|
123
|
-
overrides?:
|
|
70
|
+
overrides?: FlatConfigItem['rules'];
|
|
124
71
|
}
|
|
125
72
|
interface OptionsIsInEditor {
|
|
126
73
|
isInEditor?: boolean;
|
|
127
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
|
+
}
|
|
128
87
|
interface OptionsConfig extends OptionsComponentExts {
|
|
129
88
|
/**
|
|
130
89
|
* Enable gitignore support.
|
|
@@ -142,7 +101,15 @@ interface OptionsConfig extends OptionsComponentExts {
|
|
|
142
101
|
*
|
|
143
102
|
* @default auto-detect based on the dependencies
|
|
144
103
|
*/
|
|
145
|
-
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;
|
|
146
113
|
/**
|
|
147
114
|
* Enable test support.
|
|
148
115
|
*
|
|
@@ -155,18 +122,6 @@ interface OptionsConfig extends OptionsComponentExts {
|
|
|
155
122
|
* @default auto-detect based on the dependencies
|
|
156
123
|
*/
|
|
157
124
|
vue?: boolean;
|
|
158
|
-
/**
|
|
159
|
-
* Enable React support.
|
|
160
|
-
*
|
|
161
|
-
* @default auto-detect based on the dependencies
|
|
162
|
-
*/
|
|
163
|
-
react?: boolean;
|
|
164
|
-
/**
|
|
165
|
-
* Enable Astro support.
|
|
166
|
-
*
|
|
167
|
-
* @default auto-detect based on the dependencies
|
|
168
|
-
*/
|
|
169
|
-
astro?: boolean;
|
|
170
125
|
/**
|
|
171
126
|
* Enable JSONC support.
|
|
172
127
|
*
|
|
@@ -191,6 +146,26 @@ interface OptionsConfig extends OptionsComponentExts {
|
|
|
191
146
|
* @default true
|
|
192
147
|
*/
|
|
193
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;
|
|
194
169
|
/**
|
|
195
170
|
* Control to disable some rules in editors.
|
|
196
171
|
* @default auto-detect based on the process.env
|
|
@@ -200,76 +175,73 @@ interface OptionsConfig extends OptionsComponentExts {
|
|
|
200
175
|
* Provide overrides for rules for each integration.
|
|
201
176
|
*/
|
|
202
177
|
overrides?: {
|
|
203
|
-
javascript?:
|
|
204
|
-
typescript?:
|
|
205
|
-
test?:
|
|
206
|
-
vue?:
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
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'];
|
|
212
186
|
};
|
|
213
187
|
}
|
|
214
188
|
|
|
215
189
|
/**
|
|
216
190
|
* Construct an array of ESLint flat config items.
|
|
217
191
|
*/
|
|
218
|
-
declare function coderwyd(options?: OptionsConfig &
|
|
192
|
+
declare function coderwyd(options?: OptionsConfig & FlatConfigItem, ...userConfigs: Awaitable<UserConfigItem | UserConfigItem[]>[]): Promise<UserConfigItem[]>;
|
|
219
193
|
|
|
220
|
-
declare function comments():
|
|
194
|
+
declare function comments(): Promise<FlatConfigItem[]>;
|
|
221
195
|
|
|
222
|
-
declare function ignores():
|
|
196
|
+
declare function ignores(): Promise<FlatConfigItem[]>;
|
|
223
197
|
|
|
224
|
-
declare function imports(options?: OptionsStylistic):
|
|
198
|
+
declare function imports(options?: OptionsStylistic): Promise<FlatConfigItem[]>;
|
|
225
199
|
|
|
226
|
-
declare function javascript(options?: OptionsIsInEditor & OptionsOverrides):
|
|
200
|
+
declare function javascript(options?: OptionsIsInEditor & OptionsOverrides): Promise<FlatConfigItem[]>;
|
|
227
201
|
|
|
228
|
-
declare function jsdoc(options?: OptionsStylistic):
|
|
202
|
+
declare function jsdoc(options?: OptionsStylistic): Promise<FlatConfigItem[]>;
|
|
229
203
|
|
|
230
|
-
declare function jsonc(options?: OptionsStylistic & OptionsOverrides):
|
|
204
|
+
declare function jsonc(options?: OptionsFiles & OptionsStylistic & OptionsOverrides): Promise<FlatConfigItem[]>;
|
|
231
205
|
|
|
232
|
-
declare function markdown(options?: OptionsComponentExts & OptionsOverrides):
|
|
206
|
+
declare function markdown(options?: OptionsFiles & OptionsComponentExts & OptionsOverrides): Promise<FlatConfigItem[]>;
|
|
233
207
|
|
|
234
|
-
declare function node():
|
|
208
|
+
declare function node(): Promise<FlatConfigItem[]>;
|
|
235
209
|
|
|
236
210
|
/**
|
|
237
211
|
* Sort package.json
|
|
238
212
|
*
|
|
239
213
|
* Requires `jsonc` config
|
|
240
214
|
*/
|
|
241
|
-
declare function sortPackageJson():
|
|
215
|
+
declare function sortPackageJson(): Promise<FlatConfigItem[]>;
|
|
242
216
|
/**
|
|
243
217
|
* Sort tsconfig.json
|
|
244
218
|
*
|
|
245
219
|
* Requires `jsonc` config
|
|
246
220
|
*/
|
|
247
|
-
declare function sortTsconfig():
|
|
221
|
+
declare function sortTsconfig(): FlatConfigItem[];
|
|
248
222
|
|
|
249
|
-
declare function stylistic(options?: StylisticConfig):
|
|
223
|
+
declare function stylistic(options?: StylisticConfig): Promise<FlatConfigItem[]>;
|
|
250
224
|
|
|
251
|
-
declare function typescript(options?: OptionsComponentExts & OptionsOverrides & OptionsTypeScriptWithTypes & OptionsTypeScriptParserOptions):
|
|
225
|
+
declare function typescript(options?: OptionsFiles & OptionsComponentExts & OptionsOverrides & OptionsTypeScriptWithTypes & OptionsTypeScriptParserOptions): Promise<FlatConfigItem[]>;
|
|
252
226
|
|
|
253
|
-
declare function unicorn():
|
|
227
|
+
declare function unicorn(): Promise<FlatConfigItem[]>;
|
|
254
228
|
|
|
255
|
-
declare function
|
|
256
|
-
declare function vue(options?: OptionsHasTypeScript & OptionsOverrides & OptionsStylistic): FlatESLintConfigItem[];
|
|
257
|
-
|
|
258
|
-
declare function yaml(options?: OptionsOverrides & OptionsStylistic): FlatESLintConfigItem[];
|
|
259
|
-
|
|
260
|
-
declare function test(options?: OptionsIsInEditor & OptionsOverrides): FlatESLintConfigItem[];
|
|
229
|
+
declare function vue(options?: OptionsHasTypeScript & OptionsOverrides & OptionsStylistic & OptionsFiles): Promise<FlatConfigItem[]>;
|
|
261
230
|
|
|
262
|
-
declare function
|
|
231
|
+
declare function yaml(options?: OptionsOverrides & OptionsStylistic & OptionsFiles): Promise<FlatConfigItem[]>;
|
|
263
232
|
|
|
264
|
-
declare function
|
|
233
|
+
declare function test(options?: OptionsFiles & OptionsIsInEditor & OptionsOverrides): Promise<FlatConfigItem[]>;
|
|
265
234
|
|
|
266
235
|
/**
|
|
267
|
-
*
|
|
236
|
+
* Optional perfectionist plugin for props and items sorting.
|
|
237
|
+
*
|
|
238
|
+
* @see https://github.com/azat-io/eslint-plugin-perfectionist
|
|
268
239
|
*/
|
|
269
|
-
declare function
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
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[]>;
|
|
273
245
|
|
|
274
246
|
declare const GLOB_SRC_EXT = "?([cm])[jt]s?(x)";
|
|
275
247
|
declare const GLOB_SRC = "**/*.?([cm])[jt]s?(x)";
|
|
@@ -288,10 +260,23 @@ declare const GLOB_MARKDOWN = "**/*.md";
|
|
|
288
260
|
declare const GLOB_VUE = "**/*.vue";
|
|
289
261
|
declare const GLOB_YAML = "**/*.y?(a)ml";
|
|
290
262
|
declare const GLOB_HTML = "**/*.htm?(l)";
|
|
291
|
-
declare const GLOB_ASTRO = "**/*.astro";
|
|
292
263
|
declare const GLOB_MARKDOWN_CODE = "**/*.md/**/*.?([cm])[jt]s?(x)";
|
|
293
264
|
declare const GLOB_TESTS: string[];
|
|
294
265
|
declare const GLOB_ALL_SRC: string[];
|
|
295
266
|
declare const GLOB_EXCLUDE: string[];
|
|
296
267
|
|
|
297
|
-
|
|
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 };
|