Closed crystalfp closed 4 months ago
Yes, the workaround is to add the rule:
"vue/comment-directive": "off"
But I don't have found an explanation of why it triggers and if blocking it hides other errors.
This repo doesn't have official "Flat config" support yet, see
Did you try with the experimental implementation in #2319?
I was having the same issue, just fixed it by adding processor to the config
import tsparser from '@typescript-eslint/parser'
import vue from 'eslint-plugin-vue'
import parser from 'vue-eslint-parser'
export default {
name: 'dethdkn/vue/parser',
files: ['**/*.vue'],
languageOptions: {
parser,
parserOptions: {
extraFileExtensions: ['.vue'],
parser: tsparser,
sourceType: 'module' as const,
},
},
processor: vue.processors['.vue'],
}
I have no idea why, but it worked for me 😶
Since flat config is now supported, you can use something like this, see https://eslint.vuejs.org/user-guide/#configuration-eslint-config-js:
import pluginVue from 'eslint-plugin-vue'
export default [
// add more generic rulesets here, such as:
// js.configs.recommended,
...pluginVue.configs['flat/recommended'],
{
rules: {
// override/add rules settings here
}
}
]
I'll close this as resolved, feel free to comment if it is still an issue.
Hello @FloEdelmann, this way you enable the recommended rules right?, if so, how do I enable only the plugin? so I can add all the rules by myself.
Thanks for your work! I changed the rules I had before:
...vuePlugin.configs.base.rules,
...vuePlugin.configs["vue3-essential"].rules,
...vuePlugin.configs["vue3-recommended"].rules,
to:
...vuePlugin.configs["flat/base"].rules,
...vuePlugin.configs["flat/essential"].rules,
...vuePlugin.configs["flat/strongly-recommended"].rules,
...vuePlugin.configs["flat/recommended"].rules,
And now everything works perfectly (and the "vue/comment-directive"
gives no error).
Thanks again!
mario
@dethdkn Use the flat/base
config instead of the flat/recommended
rule in this case. See https://eslint.vuejs.org/user-guide/#bundle-configurations-eslint-config-js.
I was having the same issue, just fixed it by adding processor to the config
import tsparser from '@typescript-eslint/parser' import vue from 'eslint-plugin-vue' import parser from 'vue-eslint-parser' export default { name: 'dethdkn/vue/parser', files: ['**/*.vue'], languageOptions: { parser, parserOptions: { extraFileExtensions: ['.vue'], parser: tsparser, sourceType: 'module' as const, }, }, processor: vue.processors['.vue'], }
I have no idea why, but it worked for me 😶
This is what I was missing! That was driving me slowly insane. Thank you 🙏🏻
Checklist
Tell us about your environment
Please show your full configuration: I just started experimenting with this flat config file
eslint.config.mjs
:What did you do?
What did you expect to happen? As using yaml config, I want no errors reported also using flat config.
What actually happened?
The errors happens at the closing tag of
</template>
and</script>
Repository to reproduce this issue Zipped project to reproduce the issue