-
-
Notifications
You must be signed in to change notification settings - Fork 669
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
feat: support flat configs #2407
Conversation
Hi, just wanted to share some of the challenges I had getting this to work in the context of my vue3+typescript project.
module.exports.configs['flat/base'].plugins.vue = module.exports; https://github.com/ganondev/eslint-plugin-vue/blob/master/tools/update-lib-index.js#L62 This is what the import eslint from '@eslint/js';
import tseslint from 'typescript-eslint';
import vue from 'eslint-plugin-vue';
export default [
{
ignores: [
'api/',
'node_modules/',
'dist/',
'.yarn/',
'.pnp.cjs',
'.pnp.loader.mjs'
],
},
{
...eslint.configs.recommended,
languageOptions: {
...eslint.configs.recommended.languageOptions,
globals: {
require: 'readonly',
console: 'readonly',
}
},
},
...tseslint.configs.recommended,
{
files: ['**/*.vue'],
...vue.configs["flat/vue3-recommended"],
languageOptions: {
...vue.configs["flat/vue3-recommended"].languageOptions,
parserOptions: {
...vue.configs["flat/vue3-recommended"].languageOptions.parserOptions,
parser: '@typescript-eslint/parser'
}
},
},
{
rules: {
indent: ['error', 2],
}
},
]; Please let me know if this is how this is intended to look. It would be nice if I could parameterize the typescript parser option in, instead of flatting out down to the shared Unfortunately, I can't put export change up against the active fork here since it's a different upstream, but I wanted to make sure this at least gets shared. One last thing, taking inspiration from how |
@ganondev thanks for trying it - it seems a bug, I've pushed a new commit, should be fixed now. |
friendly ping @ota-meshi |
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.
Thanks for adding the tests. I think this looks quite good already! I have just a few more minor nits, then this is ready to go from my side 🙂
If you still don't have enough, an improvement (for a follow-up PR) would be adding types for the configs, see eslint/eslint#18093 (comment). But I can totally understand if you don't want to put more effort into this, so everyone else reading this, feel free to go ahead! I think that adding non-typed flat config support is the step with the most impact though, so thanks a lot for putting this forward!
Co-authored-by: Flo Edelmann <git@flo-edelmann.de>
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.
Thank you!
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.
LGTM! Thank you!
the main changes:
flat/*
.flat configs are exported as arrays.flat/recommended
is for vue 3.flat/vue2-recommended
is for vue 2.resubmit #2319.
fixes #1291