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 19, 2024
1 parent 6a1d4f2 commit f6849a2
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
12 changes: 12 additions & 0 deletions lib/config-generator.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
*/
import process from "node:process";
import path from "node:path";
import fs from "node:fs/promises";
import { spawnSync } from "node:child_process";
import { writeFile } from "node:fs/promises";
import enquirer from "enquirer";
Expand Down Expand Up @@ -304,5 +305,16 @@ export default [\n${exportContent}];`;
log.info(`Successfully created ${configPath} file.`);
log.warn("You will need to install the dependencies yourself.");
}

if (this.result.installFlags.includes("--force")) {
const pkg = JSON.parse(await fs.readFile(this.packageJsonPath, "utf8"));
let message = "Note some plugins currently do not support ESLint v9 yet.\nYou may need to use '--force' when installing";

if (packageManager === "npm") {
message += `, or add the following to your package.json: \n"overrides": { "eslint": "${pkg.devDependencies.eslint}" } `;
}

log.warn(message);
}
}
}
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -62,5 +62,6 @@
},
"gitHooks": {
"pre-commit": "lint-staged"
}
},
"packageManager": "pnpm@8.5.0+sha1.83c41fe4ebdb61e08446f8bb68a75fb48756b330"
}

0 comments on commit f6849a2

Please sign in to comment.