-
-
Notifications
You must be signed in to change notification settings - Fork 668
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 flat config to an array to accept *.vue
#2436
Conversation
I always like to export an object (if possible). the usage can be like: const plugin = require('eslint-plugin-vue');
module.exports = [
{files: ["**/*.js", "**/*.vue"], plugin.configs['flat/base']},
]; If you export the array format it will be difficult for the user to combine them, e.g. to add "*.ts". |
I think that the only way to properly specify the extension to apply the configuration provided in the array is as follows. const plugin = require('eslint-plugin-vue');
module.exports = [
...plugin.configs['flat/base'].map((config) => ({
...config,
files: ["**/*.js", "**/*.vue"]
})),
] I agree that objects are easier to handle, but I don't think it's possible in this case 🤔 |
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.
the flat config docs should show it's exporting an array, otherwise LGTM!
Thank you for the review! I have fixed the documentation. |
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.
I added some commits with small changes, as that was easier than describing in comments what I am suggesting. Feel free to comment/revert them. Otherwise, this is fine from my side 🙂
Thanks! Let's get flat config support shipped 🚀
Thanks for fixing the documentation! |
This PR changes the flat config to an array to accept
*.vue
extensions.I noticed that using the following flat config I receive the following message:
I think this is because the flat config does not include the
*.vue
extension infiles
.I was thinking of adding
files: ['*.vue']
to all configs, but that doesn't work because some of the rules of this plugin can also be used in*.js
files. Therefore, we addedfiles: ['*.vue']
only to the config that has a parser and modified it to provide the config as an array.@aladdin-add I would like to hear your opinion if possible.