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

[CLI] Handle undefined computed config #288

Open
silvenon opened this issue May 21, 2024 · 0 comments
Open

[CLI] Handle undefined computed config #288

silvenon opened this issue May 21, 2024 · 0 comments

Comments

@silvenon
Copy link
Contributor

This will mostly be a result of an unexpected ESLint config, but will represent an additional hurdle for anyone using your great CLI utility who's migrating to the flat config and learning the ropes.

For .js/.cjs/.mjs files eslint --print-config seems to always have a default configuration where rules exists, even when ESLint config is empty, but in case ESLint has not been successfully configured for TypeScript eslint --print-config index.ts will return undefined, so not even an empty object, which causes the CLI utility to fail.

This is not related to the flat config, it was also a thing that could happen before as well, but I only ran into it while migrating to the flat config because of a breaking change in glob matching.

Proposed solution

Initially I thought that the right thing to do is to tell the user that the config is a-ok and that it doesn't conflict with Prettier, but on second thought people shouldn't be checking files that have no ESLint configuration, so I still think that the error message is a good idea, but the one that describes what's actually wrong. This file has no ESLint configuration, or something like that.

What do you think?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant