Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

eslint-flat-config-utils

Package Overview
Dependencies
Maintainers
0
Versions
17
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

eslint-flat-config-utils - npm Package Compare versions

Comparing version 0.3.1 to 0.4.0

141

dist/index.d.ts
import { Linter } from 'eslint';
/**
* A function that returns the config as-is, useful for providing type hints.
*/
declare function defineFlatConfig<T extends Linter.Config = Linter.Config>(config: T): T;
/**
* Merge multiple flat configs into a single flat config.
*
* Note there is no guarantee that the result works the same as the original configs.
*/
declare function mergeConfigs<T extends Linter.Config = Linter.Config>(...configs: T[]): T;
/**
* Alias to `Linter.Config`

@@ -60,59 +48,3 @@ *

/**
* Concat multiple flat configs into a single flat config array.
*
* It also resolves promises and flattens the result.
*
* @example
*
* ```ts
* import { concat } from 'eslint-flat-config-utils'
* import eslint from '@eslint/js'
* import stylistic from '@stylistic/eslint-plugin'
*
* export default concat(
* eslint,
* stylistic.configs.customize(),
* { rules: { 'no-console': 'off' } },
* // ...
* )
* ```
*/
declare function concat<T extends Linter.Config = Linter.Config>(...configs: Awaitable<T | T[]>[]): Promise<T[]>;
/**
* Rename plugin prefixes in a rule object.
* Accepts a map of prefixes to rename.
*
* @example
* ```ts
* import { renamePluginsInRules } from 'eslint-flat-config-utils'
*
* export default [{
* rules: renamePluginsInRules(
* {
* '@typescript-eslint/indent': 'error'
* },
* { '@typescript-eslint': 'ts' }
* )
* }]
* ```
*/
declare function renamePluginsInRules(rules: Record<string, any>, map: Record<string, string>): Record<string, any>;
/**
* Rename plugin names a flat configs array
*
* @example
* ```ts
* import { renamePluginsInConfigs } from 'eslint-flat-config-utils'
* import someConfigs from './some-configs'
*
* export default renamePluginsInConfigs(someConfigs, {
* '@typescript-eslint': 'ts',
* 'import-x': 'import',
* })
* ```
*/
declare function renamePluginsInConfigs<T extends Linter.Config = Linter.Config>(configs: T[], map: Record<string, string>): T[];
declare const DEFAULT_PLUGIN_CONFLICTS_ERROR = "Different instances of plugin \"{{pluginName}}\" found in multiple configs: {{configNames}}. It's likely you misconfigured the merge of these configs.";
type PluginConflictsError<T extends Linter.Config = Linter.Config> = (pluginName: string, configs: T[]) => string;

@@ -301,2 +233,29 @@ /**

/**
* Concat multiple flat configs into a single flat config array.
*
* It also resolves promises and flattens the result.
*
* @example
*
* ```ts
* import { concat } from 'eslint-flat-config-utils'
* import eslint from '@eslint/js'
* import stylistic from '@stylistic/eslint-plugin'
*
* export default concat(
* eslint,
* stylistic.configs.customize(),
* { rules: { 'no-console': 'off' } },
* // ...
* )
* ```
*/
declare function concat<T extends Linter.Config = Linter.Config>(...configs: Awaitable<T | T[]>[]): Promise<T[]>;
/**
* A function that returns the config as-is, useful for providing type hints.
*/
declare function defineFlatConfig<T extends Linter.Config = Linter.Config>(config: T): T;
/**
* Extend another flat configs and rename globs paths.

@@ -320,2 +279,44 @@ *

export { type Arrayable, type Awaitable, type DefaultConfigNamesMap, type FilterType, FlatConfigComposer, type FlatConfigItem, FlatConfigPipeline, type GetRuleRecordFromConfig, type NullableObject, type PluginConflictsError, type ResolvableFlatConfig, type StringLiteralUnion, composer, concat, defineFlatConfig, extend, mergeConfigs, pipe, renamePluginsInConfigs, renamePluginsInRules };
/**
* Merge multiple flat configs into a single flat config.
*
* Note there is no guarantee that the result works the same as the original configs.
*/
declare function mergeConfigs<T extends Linter.Config = Linter.Config>(...configs: T[]): T;
/**
* Rename plugin prefixes in a rule object.
* Accepts a map of prefixes to rename.
*
* @example
* ```ts
* import { renamePluginsInRules } from 'eslint-flat-config-utils'
*
* export default [{
* rules: renamePluginsInRules(
* {
* '@typescript-eslint/indent': 'error'
* },
* { '@typescript-eslint': 'ts' }
* )
* }]
* ```
*/
declare function renamePluginsInRules(rules: Record<string, any>, map: Record<string, string>): Record<string, any>;
/**
* Rename plugin names a flat configs array
*
* @example
* ```ts
* import { renamePluginsInConfigs } from 'eslint-flat-config-utils'
* import someConfigs from './some-configs'
*
* export default renamePluginsInConfigs(someConfigs, {
* '@typescript-eslint': 'ts',
* 'import-x': 'import',
* })
* ```
*/
declare function renamePluginsInConfigs<T extends Linter.Config = Linter.Config>(configs: T[], map: Record<string, string>): T[];
export { type Arrayable, type Awaitable, DEFAULT_PLUGIN_CONFLICTS_ERROR, type DefaultConfigNamesMap, type FilterType, FlatConfigComposer, type FlatConfigItem, FlatConfigPipeline, type GetRuleRecordFromConfig, type NullableObject, type PluginConflictsError, type ResolvableFlatConfig, type StringLiteralUnion, composer, concat, defineFlatConfig, extend, mergeConfigs, pipe, renamePluginsInConfigs, renamePluginsInRules };
{
"name": "eslint-flat-config-utils",
"type": "module",
"version": "0.3.1",
"packageManager": "pnpm@9.7.1",
"version": "0.4.0",
"packageManager": "pnpm@9.9.0",
"description": "Utils for managing and manipulating ESLint flat config arrays",

@@ -54,16 +54,15 @@ "author": "Anthony Fu <anthonyfu117@hotmail.com>",

"dependencies": {
"@types/eslint": "^9.6.0",
"pathe": "^1.1.2"
},
"devDependencies": {
"@antfu/eslint-config": "^2.26.0",
"@antfu/ni": "^0.22.4",
"@antfu/eslint-config": "^3.4.0",
"@antfu/ni": "^0.23.0",
"@antfu/utils": "^0.7.10",
"@types/node": "^22.4.1",
"bumpp": "^9.5.1",
"eslint": "^9.9.0",
"@types/node": "^22.5.4",
"bumpp": "^9.5.2",
"eslint": "^9.10.0",
"esno": "^4.7.0",
"jsr": "^0.13.1",
"lint-staged": "^15.2.9",
"pnpm": "^9.7.1",
"lint-staged": "^15.2.10",
"pnpm": "^9.9.0",
"rimraf": "^6.0.1",

@@ -73,3 +72,3 @@ "simple-git-hooks": "^2.11.1",

"unbuild": "^2.0.0",
"vite": "^5.4.1",
"vite": "^5.4.3",
"vitest": "^2.0.5"

@@ -76,0 +75,0 @@ },

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc