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: Improve config error messages #18457

Merged
merged 2 commits into from
May 17, 2024
Merged

fix: Improve config error messages #18457

merged 2 commits into from
May 17, 2024

Conversation

nzakas
Copy link
Member

@nzakas nzakas commented May 15, 2024

Prerequisites checklist

What is the purpose of this pull request? (put an "X" next to an item)

[ ] Documentation update
[ ] Bug fix (template)
[ ] New rule (template)
[ ] Changes an existing rule (template)
[ ] Add autofix to a rule
[ ] Add a CLI option
[x] Add something to the core
[ ] Other, please explain:

What changes did you make? (Give an overview)

  • Added additional URLs to several error messages related to configuration errors.
  • Added a nice message for when a config file isn't found, as it seems like some people are just installing ESLint v9 without doing any migration first and are confused when the config file isn't found.

Is there anything you'd like reviewers to focus on?

@nzakas nzakas requested a review from a team as a code owner May 15, 2024 15:00
@eslint-github-bot eslint-github-bot bot added the bug ESLint is working incorrectly label May 15, 2024
@github-actions github-actions bot added cli Relates to ESLint's command-line interface core Relates to ESLint's core APIs and features labels May 15, 2024
Copy link

netlify bot commented May 15, 2024

Deploy Preview for docs-eslint canceled.

Name Link
🔨 Latest commit a30a8e4
🔍 Latest deploy log https://app.netlify.com/sites/docs-eslint/deploys/6644cfed6476d5000823095d

@@ -11,15 +11,21 @@ Flat config uses "languageOptions.globals" to define global variables for your f

Please see the following page for information on how to convert your config object into the correct format:
https://eslint.org/docs/latest/use/configure/migration-guide#configuring-language-options

If you're not using "env" directly (it may be coming from a plugin), please see the following:
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
If you're not using "env" directly (it may be coming from a plugin), please see the following:
If "env" is not used directly (it may be coming from a shared config or plugin), please see the following:

https://eslint.org/docs/latest/use/configure/migration-guide#predefined-and-shareable-configs

If you're not using "extends" directly (it may be coming from a plugin), please see the following:
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
If you're not using "extends" directly (it may be coming from a plugin), please see the following:
If "extends" is not used directly (it may be coming from a shared config or plugin), please see the following:

@@ -29,6 +35,9 @@ Flat config uses "languageOptions.globals" to define global variables for your f

Please see the following page for information on how to convert your config object into the correct format:
https://eslint.org/docs/latest/use/configure/migration-guide#configuring-language-options

If you're not using "globals" directly (it may be coming from a plugin), please see the following:
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
If you're not using "globals" directly (it may be coming from a plugin), please see the following:
If "globals" is not used directly (it may be coming from a shared config or plugin), please see the following:

@@ -38,6 +47,9 @@ Flat config uses "ignores" to specify files to ignore.

Please see the following page for information on how to convert your config object into the correct format:
https://eslint.org/docs/latest/use/configure/migration-guide#ignoring-files

If you're not using "ignorePatterns" directly (it may be coming from a plugin), please see the following:
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
If you're not using "ignorePatterns" directly (it may be coming from a plugin), please see the following:
If "ignorePatterns" is not used directly (it may be coming from a shared config or plugin), please see the following:

@@ -56,6 +68,9 @@ Flat config is an array that acts like the eslintrc "overrides" array.

Please see the following page for information on how to convert your config object into the correct format:
https://eslint.org/docs/latest/use/configure/migration-guide#glob-based-configs

If you're not using "overrides" directly (it may be coming from a plugin), please see the following:
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
If you're not using "overrides" directly (it may be coming from a plugin), please see the following:
If "overrides" is not used directly (it may be coming from a shared config or plugin), please see the following:

@@ -65,6 +80,9 @@ Flat config uses "languageOptions.parser" to override the default parser.

Please see the following page for information on how to convert your config object into the correct format:
https://eslint.org/docs/latest/use/configure/migration-guide#custom-parsers

If you're not using "parser" directly (it may be coming from a plugin), please see the following:
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
If you're not using "parser" directly (it may be coming from a plugin), please see the following:
If "parser" is not used directly (it may be coming from a shared config or plugin), please see the following:

@@ -74,6 +92,9 @@ Flat config uses "languageOptions.parserOptions" to specify parser options.

Please see the following page for information on how to convert your config object into the correct format:
https://eslint.org/docs/latest/use/configure/migration-guide#configuring-language-options

If you're not using "parserOptions" directly (it may be coming from a plugin), please see the following:
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
If you're not using "parserOptions" directly (it may be coming from a plugin), please see the following:
If "parserOptions" is not used directly (it may be coming from a shared config or plugin), please see the following:

@aladdin-add aladdin-add added the accepted There is consensus among the team that this change meets the criteria for inclusion label May 16, 2024
@nzakas
Copy link
Member Author

nzakas commented May 16, 2024

@aladdin-add I don't understand why you're suggesting to change the wording in all of the messages. I purposely used "You" to make it clear to people that if they, personally, aren't using the key then it's probably coming from a plugin.

@aladdin-add
Copy link
Member

well. I don't feel strong about the wording - just want to say it's also may be coming from a shared config. 😄

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!

I'm merging this now for today's release, and we can discuss the wording in a follow-up.

@mdjermanovic mdjermanovic merged commit 8db0eff into main May 17, 2024
19 checks passed
@mdjermanovic mdjermanovic deleted the config-errors-updates branch May 17, 2024 18:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
accepted There is consensus among the team that this change meets the criteria for inclusion bug ESLint is working incorrectly cli Relates to ESLint's command-line interface core Relates to ESLint's core APIs and features
Projects
Status: Complete
Development

Successfully merging this pull request may close these issues.

None yet

3 participants