@isentinel/eslint-config 0.3.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/LICENSE +21 -0
- package/README.md +286 -0
- package/bin/index.js +3 -0
- package/dist/index.cjs +2785 -0
- package/dist/index.d.cts +378 -0
- package/dist/index.d.ts +378 -0
- package/dist/index.js +2726 -0
- package/package.json +131 -0
package/dist/index.d.cts
ADDED
|
@@ -0,0 +1,378 @@
|
|
|
1
|
+
import { RuleConfig, MergeIntersection, RenamePrefix, EslintCommentsRules, EslintRules, ImportRules, JsoncRules, Prefix, ReactHooksRules, ReactRules, SonarJSRules, 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';
|
|
6
|
+
import { ParserOptions } from '@typescript-eslint/parser';
|
|
7
|
+
import { Linter } from 'eslint';
|
|
8
|
+
import { FlatGitignoreOptions } from 'eslint-config-flat-gitignore';
|
|
9
|
+
import { Rules as Rules$1 } from 'eslint-plugin-antfu';
|
|
10
|
+
|
|
11
|
+
/** Vendor types from Prettier so we don't rely on the dependency. */
|
|
12
|
+
type VendoredPrettierOptions = Partial<VendoredPrettierOptionsRequired>;
|
|
13
|
+
interface VendoredPrettierOptionsRequired {
|
|
14
|
+
/**
|
|
15
|
+
* Include parentheses around a sole arrow function parameter.
|
|
16
|
+
*
|
|
17
|
+
* @default "always"
|
|
18
|
+
*/
|
|
19
|
+
arrowParens: "avoid" | "always";
|
|
20
|
+
/**
|
|
21
|
+
* Put the `>` of a multi-line HTML (HTML, JSX, Angular) element at the end
|
|
22
|
+
* of the last line instead of being alone on the next line (does not apply
|
|
23
|
+
* to self closing elements).
|
|
24
|
+
*/
|
|
25
|
+
bracketSameLine: boolean;
|
|
26
|
+
/** Print spaces between brackets in object literals. */
|
|
27
|
+
bracketSpacing: boolean;
|
|
28
|
+
/**
|
|
29
|
+
* Which end of line characters to apply.
|
|
30
|
+
*
|
|
31
|
+
* @default "lf"
|
|
32
|
+
*/
|
|
33
|
+
endOfLine: "auto" | "lf" | "crlf" | "cr";
|
|
34
|
+
/**
|
|
35
|
+
* How to handle whitespaces in HTML.
|
|
36
|
+
*
|
|
37
|
+
* @default "css"
|
|
38
|
+
*/
|
|
39
|
+
htmlWhitespaceSensitivity: "css" | "strict" | "ignore";
|
|
40
|
+
/**
|
|
41
|
+
* Put the `>` of a multi-line JSX element at the end of the last line
|
|
42
|
+
* instead of being alone on the next line.
|
|
43
|
+
*
|
|
44
|
+
* @deprecated Use bracketSameLine instead.
|
|
45
|
+
*/
|
|
46
|
+
jsxBracketSameLine: boolean;
|
|
47
|
+
/** Use single quotes in JSX. */
|
|
48
|
+
jsxSingleQuote: boolean;
|
|
49
|
+
/** Provide ability to support new languages to prettier. */
|
|
50
|
+
plugins: Array<string | any>;
|
|
51
|
+
printWidth: number;
|
|
52
|
+
/**
|
|
53
|
+
* By default, Prettier will wrap markdown text as-is since some services
|
|
54
|
+
* use a linebreak-sensitive renderer. In some cases you may want to rely on
|
|
55
|
+
* editor/viewer soft wrapping instead, so this option allows you to opt
|
|
56
|
+
* out.
|
|
57
|
+
*
|
|
58
|
+
* @default "preserve"
|
|
59
|
+
*/
|
|
60
|
+
proseWrap: "always" | "never" | "preserve";
|
|
61
|
+
/**
|
|
62
|
+
* Change when properties in objects are quoted.
|
|
63
|
+
*
|
|
64
|
+
* @default "as-needed"
|
|
65
|
+
*/
|
|
66
|
+
quoteProps: "as-needed" | "consistent" | "preserve";
|
|
67
|
+
/**
|
|
68
|
+
* Format only a segment of a file.
|
|
69
|
+
*
|
|
70
|
+
* @default Number.POSITIVE_INFINITY
|
|
71
|
+
*/
|
|
72
|
+
rangeEnd: number;
|
|
73
|
+
/** Format only a segment of a file. */
|
|
74
|
+
rangeStart: number;
|
|
75
|
+
/** Print semicolons at the ends of statements. */
|
|
76
|
+
semi: boolean;
|
|
77
|
+
/**
|
|
78
|
+
* Enforce single attribute per line in HTML, and JSX.
|
|
79
|
+
*
|
|
80
|
+
* @default false
|
|
81
|
+
*/
|
|
82
|
+
singleAttributePerLine: boolean;
|
|
83
|
+
/** Use single quotes instead of double quotes. */
|
|
84
|
+
singleQuote: boolean;
|
|
85
|
+
/** Specify the number of spaces per indentation-level. */
|
|
86
|
+
tabWidth: number;
|
|
87
|
+
/** Print trailing commas wherever possible. */
|
|
88
|
+
trailingComma: "none" | "es5" | "all";
|
|
89
|
+
/** Indent lines with tabs instead of spaces. */
|
|
90
|
+
useTabs?: boolean;
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
type WrapRuleConfig<T extends Record<string, any>> = {
|
|
94
|
+
[K in keyof T]: T[K] extends RuleConfig ? T[K] : RuleConfig<T[K]>;
|
|
95
|
+
};
|
|
96
|
+
type Awaitable<T> = T | Promise<T>;
|
|
97
|
+
type Rules = WrapRuleConfig<MergeIntersection<RenamePrefix<RuleOptions, "@typescript-eslint/", "ts/"> & EslintCommentsRules & EslintRules & ImportRules & RuleOptions$1 & JsoncRules & Prefix<Rules$1, "antfu/"> & Prefix<UnprefixedRuleOptions, "style/"> & ReactHooksRules & ReactRules & RenamePrefix<SonarJSRules, "sonarjs/", "sonar/"> & RuleOptions$2>>;
|
|
98
|
+
type FlatConfigItem = Omit<FlatESLintConfigItem<Rules, false>, "plugins"> & {
|
|
99
|
+
/** Custom name of each config item. */
|
|
100
|
+
name?: string;
|
|
101
|
+
/**
|
|
102
|
+
* An object containing a name-value mapping of plugin names to plugin
|
|
103
|
+
* objects. When `files` is specified, these plugins are only available to
|
|
104
|
+
* the matching files.
|
|
105
|
+
*
|
|
106
|
+
* @see [Using plugins in your configuration](https://eslint.org/docs/latest/user-guide/configuring/configuration-files-new#using-plugins-in-your-configuration)
|
|
107
|
+
*/
|
|
108
|
+
plugins?: Record<string, any>;
|
|
109
|
+
};
|
|
110
|
+
type UserConfigItem = FlatConfigItem | Linter.FlatConfig;
|
|
111
|
+
interface OptionsFiles {
|
|
112
|
+
/** Override the `files` option to provide custom globs. */
|
|
113
|
+
files?: Array<string>;
|
|
114
|
+
}
|
|
115
|
+
type OptionsTypescript = (OptionsTypeScriptWithTypes & OptionsOverrides) | (OptionsTypeScriptParserOptions & OptionsOverrides);
|
|
116
|
+
interface OptionsFormatters {
|
|
117
|
+
/**
|
|
118
|
+
* Enable formatting support for CSS, Less, Sass, and SCSS.
|
|
119
|
+
*
|
|
120
|
+
* Currently only support Prettier.
|
|
121
|
+
*/
|
|
122
|
+
css?: "prettier" | boolean;
|
|
123
|
+
/**
|
|
124
|
+
* Custom options for dprint.
|
|
125
|
+
*
|
|
126
|
+
* By default it's controlled by our own config.
|
|
127
|
+
*/
|
|
128
|
+
dprintOptions?: boolean;
|
|
129
|
+
/** Enable formatting support for GraphQL. */
|
|
130
|
+
graphql?: "prettier" | boolean;
|
|
131
|
+
/**
|
|
132
|
+
* Enable formatting support for HTML.
|
|
133
|
+
*
|
|
134
|
+
* Currently only support Prettier.
|
|
135
|
+
*/
|
|
136
|
+
html?: "prettier" | boolean;
|
|
137
|
+
/**
|
|
138
|
+
* Enable formatting support for Markdown.
|
|
139
|
+
*
|
|
140
|
+
* Support both Prettier and dprint.
|
|
141
|
+
*
|
|
142
|
+
* When set to `true`, it will use Prettier.
|
|
143
|
+
*/
|
|
144
|
+
markdown?: "prettier" | "dprint" | boolean;
|
|
145
|
+
/**
|
|
146
|
+
* Custom options for Prettier.
|
|
147
|
+
*
|
|
148
|
+
* By default it's controlled by our own config.
|
|
149
|
+
*/
|
|
150
|
+
prettierOptions?: VendoredPrettierOptions;
|
|
151
|
+
/**
|
|
152
|
+
* Enable formatting support for TOML.
|
|
153
|
+
*
|
|
154
|
+
* Currently only support dprint.
|
|
155
|
+
*/
|
|
156
|
+
toml?: "dprint" | boolean;
|
|
157
|
+
}
|
|
158
|
+
interface OptionsComponentExtensions {
|
|
159
|
+
/** Additional extensions for components. */
|
|
160
|
+
componentExts?: Array<string>;
|
|
161
|
+
}
|
|
162
|
+
interface OptionsTypeScriptParserOptions {
|
|
163
|
+
/**
|
|
164
|
+
* Glob patterns for files that should be type aware.
|
|
165
|
+
*
|
|
166
|
+
* @default \['**\/*.{ts,tsx}']
|
|
167
|
+
*/
|
|
168
|
+
filesTypeAware?: Array<string>;
|
|
169
|
+
/** Additional parser options for TypeScript. */
|
|
170
|
+
parserOptions?: Partial<ParserOptions>;
|
|
171
|
+
}
|
|
172
|
+
interface OptionsTypeScriptWithTypes {
|
|
173
|
+
/**
|
|
174
|
+
* When this options is provided, type aware rules will be enabled.
|
|
175
|
+
*
|
|
176
|
+
* @see https://typescript-eslint.io/linting/typed-linting/
|
|
177
|
+
*/
|
|
178
|
+
tsconfigPath?: string | Array<string>;
|
|
179
|
+
}
|
|
180
|
+
interface OptionsHasTypeScript {
|
|
181
|
+
typescript?: boolean;
|
|
182
|
+
}
|
|
183
|
+
interface OptionsStylistic {
|
|
184
|
+
stylistic?: boolean | StylisticConfig;
|
|
185
|
+
}
|
|
186
|
+
type StylisticConfig = Pick<StylisticCustomizeOptions, "indent" | "quotes" | "jsx" | "semi">;
|
|
187
|
+
interface OptionsOverrides {
|
|
188
|
+
overrides?: FlatConfigItem["rules"];
|
|
189
|
+
}
|
|
190
|
+
interface OptionsIsInEditor {
|
|
191
|
+
isInEditor?: boolean;
|
|
192
|
+
}
|
|
193
|
+
interface OptionsConfig extends OptionsComponentExtensions {
|
|
194
|
+
/**
|
|
195
|
+
* Use external formatters to format files.
|
|
196
|
+
*
|
|
197
|
+
* Requires installing:
|
|
198
|
+
*
|
|
199
|
+
* - `eslint-plugin-format`.
|
|
200
|
+
*
|
|
201
|
+
* When set to `true`, it will enable all formatters.
|
|
202
|
+
*
|
|
203
|
+
* @default false
|
|
204
|
+
*/
|
|
205
|
+
formatters?: boolean | OptionsFormatters;
|
|
206
|
+
/**
|
|
207
|
+
* Enable gitignore support.
|
|
208
|
+
*
|
|
209
|
+
* Passing an object to configure the options.
|
|
210
|
+
*
|
|
211
|
+
* @default true
|
|
212
|
+
* @see https://github.com/antfu/eslint-config-flat-gitignore
|
|
213
|
+
*/
|
|
214
|
+
gitignore?: boolean | FlatGitignoreOptions;
|
|
215
|
+
/**
|
|
216
|
+
* Control to disable some rules in editors.
|
|
217
|
+
*
|
|
218
|
+
* @default auto-detect based on the process.env
|
|
219
|
+
*/
|
|
220
|
+
isInEditor?: boolean;
|
|
221
|
+
/**
|
|
222
|
+
* Enable JSONC support.
|
|
223
|
+
*
|
|
224
|
+
* @default true
|
|
225
|
+
*/
|
|
226
|
+
jsonc?: boolean | OptionsOverrides;
|
|
227
|
+
/**
|
|
228
|
+
* Enable JSX related rules.
|
|
229
|
+
*
|
|
230
|
+
* Currently only stylistic rules are included.
|
|
231
|
+
*
|
|
232
|
+
* @default true
|
|
233
|
+
*/
|
|
234
|
+
jsx?: boolean;
|
|
235
|
+
/**
|
|
236
|
+
* Enable linting for **code snippets** in Markdown.
|
|
237
|
+
*
|
|
238
|
+
* For formatting Markdown content, enable also `formatters.markdown`.
|
|
239
|
+
*
|
|
240
|
+
* @default true
|
|
241
|
+
*/
|
|
242
|
+
markdown?: boolean | OptionsOverrides;
|
|
243
|
+
/**
|
|
244
|
+
* Enable react rules.
|
|
245
|
+
*
|
|
246
|
+
* Requires installing:
|
|
247
|
+
*
|
|
248
|
+
* - `eslint-plugin-react`
|
|
249
|
+
* - `eslint-plugin-react-hooks`.
|
|
250
|
+
*
|
|
251
|
+
* @default false
|
|
252
|
+
*/
|
|
253
|
+
react?: boolean | OptionsOverrides;
|
|
254
|
+
/** Enable Roblox-TS support. */
|
|
255
|
+
roblox?: boolean;
|
|
256
|
+
/**
|
|
257
|
+
* Enable stylistic rules.
|
|
258
|
+
*
|
|
259
|
+
* @default true
|
|
260
|
+
*/
|
|
261
|
+
stylistic?: boolean | StylisticConfig;
|
|
262
|
+
/**
|
|
263
|
+
* Enable TypeScript support.
|
|
264
|
+
*
|
|
265
|
+
* Passing an object to enable TypeScript Language Server support.
|
|
266
|
+
*
|
|
267
|
+
* @default auto-detect based on the dependencies
|
|
268
|
+
*/
|
|
269
|
+
typescript?: OptionsTypescript;
|
|
270
|
+
}
|
|
271
|
+
|
|
272
|
+
declare function comments(): Promise<Array<FlatConfigItem>>;
|
|
273
|
+
|
|
274
|
+
declare function formatters(options?: OptionsFormatters | true, stylistic?: StylisticConfig, markdownEnabled?: boolean): Promise<Array<FlatConfigItem>>;
|
|
275
|
+
|
|
276
|
+
declare function ignores(): Promise<Array<FlatConfigItem>>;
|
|
277
|
+
|
|
278
|
+
declare function imports(options?: OptionsStylistic): Promise<Array<FlatConfigItem>>;
|
|
279
|
+
|
|
280
|
+
declare function jsdoc(options?: OptionsStylistic): Promise<Array<FlatConfigItem>>;
|
|
281
|
+
|
|
282
|
+
declare function jsonc(options?: OptionsFiles & OptionsStylistic & OptionsOverrides): Promise<Array<FlatConfigItem>>;
|
|
283
|
+
|
|
284
|
+
declare function markdown(options?: OptionsFiles & OptionsComponentExtensions & OptionsOverrides, formatMarkdown?: boolean): Promise<Array<FlatConfigItem>>;
|
|
285
|
+
|
|
286
|
+
/**
|
|
287
|
+
* Perfectionist plugin for props and items sorting.
|
|
288
|
+
*
|
|
289
|
+
* @returns The configuration.
|
|
290
|
+
* @see https://github.com/azat-io/eslint-plugin-perfectionist
|
|
291
|
+
*/
|
|
292
|
+
declare function perfectionist(): Promise<Array<FlatConfigItem>>;
|
|
293
|
+
|
|
294
|
+
declare function prettier(options?: OptionsFiles & OptionsComponentExtensions & OptionsOverrides & OptionsTypeScriptWithTypes & OptionsTypeScriptParserOptions): Promise<Array<FlatConfigItem>>;
|
|
295
|
+
|
|
296
|
+
declare function promise(): Promise<Array<FlatConfigItem>>;
|
|
297
|
+
|
|
298
|
+
declare function react(options?: OptionsHasTypeScript & OptionsOverrides & OptionsFiles): Promise<Array<FlatConfigItem>>;
|
|
299
|
+
|
|
300
|
+
declare function roblox(options?: OptionsFiles & OptionsComponentExtensions & OptionsOverrides & OptionsTypeScriptWithTypes & OptionsTypeScriptParserOptions): Promise<Array<FlatConfigItem>>;
|
|
301
|
+
|
|
302
|
+
declare function shopify(): Promise<Array<FlatConfigItem>>;
|
|
303
|
+
|
|
304
|
+
declare function sonarjs(): Promise<Array<FlatConfigItem>>;
|
|
305
|
+
|
|
306
|
+
/**
|
|
307
|
+
* Sort package.json.
|
|
308
|
+
*
|
|
309
|
+
* Requires `jsonc` config.
|
|
310
|
+
*
|
|
311
|
+
* @returns An array of flat configuration items.
|
|
312
|
+
*/
|
|
313
|
+
declare function sortPackageJson(): Promise<Array<FlatConfigItem>>;
|
|
314
|
+
/**
|
|
315
|
+
* Sort tsconfig.json.
|
|
316
|
+
*
|
|
317
|
+
* Requires `jsonc` config.
|
|
318
|
+
*
|
|
319
|
+
* @returns An array of flat configuration items.
|
|
320
|
+
*/
|
|
321
|
+
declare function sortTsconfig(): Array<FlatConfigItem>;
|
|
322
|
+
|
|
323
|
+
declare const StylisticConfigDefaults: StylisticConfig;
|
|
324
|
+
declare function stylistic(options?: StylisticConfig): Promise<Array<FlatConfigItem>>;
|
|
325
|
+
|
|
326
|
+
declare function typescript(options?: OptionsFiles & OptionsComponentExtensions & OptionsOverrides & OptionsTypeScriptWithTypes & OptionsTypeScriptParserOptions): Promise<Array<FlatConfigItem>>;
|
|
327
|
+
|
|
328
|
+
declare function unicorn(): Promise<Array<FlatConfigItem>>;
|
|
329
|
+
|
|
330
|
+
/**
|
|
331
|
+
* Generates an array of user configuration items based on the provided options
|
|
332
|
+
* and user configs.
|
|
333
|
+
*
|
|
334
|
+
* @param options - The options for generating the user configuration items.
|
|
335
|
+
* @param userConfigs - Additional user configuration items.
|
|
336
|
+
* @returns A promise that resolves to an array of user configuration items.
|
|
337
|
+
*/
|
|
338
|
+
declare function style(options?: OptionsConfig & FlatConfigItem, ...userConfigs: Array<Awaitable<UserConfigItem | Array<UserConfigItem>>>): Promise<Array<UserConfigItem>>;
|
|
339
|
+
|
|
340
|
+
declare const GLOB_SRC_EXT = "?([cm])[jt]s?(x)";
|
|
341
|
+
declare const GLOB_SRC = "**/*.?([cm])[jt]s?(x)";
|
|
342
|
+
declare const GLOB_JS = "**/*.?([cm])js";
|
|
343
|
+
declare const GLOB_JSX = "**/*.?([cm])jsx";
|
|
344
|
+
declare const GLOB_TS = "**/*.?([cm])ts";
|
|
345
|
+
declare const GLOB_TSX = "**/*.?([cm])tsx";
|
|
346
|
+
declare const GLOB_STYLE = "**/*.{c,le,sc}ss";
|
|
347
|
+
declare const GLOB_CSS = "**/*.css";
|
|
348
|
+
declare const GLOB_POSTCSS = "**/*.{p,post}css";
|
|
349
|
+
declare const GLOB_LESS = "**/*.less";
|
|
350
|
+
declare const GLOB_SCSS = "**/*.scss";
|
|
351
|
+
declare const GLOB_JSON = "**/*.json";
|
|
352
|
+
declare const GLOB_JSON5 = "**/*.json5";
|
|
353
|
+
declare const GLOB_JSONC = "**/*.jsonc";
|
|
354
|
+
declare const GLOB_MARKDOWN = "**/*.md";
|
|
355
|
+
declare const GLOB_MARKDOWN_IN_MARKDOWN = "**/*.md/*.md";
|
|
356
|
+
declare const GLOB_HTML = "**/*.htm?(l)";
|
|
357
|
+
declare const GLOB_MARKDOWN_CODE = "**/*.md/**/*.?([cm])[jt]s?(x)";
|
|
358
|
+
declare const GLOB_ALL_SRC: string[];
|
|
359
|
+
declare const GLOB_EXCLUDE: string[];
|
|
360
|
+
|
|
361
|
+
/**
|
|
362
|
+
* Combine array and non-array configs into a single array.
|
|
363
|
+
*
|
|
364
|
+
* @param configs - Array of configs or a single config.
|
|
365
|
+
* @returns Combined array of configs.
|
|
366
|
+
*/
|
|
367
|
+
declare function combine(...configs: Array<Awaitable<UserConfigItem | Array<UserConfigItem>>>): Promise<Array<UserConfigItem>>;
|
|
368
|
+
declare function renameRules(rules: Record<string, any>, from: string, to: string): Record<string, any>;
|
|
369
|
+
declare function toArray<T>(value: T | Array<T>): Array<T>;
|
|
370
|
+
declare function interopDefault<T>(dynamicImport: Awaitable<T>): Promise<T extends {
|
|
371
|
+
default: infer U;
|
|
372
|
+
} ? U : T>;
|
|
373
|
+
declare function ensurePackages(packages: Array<string>): Promise<void>;
|
|
374
|
+
type ResolvedOptions<T> = T extends boolean ? never : NonNullable<T>;
|
|
375
|
+
declare function resolveSubOptions<K extends keyof OptionsConfig>(options: OptionsConfig, key: K): ResolvedOptions<OptionsConfig[K]>;
|
|
376
|
+
declare function getOverrides<K extends keyof OptionsConfig>(options: OptionsConfig, key: K): any;
|
|
377
|
+
|
|
378
|
+
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_MARKDOWN_IN_MARKDOWN, GLOB_POSTCSS, GLOB_SCSS, GLOB_SRC, GLOB_SRC_EXT, GLOB_STYLE, GLOB_TS, GLOB_TSX, type OptionsComponentExtensions, type OptionsConfig, type OptionsFiles, type OptionsFormatters, type OptionsHasTypeScript, type OptionsIsInEditor, type OptionsOverrides, type OptionsStylistic, type OptionsTypeScriptParserOptions, type OptionsTypeScriptWithTypes, type OptionsTypescript, type ResolvedOptions, type Rules, type StylisticConfig, StylisticConfigDefaults, type UserConfigItem, type WrapRuleConfig, combine, comments, style as default, ensurePackages, formatters, getOverrides, ignores, imports, interopDefault, jsdoc, jsonc, markdown, perfectionist, prettier, promise, react, renameRules, resolveSubOptions, roblox, shopify, sonarjs, sortPackageJson, sortTsconfig, style, stylistic, toArray, typescript, unicorn };
|