Skip to content

Commit 3650648

Browse files
committed
fix: allow user to pass
1 parent ca961e1 commit 3650648

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

packages/next/src/lib/eslint/runLintCheck.ts

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,14 @@ async function lint(
135135

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

138-
const { ESLint } = mod
138+
const { loadESLint } = mod
139+
const ESLint = await loadESLint({
140+
// To use legacy configs (.eslintrc*), user has to pass `ESLINT_USE_FLAT_CONFIG=false`.
141+
// https://eslint.org/blog/2024/04/eslint-v9.0.0-released/#flat-config-is-now-the-default-and-has-some-changes
142+
// The return value is `LegacyESLint`.
143+
// https://github.com/eslint/eslint/blob/1def4cdfab1f067c5089df8b36242cdf912b0eb6/lib/types/index.d.ts#L1609-L1613
144+
useFlatConfig: process.env.ESLINT_USE_FLAT_CONFIG !== 'false',
145+
})
139146
let eslintVersion = ESLint?.version ?? mod.CLIEngine?.version
140147

141148
if (!eslintVersion || semver.lt(eslintVersion, '7.0.0')) {

0 commit comments

Comments
 (0)