@curev/eslint-config 0.3.5 → 0.3.7

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,13 +1,13 @@
1
- import { FlatGitignoreOptions } from 'eslint-config-flat-gitignore';
2
- import { ParserOptions } from '@typescript-eslint/parser';
3
- import { Options } from 'eslint-processor-vue-blocks';
4
- import { Linter } from 'eslint';
5
1
  import { RuleConfig, MergeIntersection, RenamePrefix, VitestRules, YmlRules, NRules, Prefix, ReactHooksRules, ReactRules, ImportRules, EslintRules, JsoncRules, VueRules, EslintCommentsRules, FlatESLintConfigItem } from '@antfu/eslint-define-config';
2
+ import { Rules as Rules$1 } from '@curev/eslint-plugin';
6
3
  import { RuleOptions as RuleOptions$1 } from '@eslint-types/jsdoc/types';
7
4
  import { RuleOptions } from '@eslint-types/typescript-eslint/types';
8
5
  import { RuleOptions as RuleOptions$2 } from '@eslint-types/unicorn/types';
9
- import { Rules as Rules$1 } from '@curev/eslint-plugin';
10
6
  import { UnprefixedRuleOptions, StylisticCustomizeOptions } from '@stylistic/eslint-plugin';
7
+ import { ParserOptions } from '@typescript-eslint/parser';
8
+ import { Linter } from 'eslint';
9
+ import { FlatGitignoreOptions } from 'eslint-config-flat-gitignore';
10
+ import { Options } from 'eslint-processor-vue-blocks';
11
11
 
12
12
  /**
13
13
  * Vendor types from Prettier so we don't rely on the dependency.
@@ -15,97 +15,97 @@ import { UnprefixedRuleOptions, StylisticCustomizeOptions } from '@stylistic/esl
15
15
  type VendoredPrettierOptions = Partial<VendoredPrettierOptionsRequired>;
16
16
  interface VendoredPrettierOptionsRequired {
17
17
  /**
18
- * Specify the line length that the printer will wrap on.
19
- * @default 120
18
+ * Include parentheses around a sole arrow function parameter.
19
+ * @default "always"
20
20
  */
21
- printWidth: number;
21
+ arrowParens: "always" | "avoid";
22
22
  /**
23
- * Specify the number of spaces per indentation-level.
23
+ * Put the `>` of a multi-line HTML (HTML, JSX, Vue, Angular) element at the end of the last line instead of being
24
+ * alone on the next line (does not apply to self closing elements).
24
25
  */
25
- tabWidth: number;
26
+ bracketSameLine: boolean;
26
27
  /**
27
- * Indent lines with tabs instead of spaces
28
+ * Print spaces between brackets in object literals.
28
29
  */
29
- useTabs?: boolean;
30
+ bracketSpacing: boolean;
30
31
  /**
31
- * Print semicolons at the ends of statements.
32
+ * Which end of line characters to apply.
33
+ * @default "lf"
32
34
  */
33
- semi: boolean;
35
+ endOfLine: "auto" | "cr" | "crlf" | "lf";
34
36
  /**
35
- * Use single quotes instead of double quotes.
37
+ * How to handle whitespaces in HTML.
38
+ * @default "css"
36
39
  */
37
- singleQuote: boolean;
40
+ htmlWhitespaceSensitivity: "css" | "ignore" | "strict";
41
+ /**
42
+ * Put the `>` of a multi-line JSX element at the end of the last line instead of being alone on the next line.
43
+ * @deprecated use bracketSameLine instead
44
+ */
45
+ jsxBracketSameLine: boolean;
38
46
  /**
39
47
  * Use single quotes in JSX.
40
48
  */
41
49
  jsxSingleQuote: boolean;
42
50
  /**
43
- * Print trailing commas wherever possible.
51
+ * Provide ability to support new languages to prettier.
44
52
  */
45
- trailingComma: "none" | "es5" | "all";
53
+ plugins: Array<any | string>;
46
54
  /**
47
- * Print spaces between brackets in object literals.
55
+ * Specify the line length that the printer will wrap on.
56
+ * @default 120
48
57
  */
49
- bracketSpacing: boolean;
58
+ printWidth: number;
50
59
  /**
51
- * Put the `>` of a multi-line HTML (HTML, JSX, Vue, Angular) element at the end of the last line instead of being
52
- * alone on the next line (does not apply to self closing elements).
60
+ * By default, Prettier will wrap markdown text as-is since some services use a linebreak-sensitive renderer.
61
+ * In some cases you may want to rely on editor/viewer soft wrapping instead, so this option allows you to opt out.
62
+ * @default "preserve"
53
63
  */
54
- bracketSameLine: boolean;
64
+ proseWrap: "always" | "never" | "preserve";
55
65
  /**
56
- * Put the `>` of a multi-line JSX element at the end of the last line instead of being alone on the next line.
57
- * @deprecated use bracketSameLine instead
66
+ * Change when properties in objects are quoted.
67
+ * @default "as-needed"
58
68
  */
59
- jsxBracketSameLine: boolean;
69
+ quoteProps: "as-needed" | "consistent" | "preserve";
60
70
  /**
61
71
  * Format only a segment of a file.
72
+ * @default Number.POSITIVE_INFINITY
62
73
  */
63
- rangeStart: number;
74
+ rangeEnd: number;
64
75
  /**
65
76
  * Format only a segment of a file.
66
- * @default Number.POSITIVE_INFINITY
67
77
  */
68
- rangeEnd: number;
78
+ rangeStart: number;
69
79
  /**
70
- * By default, Prettier will wrap markdown text as-is since some services use a linebreak-sensitive renderer.
71
- * In some cases you may want to rely on editor/viewer soft wrapping instead, so this option allows you to opt out.
72
- * @default "preserve"
80
+ * Print semicolons at the ends of statements.
73
81
  */
74
- proseWrap: "always" | "never" | "preserve";
82
+ semi: boolean;
75
83
  /**
76
- * Include parentheses around a sole arrow function parameter.
77
- * @default "always"
84
+ * Enforce single attribute per line in HTML, Vue and JSX.
85
+ * @default false
78
86
  */
79
- arrowParens: "avoid" | "always";
87
+ singleAttributePerLine: boolean;
80
88
  /**
81
- * Provide ability to support new languages to prettier.
89
+ * Use single quotes instead of double quotes.
82
90
  */
83
- plugins: Array<string | any>;
91
+ singleQuote: boolean;
84
92
  /**
85
- * How to handle whitespaces in HTML.
86
- * @default "css"
93
+ * Specify the number of spaces per indentation-level.
87
94
  */
88
- htmlWhitespaceSensitivity: "css" | "strict" | "ignore";
95
+ tabWidth: number;
89
96
  /**
90
- * Which end of line characters to apply.
91
- * @default "lf"
97
+ * Print trailing commas wherever possible.
92
98
  */
93
- endOfLine: "auto" | "lf" | "crlf" | "cr";
99
+ trailingComma: "all" | "es5" | "none";
94
100
  /**
95
- * Change when properties in objects are quoted.
96
- * @default "as-needed"
101
+ * Indent lines with tabs instead of spaces
97
102
  */
98
- quoteProps: "as-needed" | "consistent" | "preserve";
103
+ useTabs?: boolean;
99
104
  /**
100
105
  * Whether or not to indent the code inside <script> and <style> tags in Vue files.
101
106
  * @default false
102
107
  */
103
108
  vueIndentScriptAndStyle: boolean;
104
- /**
105
- * Enforce single attribute per line in HTML, Vue and JSX.
106
- * @default false
107
- */
108
- singleAttributePerLine: boolean;
109
109
  }
110
110
 
111
111
  type WrapRuleConfig<T extends {
@@ -113,7 +113,7 @@ type WrapRuleConfig<T extends {
113
113
  }> = {
114
114
  [K in keyof T]: T[K] extends RuleConfig ? T[K] : RuleConfig<T[K]>;
115
115
  };
116
- type Awaitable<T> = T | Promise<T>;
116
+ type Awaitable<T> = Promise<T> | T;
117
117
  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, "curev/"> & ReactHooksRules & ReactRules & RuleOptions$1 & ImportRules & EslintRules & JsoncRules & VueRules & RuleOptions$2 & EslintCommentsRules & {
118
118
  "test/no-only-tests": RuleConfig<[]>;
119
119
  }>>;
@@ -143,7 +143,7 @@ interface OptionsVue extends OptionsOverrides {
143
143
  * @see https://github.com/antfu/eslint-processor-vue-blocks
144
144
  * @default true
145
145
  */
146
- sfcBlocks?: boolean | Options;
146
+ sfcBlocks?: Options | boolean;
147
147
  /**
148
148
  * Vue version. Apply different rules set from `eslint-plugin-vue`.
149
149
  *
@@ -151,7 +151,7 @@ interface OptionsVue extends OptionsOverrides {
151
151
  */
152
152
  vueVersion?: 2 | 3;
153
153
  }
154
- type OptionsTypescript = (OptionsTypeScriptWithTypes & OptionsOverrides) | (OptionsTypeScriptParserOptions & OptionsOverrides);
154
+ type OptionsTypescript = (OptionsTypeScriptParserOptions & OptionsOverrides) | (OptionsTypeScriptWithTypes & OptionsOverrides);
155
155
  interface OptionsFormatters {
156
156
  /**
157
157
  * Enable formatting support for CSS, Less, Sass, and SCSS.
@@ -159,6 +159,16 @@ interface OptionsFormatters {
159
159
  * Currently only support Prettier.
160
160
  */
161
161
  css?: "prettier" | boolean;
162
+ /**
163
+ * Custom options for dprint.
164
+ *
165
+ * By default it's controlled by our own config.
166
+ */
167
+ dprintOptions?: boolean;
168
+ /**
169
+ * Enable formatting support for GraphQL.
170
+ */
171
+ graphql?: "prettier" | boolean;
162
172
  /**
163
173
  * Enable formatting support for HTML.
164
174
  *
@@ -172,23 +182,13 @@ interface OptionsFormatters {
172
182
  *
173
183
  * When set to `true`, it will use Prettier.
174
184
  */
175
- markdown?: "prettier" | "dprint" | boolean;
176
- /**
177
- * Enable formatting support for GraphQL.
178
- */
179
- graphql?: "prettier" | boolean;
185
+ markdown?: "dprint" | "prettier" | boolean;
180
186
  /**
181
187
  * Custom options for Prettier.
182
188
  *
183
189
  * By default it's controlled by our own config.
184
190
  */
185
191
  prettierOptions?: VendoredPrettierOptions;
186
- /**
187
- * Custom options for dprint.
188
- *
189
- * By default it's controlled by our own config.
190
- */
191
- dprintOptions?: boolean;
192
192
  }
193
193
  interface OptionsComponentExts {
194
194
  /**
@@ -200,15 +200,15 @@ interface OptionsComponentExts {
200
200
  componentExts?: string[];
201
201
  }
202
202
  interface OptionsTypeScriptParserOptions {
203
- /**
204
- * Additional parser options for TypeScript.
205
- */
206
- parserOptions?: Partial<ParserOptions>;
207
203
  /**
208
204
  * Glob patterns for files that should be type aware.
209
205
  * @default ['**\/*.{ts,tsx}']
210
206
  */
211
207
  filesTypeAware?: string[];
208
+ /**
209
+ * Additional parser options for TypeScript.
210
+ */
211
+ parserOptions?: Partial<ParserOptions>;
212
212
  }
213
213
  interface OptionsTypeScriptWithTypes {
214
214
  /**
@@ -221,7 +221,7 @@ interface OptionsHasTypeScript {
221
221
  typescript?: boolean;
222
222
  }
223
223
  interface OptionsStylistic {
224
- stylistic?: boolean | StylisticConfig;
224
+ stylistic?: StylisticConfig | boolean;
225
225
  }
226
226
  interface StylisticConfig extends StylisticCustomizeOptions {
227
227
  }
@@ -245,64 +245,48 @@ interface OptionsUnoCSS extends OptionsOverrides {
245
245
  }
246
246
  interface OptionsConfig extends OptionsComponentExts {
247
247
  /**
248
- * Enable gitignore support.
249
- *
250
- * Passing an object to configure the options.
248
+ * Use external formatters to format files.
251
249
  *
252
- * @see https://github.com/antfu/eslint-config-flat-gitignore
253
- * @default true
254
- */
255
- gitignore?: boolean | FlatGitignoreOptions;
256
- /**
257
- * Core rules. Can't be disabled.
258
- */
259
- javascript?: OptionsOverrides;
260
- /**
261
- * Enable TypeScript support.
250
+ * Requires installing:
251
+ * - `eslint-plugin-format`
262
252
  *
263
- * Passing an object to enable TypeScript Language Server support.
253
+ * When set to `true`, it will enable all formatters.
264
254
  *
265
- * @default auto-detect based on the dependencies
255
+ * @default false
266
256
  */
267
- typescript?: boolean | OptionsTypescript;
257
+ formatters?: OptionsFormatters | boolean;
268
258
  /**
269
- * Enable JSX related rules.
259
+ * Enable gitignore support.
270
260
  *
271
- * Currently only stylistic rules are included.
261
+ * Passing an object to configure the options.
272
262
  *
263
+ * @see https://github.com/antfu/eslint-config-flat-gitignore
273
264
  * @default true
274
265
  */
275
- jsx?: boolean;
266
+ gitignore?: FlatGitignoreOptions | boolean;
276
267
  /**
277
- * Enable test support.
278
- *
279
- * @default true
268
+ * Control to disable some rules in editors.
269
+ * @default auto-detect based on the process.env
280
270
  */
281
- test?: boolean | OptionsOverrides;
271
+ isInEditor?: boolean;
282
272
  /**
283
- * Enable Vue support.
284
- *
285
- * @default auto-detect based on the dependencies
273
+ * Core rules. Can't be disabled.
286
274
  */
287
- vue?: boolean | OptionsVue;
275
+ javascript?: OptionsOverrides;
288
276
  /**
289
277
  * Enable JSONC support.
290
278
  *
291
279
  * @default true
292
280
  */
293
- jsonc?: boolean | OptionsOverrides;
281
+ jsonc?: OptionsOverrides | boolean;
294
282
  /**
295
- * Enable YAML support.
283
+ * Enable JSX related rules.
296
284
  *
297
- * @default true
298
- */
299
- yaml?: boolean | OptionsOverrides;
300
- /**
301
- * Enable TOML support.
285
+ * Currently only stylistic rules are included.
302
286
  *
303
287
  * @default true
304
288
  */
305
- toml?: boolean | OptionsOverrides;
289
+ jsx?: boolean;
306
290
  /**
307
291
  * Enable linting for **code snippets** in Markdown.
308
292
  *
@@ -310,13 +294,25 @@ interface OptionsConfig extends OptionsComponentExts {
310
294
  *
311
295
  * @default true
312
296
  */
313
- markdown?: boolean | OptionsOverrides;
297
+ markdown?: OptionsOverrides | boolean;
314
298
  /**
315
- * Enable stylistic rules.
299
+ * Provide overrides for rules for each integration.
316
300
  *
317
- * @default true
301
+ * @deprecated use `overrides` option in each integration key instead
318
302
  */
319
- stylistic?: boolean | (StylisticConfig & OptionsOverrides);
303
+ overrides?: {
304
+ javascript?: FlatConfigItem["rules"];
305
+ jsonc?: FlatConfigItem["rules"];
306
+ markdown?: FlatConfigItem["rules"];
307
+ react?: FlatConfigItem["rules"];
308
+ stylistic?: FlatConfigItem["rules"];
309
+ svelte?: FlatConfigItem["rules"];
310
+ test?: FlatConfigItem["rules"];
311
+ toml?: FlatConfigItem["rules"];
312
+ typescript?: FlatConfigItem["rules"];
313
+ vue?: FlatConfigItem["rules"];
314
+ yaml?: FlatConfigItem["rules"];
315
+ };
320
316
  /**
321
317
  * Enable react rules.
322
318
  *
@@ -327,7 +323,13 @@ interface OptionsConfig extends OptionsComponentExts {
327
323
  *
328
324
  * @default false
329
325
  */
330
- react?: boolean | OptionsOverrides;
326
+ react?: OptionsOverrides | boolean;
327
+ /**
328
+ * Enable stylistic rules.
329
+ *
330
+ * @default true
331
+ */
332
+ stylistic?: (StylisticConfig & OptionsOverrides) | boolean;
331
333
  /**
332
334
  * Enable svelte rules.
333
335
  *
@@ -338,48 +340,46 @@ interface OptionsConfig extends OptionsComponentExts {
338
340
  */
339
341
  svelte?: boolean;
340
342
  /**
341
- * Enable unocss rules.
343
+ * Enable test support.
342
344
  *
343
- * Requires installing:
344
- * - `@unocss/eslint-plugin`
345
+ * @default true
346
+ */
347
+ test?: OptionsOverrides | boolean;
348
+ /**
349
+ * Enable TOML support.
345
350
  *
346
- * @default false
351
+ * @default true
347
352
  */
348
- unocss?: boolean | OptionsUnoCSS;
353
+ toml?: OptionsOverrides | boolean;
349
354
  /**
350
- * Use external formatters to format files.
355
+ * Enable TypeScript support.
351
356
  *
352
- * Requires installing:
353
- * - `eslint-plugin-format`
357
+ * Passing an object to enable TypeScript Language Server support.
354
358
  *
355
- * When set to `true`, it will enable all formatters.
359
+ * @default auto-detect based on the dependencies
360
+ */
361
+ typescript?: OptionsTypescript | boolean;
362
+ /**
363
+ * Enable unocss rules.
364
+ *
365
+ * Requires installing:
366
+ * - `@unocss/eslint-plugin`
356
367
  *
357
368
  * @default false
358
369
  */
359
- formatters?: boolean | OptionsFormatters;
370
+ unocss?: OptionsUnoCSS | boolean;
360
371
  /**
361
- * Control to disable some rules in editors.
362
- * @default auto-detect based on the process.env
372
+ * Enable Vue support.
373
+ *
374
+ * @default auto-detect based on the dependencies
363
375
  */
364
- isInEditor?: boolean;
376
+ vue?: OptionsVue | boolean;
365
377
  /**
366
- * Provide overrides for rules for each integration.
378
+ * Enable YAML support.
367
379
  *
368
- * @deprecated use `overrides` option in each integration key instead
380
+ * @default true
369
381
  */
370
- overrides?: {
371
- stylistic?: FlatConfigItem["rules"];
372
- javascript?: FlatConfigItem["rules"];
373
- typescript?: FlatConfigItem["rules"];
374
- test?: FlatConfigItem["rules"];
375
- vue?: FlatConfigItem["rules"];
376
- jsonc?: FlatConfigItem["rules"];
377
- markdown?: FlatConfigItem["rules"];
378
- yaml?: FlatConfigItem["rules"];
379
- toml?: FlatConfigItem["rules"];
380
- react?: FlatConfigItem["rules"];
381
- svelte?: FlatConfigItem["rules"];
382
- };
382
+ yaml?: OptionsOverrides | boolean;
383
383
  }
384
384
 
385
385
  /**
@@ -406,13 +406,6 @@ declare function markdown(options?: OptionsFiles & OptionsComponentExts & Option
406
406
 
407
407
  declare function node(): Promise<FlatConfigItem[]>;
408
408
 
409
- /**
410
- * Optional perfectionist plugin for props and items sorting.
411
- *
412
- * @see https://github.com/azat-io/eslint-plugin-perfectionist
413
- */
414
- declare function perfectionist(): Promise<FlatConfigItem[]>;
415
-
416
409
  declare function formatters(options?: OptionsFormatters | true, stylistic?: StylisticConfig): Promise<FlatConfigItem[]>;
417
410
 
418
411
  declare function react(options?: OptionsHasTypeScript & OptionsOverrides & OptionsFiles): Promise<FlatConfigItem[]>;
@@ -513,4 +506,4 @@ declare function interopDefault<T>(m: Awaitable<T>): Promise<T extends {
513
506
  } ? U : T>;
514
507
  declare function ensurePackages(packages: string[]): Promise<void>;
515
508
 
516
- 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_SVELTE, GLOB_TESTS, GLOB_TOML, GLOB_TS, GLOB_TSX, GLOB_VUE, GLOB_YAML, type OptionsComponentExts, type OptionsConfig, type OptionsFiles, type OptionsFormatters, type OptionsHasTypeScript, type OptionsIsInEditor, type OptionsOverrides, type OptionsStylistic, type OptionsTypeScriptParserOptions, type OptionsTypeScriptWithTypes, type OptionsTypescript, type OptionsUnoCSS, type OptionsVue, type ResolvedOptions, type Rules, type StylisticConfig, StylisticConfigDefaults, type UserConfigItem, type WrapRuleConfig, combine, comments, curev, curev as default, ensurePackages, formatters, getOverrides, ignores, imports, interopDefault, javascript, jsdoc, jsonc, markdown, node, parserPlain, perfectionist, react, renameRules, resolveSubOptions, sortPackageJson, sortTsconfig, stylistic, svelte, test, toArray, toml, typescript, unicorn, unocss, vue, yaml };
509
+ 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_SVELTE, GLOB_TESTS, GLOB_TOML, GLOB_TS, GLOB_TSX, GLOB_VUE, GLOB_YAML, type OptionsComponentExts, type OptionsConfig, type OptionsFiles, type OptionsFormatters, type OptionsHasTypeScript, type OptionsIsInEditor, type OptionsOverrides, type OptionsStylistic, type OptionsTypeScriptParserOptions, type OptionsTypeScriptWithTypes, type OptionsTypescript, type OptionsUnoCSS, type OptionsVue, type ResolvedOptions, type Rules, type StylisticConfig, StylisticConfigDefaults, type UserConfigItem, type WrapRuleConfig, combine, comments, curev, curev as default, ensurePackages, formatters, getOverrides, ignores, imports, interopDefault, javascript, jsdoc, jsonc, markdown, node, parserPlain, react, renameRules, resolveSubOptions, sortPackageJson, sortTsconfig, stylistic, svelte, test, toArray, toml, typescript, unicorn, unocss, vue, yaml };