@@ -2,7 +2,8 @@ import process from 'node:process'
2
2
import fs from 'node:fs'
3
3
import { isPackageExists } from 'local-pkg'
4
4
import { FlatConfigPipeline } from 'eslint-flat-config-utils'
5
- import type { Awaitable , FlatConfigItem , OptionsConfig } from './types'
5
+ import type { Linter } from 'eslint'
6
+ import type { Awaitable , OptionsConfig , TypedFlatConfigItem } from './types'
6
7
import {
7
8
astro ,
8
9
comments ,
@@ -30,7 +31,7 @@ import {
30
31
import { interopDefault } from './utils'
31
32
import { formatters } from './configs/formatters'
32
33
33
- const flatConfigProps : ( keyof FlatConfigItem ) [ ] = [
34
+ const flatConfigProps : ( keyof TypedFlatConfigItem ) [ ] = [
34
35
'name' ,
35
36
'files' ,
36
37
'ignores' ,
@@ -61,17 +62,17 @@ export const defaultPluginRenaming = {
61
62
/**
62
63
* Construct an array of ESLint flat config items.
63
64
*
64
- * @param {OptionsConfig & FlatConfigItem } options
65
+ * @param {OptionsConfig & TypedFlatConfigItem } options
65
66
* The options for generating the ESLint configurations.
66
- * @param {Awaitable<FlatConfigItem | FlatConfigItem []>[] } userConfigs
67
+ * @param {Awaitable<TypedFlatConfigItem | TypedFlatConfigItem []>[] } userConfigs
67
68
* The user configurations to be merged with the generated configurations.
68
- * @returns {Promise<FlatConfigItem []> }
69
+ * @returns {Promise<TypedFlatConfigItem []> }
69
70
* The merged ESLint configurations.
70
71
*/
71
72
export function antfu (
72
- options : OptionsConfig & FlatConfigItem = { } ,
73
- ...userConfigs : Awaitable < FlatConfigItem | FlatConfigItem [ ] > [ ]
74
- ) : FlatConfigPipeline < FlatConfigItem > {
73
+ options : OptionsConfig & TypedFlatConfigItem = { } ,
74
+ ...userConfigs : Awaitable < TypedFlatConfigItem | TypedFlatConfigItem [ ] | FlatConfigPipeline < any > | Linter . FlatConfig [ ] > [ ]
75
+ ) : FlatConfigPipeline < TypedFlatConfigItem > {
75
76
const {
76
77
astro : enableAstro = false ,
77
78
autoRenamePlugins = true ,
@@ -94,7 +95,7 @@ export function antfu(
94
95
if ( stylisticOptions && ! ( 'jsx' in stylisticOptions ) )
95
96
stylisticOptions . jsx = options . jsx ?? true
96
97
97
- const configs : Awaitable < FlatConfigItem [ ] > [ ] = [ ]
98
+ const configs : Awaitable < TypedFlatConfigItem [ ] > [ ] = [ ]
98
99
99
100
if ( enableGitignore ) {
100
101
if ( typeof enableGitignore !== 'boolean' ) {
@@ -239,16 +240,16 @@ export function antfu(
239
240
if ( key in options )
240
241
acc [ key ] = options [ key ] as any
241
242
return acc
242
- } , { } as FlatConfigItem )
243
+ } , { } as TypedFlatConfigItem )
243
244
if ( Object . keys ( fusedConfig ) . length )
244
245
configs . push ( [ fusedConfig ] )
245
246
246
- let pipeline = new FlatConfigPipeline < FlatConfigItem > ( )
247
+ let pipeline = new FlatConfigPipeline < TypedFlatConfigItem > ( )
247
248
248
249
pipeline = pipeline
249
250
. append (
250
251
...configs ,
251
- ...userConfigs ,
252
+ ...userConfigs as any ,
252
253
)
253
254
254
255
if ( autoRenamePlugins ) {
0 commit comments