@vinicunca/eslint-config 2.1.7 → 2.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/dist/index.d.cts CHANGED
@@ -9,9 +9,10 @@ export { default as pluginVinicunca } from '@vinicunca/eslint-plugin-vinicunca';
9
9
  import { Linter } from 'eslint';
10
10
  import { FlatGitignoreOptions } from 'eslint-config-flat-gitignore';
11
11
  import { Options } from 'eslint-processor-vue-blocks';
12
+ import { FlatConfigPipeline } from 'eslint-flat-config-utils';
12
13
  export { default as pluginComments } from 'eslint-plugin-eslint-comments';
13
- import * as eslintPluginI from 'eslint-plugin-i';
14
- export { eslintPluginI as pluginImport };
14
+ import * as eslintPluginImportX from 'eslint-plugin-import-x';
15
+ export { eslintPluginImportX as pluginImport };
15
16
  export { default as pluginNode } from 'eslint-plugin-n';
16
17
  export { default as pluginPerfectionist } from 'eslint-plugin-perfectionist';
17
18
  export { default as pluginUnicorn } from 'eslint-plugin-unicorn';
@@ -252,6 +253,12 @@ interface OptionsUnoCSS extends OptionsOverrides {
252
253
  strict?: boolean;
253
254
  }
254
255
  interface OptionsConfig extends OptionsComponentExts {
256
+ /**
257
+ * Automatically rename plugins in the config.
258
+ *
259
+ * @default true
260
+ */
261
+ autoRenamePlugins?: boolean;
255
262
  /**
256
263
  * Use external formatters to format files.
257
264
  *
@@ -353,7 +360,15 @@ interface OptionsConfig extends OptionsComponentExts {
353
360
  yaml?: OptionsOverrides | boolean;
354
361
  }
355
362
 
356
- declare function vinicuncaESLint(options?: OptionsConfig & FlatConfigItem, ...userConfigs: Array<Awaitable<Array<UserConfigItem> | UserConfigItem>>): Promise<Array<UserConfigItem>>;
363
+ declare const defaultPluginRenaming: {
364
+ '@stylistic': string;
365
+ '@typescript-eslint': string;
366
+ 'import-x': string;
367
+ n: string;
368
+ vitest: string;
369
+ yml: string;
370
+ };
371
+ declare function vinicuncaESLint(options?: OptionsConfig & FlatConfigItem, ...userConfigs: Array<Awaitable<Array<UserConfigItem> | UserConfigItem>>): FlatConfigPipeline<UserConfigItem>;
357
372
 
358
373
  declare function comments(): Promise<FlatConfigItem[]>;
359
374
 
@@ -378,20 +393,20 @@ declare function react(options?: OptionsHasTypeScript & OptionsOverrides & Optio
378
393
  *
379
394
  * Requires `jsonc` config
380
395
  */
381
- declare function sortPackageJson(): Promise<FlatConfigItem[]>;
396
+ declare function sortPackageJson(): Promise<Array<FlatConfigItem>>;
382
397
  /**
383
398
  * Sort tsconfig.json
384
399
  *
385
400
  * Requires `jsonc` config
386
401
  */
387
- declare function sortTsconfig(): FlatConfigItem[];
402
+ declare function sortTsconfig(): Array<FlatConfigItem>;
388
403
 
389
404
  declare const STYLISTIC_CONFIG_DEFAULTS: StylisticConfig;
390
405
  declare function stylistic(options?: StylisticConfig & OptionsOverrides): Promise<FlatConfigItem[]>;
391
406
 
392
407
  declare function test(options?: OptionsFiles & OptionsIsInEditor & OptionsOverrides): Promise<FlatConfigItem[]>;
393
408
 
394
- declare function typescript(options?: OptionsFiles & OptionsComponentExts & OptionsOverrides & OptionsTypeScriptWithTypes & OptionsTypeScriptParserOptions): Promise<FlatConfigItem[]>;
409
+ declare function typescript(options?: OptionsFiles & OptionsComponentExts & OptionsOverrides & OptionsTypeScriptWithTypes & OptionsTypeScriptParserOptions): Promise<Array<FlatConfigItem>>;
395
410
 
396
411
  declare function unicorn(): Promise<FlatConfigItem[]>;
397
412
 
@@ -405,9 +420,42 @@ declare function yaml(options?: OptionsOverrides & OptionsStylistic & OptionsFil
405
420
  * Combine array and non-array configs into a single array.
406
421
  */
407
422
  declare function combineConfigs(...configs: Array<Awaitable<Array<UserConfigItem> | UserConfigItem>>): Promise<Array<UserConfigItem>>;
408
- declare function renameRules(rules: Record<string, any>, from: string, to: string): {
423
+ /**
424
+ * Rename plugin prefixes in a rule object.
425
+ * Accepts a map of prefixes to rename.
426
+ *
427
+ * @example
428
+ * ```ts
429
+ * import { renameRules } from '@vinicunca/eslint-config'
430
+ *
431
+ * export default [{
432
+ * rules: renameRules(
433
+ * {
434
+ * '@typescript-eslint/indent': 'error'
435
+ * },
436
+ * { '@typescript-eslint': 'ts' }
437
+ * )
438
+ * }]
439
+ * ```
440
+ */
441
+ declare function renameRules(rules: Record<string, any>, map: Record<string, string>): {
409
442
  [k: string]: any;
410
443
  };
444
+ /**
445
+ * Rename plugin names a flat configs array
446
+ *
447
+ * @example
448
+ * ```ts
449
+ * import { renamePluginInConfigs } from '@vinicunca/eslint-config'
450
+ * import someConfigs from './some-configs'
451
+ *
452
+ * export default renamePluginInConfigs(someConfigs, {
453
+ * '@typescript-eslint': 'ts',
454
+ * 'import-x': 'import',
455
+ * })
456
+ * ```
457
+ */
458
+ declare function renamePluginInConfigs(configs: Array<UserConfigItem>, map: Record<string, string>): Array<UserConfigItem>;
411
459
  declare function interopDefault<T>(m: Awaitable<T>): Promise<T extends {
412
460
  default: infer U;
413
461
  } ? U : T>;
@@ -462,4 +510,4 @@ declare const GLOB_TESTS: string[];
462
510
  declare const GLOB_ALL_SRC: string[];
463
511
  declare const GLOB_EXCLUDE: string[];
464
512
 
465
- 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_TESTS, 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 Rules, STYLISTIC_CONFIG_DEFAULTS, type StylisticConfig, type UserConfigItem, type WrapRuleConfig, combineConfigs, comments, ignores, imports, interopDefault, javascript, jsdoc, jsonc, markdown, node, parserPlain, react, renameRules, sortPackageJson, sortTsconfig, stylistic, test, toArray, typescript, unicorn, unocss, vinicuncaESLint, vue, yaml };
513
+ 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_TESTS, 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 Rules, STYLISTIC_CONFIG_DEFAULTS, type StylisticConfig, type UserConfigItem, type WrapRuleConfig, combineConfigs, comments, defaultPluginRenaming, ignores, imports, interopDefault, javascript, jsdoc, jsonc, markdown, node, parserPlain, react, renamePluginInConfigs, renameRules, sortPackageJson, sortTsconfig, stylistic, test, toArray, typescript, unicorn, unocss, vinicuncaESLint, vue, yaml };
package/dist/index.d.ts CHANGED
@@ -9,9 +9,10 @@ export { default as pluginVinicunca } from '@vinicunca/eslint-plugin-vinicunca';
9
9
  import { Linter } from 'eslint';
10
10
  import { FlatGitignoreOptions } from 'eslint-config-flat-gitignore';
11
11
  import { Options } from 'eslint-processor-vue-blocks';
12
+ import { FlatConfigPipeline } from 'eslint-flat-config-utils';
12
13
  export { default as pluginComments } from 'eslint-plugin-eslint-comments';
13
- import * as eslintPluginI from 'eslint-plugin-i';
14
- export { eslintPluginI as pluginImport };
14
+ import * as eslintPluginImportX from 'eslint-plugin-import-x';
15
+ export { eslintPluginImportX as pluginImport };
15
16
  export { default as pluginNode } from 'eslint-plugin-n';
16
17
  export { default as pluginPerfectionist } from 'eslint-plugin-perfectionist';
17
18
  export { default as pluginUnicorn } from 'eslint-plugin-unicorn';
@@ -252,6 +253,12 @@ interface OptionsUnoCSS extends OptionsOverrides {
252
253
  strict?: boolean;
253
254
  }
254
255
  interface OptionsConfig extends OptionsComponentExts {
256
+ /**
257
+ * Automatically rename plugins in the config.
258
+ *
259
+ * @default true
260
+ */
261
+ autoRenamePlugins?: boolean;
255
262
  /**
256
263
  * Use external formatters to format files.
257
264
  *
@@ -353,7 +360,15 @@ interface OptionsConfig extends OptionsComponentExts {
353
360
  yaml?: OptionsOverrides | boolean;
354
361
  }
355
362
 
356
- declare function vinicuncaESLint(options?: OptionsConfig & FlatConfigItem, ...userConfigs: Array<Awaitable<Array<UserConfigItem> | UserConfigItem>>): Promise<Array<UserConfigItem>>;
363
+ declare const defaultPluginRenaming: {
364
+ '@stylistic': string;
365
+ '@typescript-eslint': string;
366
+ 'import-x': string;
367
+ n: string;
368
+ vitest: string;
369
+ yml: string;
370
+ };
371
+ declare function vinicuncaESLint(options?: OptionsConfig & FlatConfigItem, ...userConfigs: Array<Awaitable<Array<UserConfigItem> | UserConfigItem>>): FlatConfigPipeline<UserConfigItem>;
357
372
 
358
373
  declare function comments(): Promise<FlatConfigItem[]>;
359
374
 
@@ -378,20 +393,20 @@ declare function react(options?: OptionsHasTypeScript & OptionsOverrides & Optio
378
393
  *
379
394
  * Requires `jsonc` config
380
395
  */
381
- declare function sortPackageJson(): Promise<FlatConfigItem[]>;
396
+ declare function sortPackageJson(): Promise<Array<FlatConfigItem>>;
382
397
  /**
383
398
  * Sort tsconfig.json
384
399
  *
385
400
  * Requires `jsonc` config
386
401
  */
387
- declare function sortTsconfig(): FlatConfigItem[];
402
+ declare function sortTsconfig(): Array<FlatConfigItem>;
388
403
 
389
404
  declare const STYLISTIC_CONFIG_DEFAULTS: StylisticConfig;
390
405
  declare function stylistic(options?: StylisticConfig & OptionsOverrides): Promise<FlatConfigItem[]>;
391
406
 
392
407
  declare function test(options?: OptionsFiles & OptionsIsInEditor & OptionsOverrides): Promise<FlatConfigItem[]>;
393
408
 
394
- declare function typescript(options?: OptionsFiles & OptionsComponentExts & OptionsOverrides & OptionsTypeScriptWithTypes & OptionsTypeScriptParserOptions): Promise<FlatConfigItem[]>;
409
+ declare function typescript(options?: OptionsFiles & OptionsComponentExts & OptionsOverrides & OptionsTypeScriptWithTypes & OptionsTypeScriptParserOptions): Promise<Array<FlatConfigItem>>;
395
410
 
396
411
  declare function unicorn(): Promise<FlatConfigItem[]>;
397
412
 
@@ -405,9 +420,42 @@ declare function yaml(options?: OptionsOverrides & OptionsStylistic & OptionsFil
405
420
  * Combine array and non-array configs into a single array.
406
421
  */
407
422
  declare function combineConfigs(...configs: Array<Awaitable<Array<UserConfigItem> | UserConfigItem>>): Promise<Array<UserConfigItem>>;
408
- declare function renameRules(rules: Record<string, any>, from: string, to: string): {
423
+ /**
424
+ * Rename plugin prefixes in a rule object.
425
+ * Accepts a map of prefixes to rename.
426
+ *
427
+ * @example
428
+ * ```ts
429
+ * import { renameRules } from '@vinicunca/eslint-config'
430
+ *
431
+ * export default [{
432
+ * rules: renameRules(
433
+ * {
434
+ * '@typescript-eslint/indent': 'error'
435
+ * },
436
+ * { '@typescript-eslint': 'ts' }
437
+ * )
438
+ * }]
439
+ * ```
440
+ */
441
+ declare function renameRules(rules: Record<string, any>, map: Record<string, string>): {
409
442
  [k: string]: any;
410
443
  };
444
+ /**
445
+ * Rename plugin names a flat configs array
446
+ *
447
+ * @example
448
+ * ```ts
449
+ * import { renamePluginInConfigs } from '@vinicunca/eslint-config'
450
+ * import someConfigs from './some-configs'
451
+ *
452
+ * export default renamePluginInConfigs(someConfigs, {
453
+ * '@typescript-eslint': 'ts',
454
+ * 'import-x': 'import',
455
+ * })
456
+ * ```
457
+ */
458
+ declare function renamePluginInConfigs(configs: Array<UserConfigItem>, map: Record<string, string>): Array<UserConfigItem>;
411
459
  declare function interopDefault<T>(m: Awaitable<T>): Promise<T extends {
412
460
  default: infer U;
413
461
  } ? U : T>;
@@ -462,4 +510,4 @@ declare const GLOB_TESTS: string[];
462
510
  declare const GLOB_ALL_SRC: string[];
463
511
  declare const GLOB_EXCLUDE: string[];
464
512
 
465
- 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_TESTS, 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 Rules, STYLISTIC_CONFIG_DEFAULTS, type StylisticConfig, type UserConfigItem, type WrapRuleConfig, combineConfigs, comments, ignores, imports, interopDefault, javascript, jsdoc, jsonc, markdown, node, parserPlain, react, renameRules, sortPackageJson, sortTsconfig, stylistic, test, toArray, typescript, unicorn, unocss, vinicuncaESLint, vue, yaml };
513
+ 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_TESTS, 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 Rules, STYLISTIC_CONFIG_DEFAULTS, type StylisticConfig, type UserConfigItem, type WrapRuleConfig, combineConfigs, comments, defaultPluginRenaming, ignores, imports, interopDefault, javascript, jsdoc, jsonc, markdown, node, parserPlain, react, renamePluginInConfigs, renameRules, sortPackageJson, sortTsconfig, stylistic, test, toArray, typescript, unicorn, unocss, vinicuncaESLint, vue, yaml };