From 3b24c347e228ae4c5de6ee844892ec9ae1eeef4b Mon Sep 17 00:00:00 2001 From: Jiwon Choi Date: Sat, 6 Apr 2024 23:45:21 +0900 Subject: [PATCH] hotfix(next):`next lint` installs `eslint@9` which includes breaking changes (#64141) This is a hotfix since it breaks `next lint`, I'll start to implement eslint v9 for canary. x-ref: #64114 x-ref: [eslint v9 release](https://github.com/eslint/eslint/releases/tag/v9.0.0) Fixes #64136 --------- Co-authored-by: Zack Tanner --- packages/next/src/lib/eslint/runLintCheck.ts | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/packages/next/src/lib/eslint/runLintCheck.ts b/packages/next/src/lib/eslint/runLintCheck.ts index 9e2d2967b1808..6e11c138d0604 100644 --- a/packages/next/src/lib/eslint/runLintCheck.ts +++ b/packages/next/src/lib/eslint/runLintCheck.ts @@ -369,8 +369,16 @@ export async function runLintCheck( } else { // Check if necessary deps installed, and install any that are missing deps = await hasNecessaryDependencies(baseDir, requiredPackages) - if (deps.missing.length > 0) + if (deps.missing.length > 0) { + deps.missing.forEach((dep) => { + if (dep.pkg === 'eslint') { + // eslint v9 has breaking changes, so lock to 8 until dependency plugins fully support v9. + dep.pkg = 'eslint@^8' + } + }) + await installDependencies(baseDir, deps.missing, true) + } // Write default ESLint config. // Check for /pages and src/pages is to make sure this happens in Next.js folder