-
-
Notifications
You must be signed in to change notification settings - Fork 29
fix: use flat config when eslintrc config does not exist #288
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
base: main
Are you sure you want to change the base?
Conversation
3f6f106
to
252109a
Compare
Please update the description of this PR with a description of the problem this is meant to fix, just like you would with a bug report. |
filed the issue in #290. |
|
||
throw new TypeError( | ||
`Plugin config "${configName}" in plugin "${userPluginNamespace}" is an eslintrc config and cannot be used in this context.`, | ||
// If it's a legacy config, or the config does not exsist => look for the flat version |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
// If it's a legacy config, or the config does not exsist => look for the flat version | |
// If it's a legacy config, or the config does not exist => look for the flat version |
// If we get here, then the config was either not found or is a legacy config | ||
const message = directConfig | ||
? `Plugin config "${configName}" in plugin "${userPluginNamespace}" is an eslintrc config and cannot be used in this context.` | ||
: `Plugin config "${configName}" not found in plugin "${userPluginNamespace}".`; | ||
throw new TypeError(message); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This logic doesn't seem correct to me. There could be a flatConfig
that is an eslintrc, but it looks like this logic will say the config wasn't found.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
right! should be addressed in 71e013b.
Prerequisites checklist
What is the purpose of this pull request?
What changes did you make? (Give an overview)
The plugin configuration lookup logic has been refactored to better accommodate scenarios where the eslintrc does not exist.
Related Issues
fixes #290.
refs: eslint/generator-eslint#227
Is there anything you'd like reviewers to focus on?