Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: add warning message for ESLint v9 with npm --force flag #132

Merged
merged 2 commits into from
Jun 19, 2024

Conversation

aladdin-add
Copy link
Member

fixes #125

@eslint-github-bot
Copy link

Hi @aladdin-add!, thanks for the Pull Request

The pull request title isn't properly formatted. We ask that you update the pull request title to match this format, as we use it to generate changelogs and automate releases.

  • The length of the commit message must be less than or equal to 72

To Fix: You can fix this problem by clicking 'Edit' next to the pull request title at the top of this page.

Read more about contributing to ESLint here

@aladdin-add aladdin-add changed the title fix: add warning message for ESLint v9 compatibility with npm --force flag fix: add warning message for ESLint v9 with npm --force flag Jun 18, 2024
@eslint-github-bot eslint-github-bot bot added the bug Something isn't working label Jun 18, 2024
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");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't this come in the else block below? We'd want to log this only when users need to install the dependencies themselves.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe this was intentional. The problem is not when @eslint/create-config installs dependencies, but when the user runs npm install anytime after that.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Then it should print warning in both the cases right?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, that would definitely make sense, but the problem is that in the other case we don't know if it's needed because we don't know which package manager is used in the project. Perhaps we could add something like (not needed if you are using yarn).

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

well, I adjusted the message:

when choosing npm:

Note some plugins currently do not support ESLint v9 yet.
You may need to use '--force' when installing, or add the following to your package.json: 
"overrides": { "eslint": "^9.5.0" } 

others:

Note some plugins currently do not support ESLint v9 yet.
You may need to use '--force' when installing

I'm not a native English speaker, so suggestions for wording improvements are welcome! 😄

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we don't know which package manager is used in the project.

We can identify which package manager is being used by checking for lock files?

Note some plugins currently do not support ESLint v9 yet.

this can be changed to Note that some plugins currently do not support ESLint v9 yet.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can identify which package manager is being used by checking for lock files?

maybe, I'm just not sure it's worthy the efforts - the plugins will add official eslint v9 supports later. :)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can identify which package manager is being used by checking for lock files?

maybe, I'm just not sure it's worthy the efforts - the plugins will add official eslint v9 supports later. :)

I also think it's not worth the effort at this point, both plugins will probably add official eslint v9 support soon.

@aladdin-add aladdin-add force-pushed the issue125 branch 3 times, most recently from f6849a2 to af55c20 Compare June 19, 2024 07:18
… flag

fixes #125

Signed-off-by: 唯然 <weiran.zsd@outlook.com>
Copy link
Member

@mdjermanovic mdjermanovic left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks! Leaving open for others to review.

Copy link
Member

@harish-sethuraman harish-sethuraman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Copy link
Contributor

@snitin315 snitin315 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks!

@snitin315 snitin315 merged commit f8178a8 into main Jun 19, 2024
11 checks passed
@snitin315 snitin315 deleted the issue125 branch June 19, 2024 10:24
@github-actions github-actions bot mentioned this pull request Jun 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
accepted bug Something isn't working
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

Creates a broken config (npm install fails)
4 participants