Skip to content

Commit

Permalink
feat: compactible with non-hoist env
Browse files Browse the repository at this point in the history
  • Loading branch information
antfu committed Mar 27, 2024
1 parent d2b1c2d commit 1b9df6f
Showing 1 changed file with 11 additions and 9 deletions.
20 changes: 11 additions & 9 deletions packages/module/src/modules/config.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { addTemplate } from '@nuxt/kit'
import { addTemplate, resolvePath } from '@nuxt/kit'
import { stringifyImports } from 'unimport'
import type { Import } from 'unimport'
import type { Nuxt } from '@nuxt/schema'
Expand Down Expand Up @@ -57,24 +57,26 @@ async function generateESLintConfig(options: ModuleOptions, nuxt: Nuxt, addons:
...typeof options.config !== 'boolean' ? options.config || {} : {},
}

const flatConfigEntry = await resolvePath('@nuxt/eslint-config/flat', { cwd: import.meta.url })

importLines.push(
{
from: 'eslint-flat-config-utils',
from: await resolvePath('eslint-flat-config-utils', { cwd: import.meta.url }),
name: 'pipe',
},
{
from: '@nuxt/eslint-config/flat',
from: await resolvePath('eslint-typegen', { cwd: import.meta.url }),
name: 'default',
as: 'typegen'
},
{
from: flatConfigEntry,
name: 'createConfigForNuxt',
},
{
from: '@nuxt/eslint-config/flat',
from: flatConfigEntry,
name: 'defineFlatConfigs',
},
{
from: 'eslint-typegen',
name: 'default',
as: 'typegen'
}
)

const basicOptions: NuxtESLintConfigOptions = {
Expand Down

0 comments on commit 1b9df6f

Please sign in to comment.