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
Change Request: explicitly handle undefined
being passed as a config value
#18259
Closed
1 task done
Labels
accepted
There is consensus among the team that this change meets the criteria for inclusion
core
Relates to ESLint's core APIs and features
enhancement
This change enhances an existing feature of ESLint
Comments
G-Rath
added
core
Relates to ESLint's core APIs and features
enhancement
This change enhances an existing feature of ESLint
labels
Apr 2, 2024
It makes sense to me to improve error reporting in this case, as referencing a config name that doesn't exist in a plugin might be a common mistake. @eslint/eslint-team thoughts? |
@G-Rath can you please update your description with a specific example that results in the error? |
@nzakas done (I was in the middle of doing that when you posted 😅) |
nzakas
added
the
accepted
There is consensus among the team that this change meets the criteria for inclusion
label
Apr 3, 2024
Thanks. Yeah, I agree we should have a nicer error message in this case. |
G-Rath
added a commit
to G-Rath/eslint
that referenced
this issue
Apr 5, 2024
1 task
nzakas
added a commit
that referenced
this issue
Apr 17, 2024
nzakas
added a commit
that referenced
this issue
Apr 17, 2024
1 task
fasttime
added a commit
that referenced
this issue
Apr 19, 2024
* feat: Provide helpful error message for nullish configs fixes #18259 * Update lib/config/flat-config-array.js Co-authored-by: Francesco Trotta <[email protected]> * Update lib/config/flat-config-array.js Co-authored-by: Francesco Trotta <[email protected]> --------- Co-authored-by: Francesco Trotta <[email protected]>
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
core
Relates to ESLint's core APIs and features
enhancement
This change enhances an existing feature of ESLint
ESLint version
next
What problem do you want to solve?
Currently flat config does not have any special handling for
undefined
being passed in causing an "accessed property on undefined" error:This is confusing because
undefined
is commonly expected if you try to use a config that doesn't exist but the error message looks more like a potential bug in ESLint:This is a real-world example of where I hit this as I was testing for
eslint-plugin-jest
's upcoming major in which we're removing theflat/snapshots
config.What do you think is the correct solution?
I'd like ESLint to explicitly check for
undefined
and raise an error along the lines of "you've passedundefined
as a config - this usually happens when you're trying to reference a config that doesn't exist"Participation
Additional comments
Born from #18094 & #18094 (comment)
The text was updated successfully, but these errors were encountered: