Skip to content

Commit

Permalink
feat: ship types, and a combine util
Browse files Browse the repository at this point in the history
  • Loading branch information
antfu committed Sep 21, 2023
1 parent 8d45126 commit 000a236
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 3 deletions.
5 changes: 3 additions & 2 deletions packages/eslint-config/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@
"dist"
],
"scripts": {
"build": "tsup src/index.ts --format esm --clean",
"stub": "pnpm run build"
"build": "tsup src/index.ts --format esm --clean --dts",
"stub": "tsup src/index.ts --format esm --clean"
},
"peerDependencies": {
"eslint": ">=8.0.0"
Expand All @@ -28,6 +28,7 @@
"@stylistic/eslint-plugin-ts": "0.0.4",
"@typescript-eslint/eslint-plugin": "^6.7.2",
"@typescript-eslint/parser": "^6.7.2",
"eslint-define-config": "^1.23.0",
"eslint-plugin-antfu": "workspace:*",
"eslint-plugin-eslint-comments": "^3.2.0",
"eslint-plugin-i": "^2.28.1",
Expand Down
2 changes: 1 addition & 1 deletion packages/eslint-config/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@ export * from './configs'
export * from './presets'
export * from './plugins'
export * from './env'
export * from './globs'
export * from './utils'
8 changes: 8 additions & 0 deletions packages/eslint-config/src/utils.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import type { FlatESLintConfigItem } from 'eslint-define-config'

/**
* Combine array and non-array configs into a single array.
*/
export function combine(...configs: (FlatESLintConfigItem | FlatESLintConfigItem[])[]): FlatESLintConfigItem[] {
return configs.flatMap(config => Array.isArray(config) ? config : [config])
}

0 comments on commit 000a236

Please sign in to comment.