From 5959e7cdae966dedf8d3ba92cab4fd71c9179283 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=94=AF=E7=84=B6?= Date: Tue, 18 Jun 2024 18:14:45 +0800 Subject: [PATCH] fix: add warning message for ESLint v9 compatibility with npm --force flag MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit fixes https://github.com/eslint/create-config/issues/125 Signed-off-by: 唯然 --- lib/config-generator.js | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/lib/config-generator.js b/lib/config-generator.js index 2d3d55f5..63c064e7 100644 --- a/lib/config-generator.js +++ b/lib/config-generator.js @@ -298,6 +298,14 @@ export default [\n${exportContent}];`; } else { log.info(`Successfully created ${configPath} file.`); } + + if (packageManager === "npm" && this.result.installFlags.includes("--force")) { + const pkg = JSON.parse(await path.readFile(this.packageJsonPath, "utf8")); + + log.warn("Note some plugins currently do not support ESLint v9 yet.\nYou will need to use '--force' when installing, or add the following to your package.json:\n"); + log.warn(`"overrides": {"eslint": "${pkg.devDependencies.eslint}"}`); + } + } else { await writeFile(configPath, this.result.configContent);