@debbl/eslint-config 3.10.2 → 3.12.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 +4 -4
- package/dist/index.d.ts +197 -173
- package/dist/index.js +1437 -1739
- package/package.json +33 -37
- package/dist/index.cjs +0 -1889
- package/dist/index.d.cts +0 -280
package/README.md
CHANGED
|
@@ -32,22 +32,22 @@ pnpm i eslint @debbl/eslint-config -D
|
|
|
32
32
|
- prettier
|
|
33
33
|
|
|
34
34
|
```js
|
|
35
|
-
import { defineConfig } from
|
|
35
|
+
import { defineConfig } from '@debbl/eslint-config'
|
|
36
36
|
|
|
37
|
-
export default defineConfig()
|
|
37
|
+
export default defineConfig()
|
|
38
38
|
```
|
|
39
39
|
|
|
40
40
|
## Config `Prettier`, will override default rules
|
|
41
41
|
|
|
42
42
|
```js
|
|
43
|
-
import { defineConfig } from
|
|
43
|
+
import { defineConfig } from '@debbl/eslint-config'
|
|
44
44
|
|
|
45
45
|
export default defineConfig({
|
|
46
46
|
typescript: true,
|
|
47
47
|
prettier: {
|
|
48
48
|
semi: false,
|
|
49
49
|
},
|
|
50
|
-
})
|
|
50
|
+
})
|
|
51
51
|
```
|
|
52
52
|
|
|
53
53
|
## Full OptionConfig
|
package/dist/index.d.ts
CHANGED
|
@@ -1,50 +1,63 @@
|
|
|
1
|
-
import { ParserOptions } from
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import { RequiredOptions } from
|
|
1
|
+
import { ParserOptions } from "@typescript-eslint/parser";
|
|
2
|
+
import { FlatGitignoreOptions } from "eslint-config-flat-gitignore";
|
|
3
|
+
import { Linter } from "eslint";
|
|
4
|
+
import { RequiredOptions } from "prettier";
|
|
5
5
|
|
|
6
|
+
//#region src/configs/comments.d.ts
|
|
6
7
|
declare function comments(): Promise<ConfigItem[]>;
|
|
7
|
-
|
|
8
|
+
//#endregion
|
|
9
|
+
//#region src/configs/ignores.d.ts
|
|
8
10
|
type IgnoresConfig = (options: {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
+
enableGitignore?: boolean | Omit<FlatGitignoreOptions, 'name'>;
|
|
12
|
+
files?: ((files: string[]) => string[]) | string[];
|
|
11
13
|
}) => ReturnType<ConfigFn>;
|
|
12
14
|
declare const ignores: IgnoresConfig;
|
|
13
|
-
|
|
15
|
+
//#endregion
|
|
16
|
+
//#region src/configs/imports.d.ts
|
|
14
17
|
declare function imports(): Promise<ConfigItem[]>;
|
|
15
|
-
|
|
18
|
+
//#endregion
|
|
19
|
+
//#region src/configs/javascript.d.ts
|
|
16
20
|
type JavascriptConfig = ConfigFn;
|
|
17
21
|
declare const javascript: JavascriptConfig;
|
|
18
|
-
|
|
22
|
+
//#endregion
|
|
23
|
+
//#region src/configs/jsdoc.d.ts
|
|
19
24
|
declare function jsdoc(): Promise<ConfigItem[]>;
|
|
20
|
-
|
|
25
|
+
//#endregion
|
|
26
|
+
//#region src/configs/jsonc.d.ts
|
|
21
27
|
type JsoncConfig = ConfigFn;
|
|
22
28
|
declare const jsonc: JsoncConfig;
|
|
23
|
-
|
|
29
|
+
//#endregion
|
|
30
|
+
//#region src/configs/markdown.d.ts
|
|
24
31
|
type MarkdownConfig = (options: {
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
32
|
+
componentExts?: string[];
|
|
33
|
+
/**
|
|
34
|
+
* @deprecated remove this option
|
|
35
|
+
*/
|
|
36
|
+
mdx?: boolean;
|
|
30
37
|
} & OptionsOverrides) => ReturnType<ConfigFn>;
|
|
31
38
|
declare const markdown: MarkdownConfig;
|
|
32
|
-
|
|
39
|
+
//#endregion
|
|
40
|
+
//#region src/configs/node.d.ts
|
|
33
41
|
declare function node(): Promise<ConfigItem[]>;
|
|
34
|
-
|
|
42
|
+
//#endregion
|
|
43
|
+
//#region src/configs/perfectionist.d.ts
|
|
35
44
|
/**
|
|
36
45
|
* Perfectionist plugin for props and items sorting.
|
|
37
46
|
*
|
|
38
47
|
* @see https://github.com/azat-io/eslint-plugin-perfectionist
|
|
39
48
|
*/
|
|
40
49
|
declare function perfectionist(): Promise<ConfigItem[]>;
|
|
41
|
-
|
|
50
|
+
//#endregion
|
|
51
|
+
//#region src/configs/prettier.d.ts
|
|
42
52
|
type PrettierRequiredOptions = Partial<RequiredOptions>;
|
|
43
|
-
type PrettierConfig = ({
|
|
44
|
-
|
|
53
|
+
type PrettierConfig = ({
|
|
54
|
+
options
|
|
55
|
+
}: PrettierRequiredOptions & {
|
|
56
|
+
tailwindcss?: boolean;
|
|
45
57
|
}) => Promise<ConfigItem[]>;
|
|
46
58
|
declare const prettier: PrettierConfig;
|
|
47
|
-
|
|
59
|
+
//#endregion
|
|
60
|
+
//#region src/configs/sort.d.ts
|
|
48
61
|
/**
|
|
49
62
|
* Sort package.json
|
|
50
63
|
*
|
|
@@ -57,166 +70,176 @@ declare function sortPackageJson(): Promise<ConfigItem[]>;
|
|
|
57
70
|
* Requires `jsonc` config
|
|
58
71
|
*/
|
|
59
72
|
declare function sortTsconfig(): Promise<ConfigItem[]>;
|
|
60
|
-
|
|
73
|
+
//#endregion
|
|
74
|
+
//#region src/configs/test.d.ts
|
|
61
75
|
type TestConfig = ConfigFn;
|
|
62
76
|
declare const test: TestConfig;
|
|
63
|
-
|
|
77
|
+
//#endregion
|
|
78
|
+
//#region src/configs/toml.d.ts
|
|
64
79
|
type TomlConfig = ConfigFn;
|
|
65
80
|
declare const toml: TomlConfig;
|
|
66
|
-
|
|
81
|
+
//#endregion
|
|
82
|
+
//#region src/configs/typescript.d.ts
|
|
67
83
|
type TypeScriptConfig = (options?: OptionsComponentExts & OptionsTypeScriptWithTypes & OptionsTypeScriptParserOptions & OptionsOverrides & {
|
|
68
|
-
|
|
84
|
+
enableSolid?: boolean;
|
|
69
85
|
}) => ReturnType<ConfigFn>;
|
|
70
86
|
declare const typescript: TypeScriptConfig;
|
|
71
|
-
|
|
87
|
+
//#endregion
|
|
88
|
+
//#region src/configs/unicorn.d.ts
|
|
72
89
|
declare function unicorn(): Promise<ConfigItem[]>;
|
|
73
|
-
|
|
90
|
+
//#endregion
|
|
91
|
+
//#region src/configs/vue.d.ts
|
|
74
92
|
type VueConfig = (options: OptionsHasTypeScript & OptionsOverrides) => ReturnType<ConfigFn>;
|
|
75
93
|
declare const vue: VueConfig;
|
|
76
|
-
|
|
94
|
+
//#endregion
|
|
95
|
+
//#region src/configs/yml.d.ts
|
|
77
96
|
type YmlConfig = (options: OptionsOverrides) => ReturnType<ConfigFn>;
|
|
78
97
|
declare const yml: YmlConfig;
|
|
79
|
-
|
|
98
|
+
//#endregion
|
|
99
|
+
//#region src/configs/react.d.ts
|
|
80
100
|
type ReactConfig = (options: {
|
|
81
|
-
|
|
82
|
-
|
|
101
|
+
next?: boolean;
|
|
102
|
+
compiler?: boolean;
|
|
83
103
|
} & OptionsOverrides) => ReturnType<ConfigFn>;
|
|
84
|
-
|
|
104
|
+
//#endregion
|
|
105
|
+
//#region src/types.d.ts
|
|
85
106
|
type Awaitable<T> = T | Promise<T>;
|
|
86
107
|
type GetConfigOption<T extends (...args: any) => any> = Parameters<T>[0];
|
|
87
108
|
interface ConfigItem extends Linter.Config {
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
109
|
+
/**
|
|
110
|
+
* 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.
|
|
111
|
+
*
|
|
112
|
+
* @see [Using plugins in your configuration](https://eslint.org/docs/latest/user-guide/configuring/configuration-files-new#using-plugins-in-your-configuration)
|
|
113
|
+
*/
|
|
114
|
+
plugins?: Record<string, any>;
|
|
94
115
|
}
|
|
95
116
|
interface OptionsOverrides {
|
|
96
|
-
|
|
117
|
+
overrides?: ConfigItem['rules'];
|
|
97
118
|
}
|
|
98
119
|
type ConfigFn = (options: OptionsOverrides) => Awaitable<ConfigItem[]>;
|
|
99
120
|
interface OptionsComponentExts {
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
121
|
+
/**
|
|
122
|
+
* Additional extensions for components.
|
|
123
|
+
*
|
|
124
|
+
* @example ['vue']
|
|
125
|
+
* @default []
|
|
126
|
+
*/
|
|
127
|
+
componentExts?: string[];
|
|
107
128
|
}
|
|
108
129
|
interface OptionsTypeScriptParserOptions {
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
130
|
+
/**
|
|
131
|
+
* Additional parser options for TypeScript.
|
|
132
|
+
*/
|
|
133
|
+
parserOptions?: Partial<ParserOptions>;
|
|
113
134
|
}
|
|
114
135
|
interface OptionsTypeScriptWithTypes {
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
136
|
+
/**
|
|
137
|
+
* When this options is provided, type aware rules will be enabled.
|
|
138
|
+
* @see https://typescript-eslint.io/linting/typed-linting/
|
|
139
|
+
*/
|
|
140
|
+
tsconfigPath?: string;
|
|
120
141
|
}
|
|
121
142
|
interface OptionsHasTypeScript {
|
|
122
|
-
|
|
143
|
+
typescript?: boolean;
|
|
123
144
|
}
|
|
124
145
|
interface OptionsConfig extends OptionsComponentExts {
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
146
|
+
/**
|
|
147
|
+
* Enable gitignore support.
|
|
148
|
+
* Passing an object to configure the options.
|
|
149
|
+
* @default true
|
|
150
|
+
*/
|
|
151
|
+
gitignore?: boolean | FlatGitignoreOptions;
|
|
152
|
+
/**
|
|
153
|
+
* Enable gitignore support.
|
|
154
|
+
* Passing an object to configure the options.
|
|
155
|
+
* @default true
|
|
156
|
+
*/
|
|
157
|
+
ignores?: boolean | GetConfigOption<IgnoresConfig>;
|
|
158
|
+
/**
|
|
159
|
+
* Enable JavaScript support.
|
|
160
|
+
* Passing an object to configure the options.
|
|
161
|
+
* @default true
|
|
162
|
+
*/
|
|
163
|
+
javascript?: GetConfigOption<JavascriptConfig>;
|
|
164
|
+
/**
|
|
165
|
+
* Enable TypeScript support.
|
|
166
|
+
*
|
|
167
|
+
* Passing an object to enable TypeScript Language Server support.
|
|
168
|
+
*
|
|
169
|
+
* @default false
|
|
170
|
+
*/
|
|
171
|
+
typescript?: boolean | GetConfigOption<TypeScriptConfig>;
|
|
172
|
+
/**
|
|
173
|
+
* Enable test support.
|
|
174
|
+
*
|
|
175
|
+
* @default true
|
|
176
|
+
*/
|
|
177
|
+
test?: boolean | GetConfigOption<TestConfig>;
|
|
178
|
+
/**
|
|
179
|
+
* Enable Vue support.
|
|
180
|
+
*
|
|
181
|
+
* @default false
|
|
182
|
+
*/
|
|
183
|
+
vue?: boolean | GetConfigOption<VueConfig>;
|
|
184
|
+
/**
|
|
185
|
+
* Enable React support, Passing an object to enable Next.js support.
|
|
186
|
+
*
|
|
187
|
+
* @default false
|
|
188
|
+
*/
|
|
189
|
+
react?: boolean | GetConfigOption<ReactConfig>;
|
|
190
|
+
/**
|
|
191
|
+
* Enable solid support, Passing an object to enable Next.js support.
|
|
192
|
+
*
|
|
193
|
+
* @default false
|
|
194
|
+
*/
|
|
195
|
+
solid?: boolean;
|
|
196
|
+
/**
|
|
197
|
+
* Enable JSONC support.
|
|
198
|
+
*
|
|
199
|
+
* @default true
|
|
200
|
+
*/
|
|
201
|
+
jsonc?: boolean | GetConfigOption<JsoncConfig>;
|
|
202
|
+
/**
|
|
203
|
+
* Enable YML support.
|
|
204
|
+
*
|
|
205
|
+
* @default true
|
|
206
|
+
*/
|
|
207
|
+
yml?: boolean | GetConfigOption<YmlConfig>;
|
|
208
|
+
/**
|
|
209
|
+
* Enable TOML support.
|
|
210
|
+
* @default true
|
|
211
|
+
*/
|
|
212
|
+
toml?: boolean | GetConfigOption<TomlConfig>;
|
|
213
|
+
/**
|
|
214
|
+
* Enable Markdown support.
|
|
215
|
+
*
|
|
216
|
+
* @default true
|
|
217
|
+
*/
|
|
218
|
+
markdown?: boolean | GetConfigOption<MarkdownConfig>;
|
|
219
|
+
/**
|
|
220
|
+
* Enable prettier rules.
|
|
221
|
+
*
|
|
222
|
+
* @default true
|
|
223
|
+
*/
|
|
224
|
+
prettier?: boolean | Omit<GetConfigOption<PrettierConfig>, 'tailwindcss'>;
|
|
225
|
+
/**
|
|
226
|
+
* Enable Tailwind CSS support.
|
|
227
|
+
*
|
|
228
|
+
* if set to "prettier", it will use `prettier-plugin-tailwindcss`
|
|
229
|
+
* @see https://github.com/tailwindlabs/prettier-plugin-tailwindcss
|
|
230
|
+
*
|
|
231
|
+
* @default false
|
|
232
|
+
*/
|
|
233
|
+
tailwindcss?: boolean | 'prettier';
|
|
213
234
|
}
|
|
214
|
-
|
|
235
|
+
//#endregion
|
|
236
|
+
//#region src/factory.d.ts
|
|
215
237
|
/**
|
|
216
238
|
* Construct an array of ESLint flat config items.
|
|
217
239
|
*/
|
|
218
240
|
declare function defineConfig(options?: OptionsConfig, ...userConfigs: ConfigItem[]): Promise<ConfigItem[]>;
|
|
219
|
-
|
|
241
|
+
//#endregion
|
|
242
|
+
//#region src/globs.d.ts
|
|
220
243
|
declare const GLOB_SRC_EXT = "?([cm])[jt]s?(x)";
|
|
221
244
|
declare const GLOB_SRC = "**/*.?([cm])[jt]s?(x)";
|
|
222
245
|
declare const GLOB_JS = "**/*.?([cm])js";
|
|
@@ -242,39 +265,40 @@ declare const GLOB_HTML = "**/*.htm?(l)";
|
|
|
242
265
|
declare const GLOB_TESTS: string[];
|
|
243
266
|
declare const GLOB_ALL_SRC: string[];
|
|
244
267
|
declare const GLOB_EXCLUDE: string[];
|
|
245
|
-
|
|
268
|
+
//#endregion
|
|
269
|
+
//#region src/utils.d.ts
|
|
246
270
|
declare const parserPlain: {
|
|
247
|
-
|
|
248
|
-
|
|
271
|
+
meta: {
|
|
272
|
+
name: string;
|
|
273
|
+
};
|
|
274
|
+
parseForESLint: (code: string) => {
|
|
275
|
+
ast: {
|
|
276
|
+
body: never[];
|
|
277
|
+
comments: never[];
|
|
278
|
+
loc: {
|
|
279
|
+
end: number;
|
|
280
|
+
start: number;
|
|
281
|
+
};
|
|
282
|
+
range: number[];
|
|
283
|
+
tokens: never[];
|
|
284
|
+
type: string;
|
|
249
285
|
};
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
comments: never[];
|
|
254
|
-
loc: {
|
|
255
|
-
end: number;
|
|
256
|
-
start: number;
|
|
257
|
-
};
|
|
258
|
-
range: number[];
|
|
259
|
-
tokens: never[];
|
|
260
|
-
type: string;
|
|
261
|
-
};
|
|
262
|
-
scopeManager: null;
|
|
263
|
-
services: {
|
|
264
|
-
isPlain: boolean;
|
|
265
|
-
};
|
|
266
|
-
visitorKeys: {
|
|
267
|
-
Program: never[];
|
|
268
|
-
};
|
|
286
|
+
scopeManager: null;
|
|
287
|
+
services: {
|
|
288
|
+
isPlain: boolean;
|
|
269
289
|
};
|
|
290
|
+
visitorKeys: {
|
|
291
|
+
Program: never[];
|
|
292
|
+
};
|
|
293
|
+
};
|
|
270
294
|
};
|
|
271
295
|
/**
|
|
272
296
|
* Combine array and non-array configs into a single array.
|
|
273
297
|
*/
|
|
274
298
|
declare function combine(...configs: Awaitable<ConfigItem | ConfigItem[]>[]): Promise<ConfigItem[]>;
|
|
275
299
|
declare function interopDefault<T>(m: Awaitable<T>): Promise<T extends {
|
|
276
|
-
|
|
300
|
+
default: infer U;
|
|
277
301
|
} ? U : T>;
|
|
278
302
|
declare function getConfigOptions<T>(options: T): {};
|
|
279
|
-
|
|
280
|
-
export {
|
|
303
|
+
//#endregion
|
|
304
|
+
export { Awaitable, ConfigFn, ConfigItem, GLOB_ALL_SRC, GLOB_ASTRO_TS, GLOB_CSS, GLOB_EXCLUDE, GLOB_HTML, GLOB_JS, GLOB_JSON, GLOB_JSON5, GLOB_JSONC, GLOB_JSX, GLOB_LESS, GLOB_MARKDOWN, GLOB_MARKDOWN_CODE, GLOB_MDX, GLOB_POSTCSS, GLOB_SCSS, GLOB_SRC, GLOB_SRC_EXT, GLOB_STYLE, GLOB_TESTS, GLOB_TOML, GLOB_TS, GLOB_TSX, GLOB_VUE, GLOB_YAML, GetConfigOption, IgnoresConfig, JavascriptConfig, JsoncConfig, MarkdownConfig, OptionsComponentExts, OptionsConfig, OptionsHasTypeScript, OptionsOverrides, OptionsTypeScriptParserOptions, OptionsTypeScriptWithTypes, PrettierConfig, PrettierRequiredOptions, TestConfig, TomlConfig, TypeScriptConfig, VueConfig, YmlConfig, combine, comments, defineConfig as default, defineConfig, getConfigOptions, ignores, imports, interopDefault, javascript, jsdoc, jsonc, markdown, node, parserPlain, perfectionist, prettier, sortPackageJson, sortTsconfig, test, toml, typescript, unicorn, vue, yml };
|