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: 唯然 <[email protected]>
  • Loading branch information
aladdin-add committed Jun 19, 2024
1 parent 6a1d4f2 commit b033ce3
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 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,17 @@ 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")) {
let message = "Note some plugins currently do not support ESLint v9 yet.\nYou may need to use '--force' when installing";

if (packageManager === "npm") {
const pkg = JSON.parse(await fs.readFile(this.packageJsonPath, "utf8"));

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

log.warn(message);
}
}
}

0 comments on commit b033ce3

Please sign in to comment.