Skip to content

Commit

Permalink
fix: support single object config export, fix #38
Browse files Browse the repository at this point in the history
Release-As: 0.4.5
  • Loading branch information
antfu committed Apr 9, 2024
1 parent dcd0071 commit feffffe
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/configs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,11 @@ export async function readConfig(
cwd: basePath,
})

const rawConfigs = await (mod.default ?? mod) as FlatConfigItem[]
let rawConfigs = await (mod.default ?? mod) as FlatConfigItem[]

// A single flat config object is also valid
if (!Array.isArray(rawConfigs))
rawConfigs = [rawConfigs]

const rulesMap = new Map<string, RuleInfo>()
const eslintRules = await import(['eslint', 'use-at-your-own-risk'].join('/')).then(r => r.default.builtinRules)
Expand Down

0 comments on commit feffffe

Please sign in to comment.