Skip to content

Commit

Permalink
fix(next): eslint v9 not picking up config
Browse files Browse the repository at this point in the history
  • Loading branch information
devjiwonchoi committed Oct 15, 2024
1 parent bff036b commit ee03263
Showing 1 changed file with 14 additions and 3 deletions.
17 changes: 14 additions & 3 deletions packages/next/src/lib/eslint/runLintCheck.ts
Original file line number Diff line number Diff line change
Expand Up @@ -135,9 +135,11 @@ async function lint(

const mod = await Promise.resolve(require(deps.resolved.get('eslint')!))

const useFlatConfig =
// If V9 config was found, use flat config, or else use legacy.
eslintrcFile?.startsWith('eslint.config.')
// If V9 config was found, use flat config, or else use legacy.
const useFlatConfig = eslintrcFile
? // eslintrcFile is absolute path
path.basename(eslintrcFile).startsWith('eslint.config.')
: false

let ESLint
// loadESLint is >= 8.57.0
Expand Down Expand Up @@ -211,6 +213,15 @@ async function lint(
: // in ESLint >= 9, `plugins` value is Record<string, unknown>
'@next/next' in plugins

console.log({
hasNextPlugin,
plugins,
completeConfig,
configFile,
eslint,
useFlatConfig,
})

if (hasNextPlugin) {
nextEslintPluginIsEnabled = true
for (const [name, [severity]] of Object.entries(completeConfig.rules)) {
Expand Down

0 comments on commit ee03263

Please sign in to comment.