Skip to content

Commit

Permalink
fix: add warning message for ESLint v9 compatibility with npm --force…
Browse files Browse the repository at this point in the history
… flag

fixes #125

Signed-off-by: 唯然 <weiran.zsd@outlook.com>
  • Loading branch information
aladdin-add committed Jun 18, 2024
1 parent 6a1d4f2 commit fe70f4a
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
8 changes: 8 additions & 0 deletions lib/config-generator.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down
2 changes: 1 addition & 1 deletion tests/__snapshots__/config@eslint-config-airbnb
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@ export default [
"devDependencies": [
"eslint@^7.32.0 || ^8.2.0",
"eslint-config-airbnb",
"eslint-plugin-react@^7.28.0",
"eslint-plugin-import@^2.25.3",
"eslint-plugin-jsx-a11y@^6.5.1",
"eslint-plugin-react@^7.28.0",
"eslint-plugin-react-hooks@^4.3.0",
"@eslint/eslintrc",
"@eslint/js",
Expand Down

0 comments on commit fe70f4a

Please sign in to comment.