-
-
Notifications
You must be signed in to change notification settings - Fork 4.4k
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
Comments
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 😅) |
Thanks. Yeah, I agree we should have a nicer error message in this case. |
* feat: Provide helpful error message for nullish configs fixes #18259 * Update lib/config/flat-config-array.js Co-authored-by: Francesco Trotta <github@fasttime.org> * Update lib/config/flat-config-array.js Co-authored-by: Francesco Trotta <github@fasttime.org> --------- Co-authored-by: Francesco Trotta <github@fasttime.org>
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: