What did you do?
When using vscode with the "Vue - official" (vue.volar) extension in a Vite setup the Intellisense does not assume that the default language is JavaScript. In order to work around this limitation I was thinking of using the 'vue/block-lang` to enforce that a language is specified for every script block.
Formatting files like:
<script setup lang="js">
</script>
What did you expect to happen?
I expected rule to honor my settings to require script blocks to specify lang="js".
What actually happened?
The rule outputs errors regarding the default language is specified:
11:15 error Do not explicitly specify the default language for the 'lang' attribute of '<script>' vue/block-lang
Checklist
Tell us about your environment
Please show your full configuration:
What did you do?
When using vscode with the "Vue - official" (vue.volar) extension in a Vite setup the Intellisense does not assume that the default language is JavaScript. In order to work around this limitation I was thinking of using the 'vue/block-lang` to enforce that a language is specified for every script block.
Formatting files like:
What did you expect to happen? I expected rule to honor my settings to require script blocks to specify
lang="js"
.What actually happened?
The rule outputs errors regarding the default language is specified:
Based on my understanding of the rule's code, if an default language is specified, then omitting the language is preferred: https://github.com/vuejs/eslint-plugin-vue/blob/16c877892ba58b2cd1e68612553c1e8c2715d8ea/lib/rules/block-lang.js#L60-L89 It seems that this assumption was valid when Vetur was used for the official vscode extension: https://github.com/vuejs/eslint-plugin-vue/blob/16c877892ba58b2cd1e68612553c1e8c2715d8ea/docs/rules/block-lang.md?plain=1#L57-L62 It would be nice if the Vue vscode extension were better at handling the lang attribtue but I also feel that this rule shouldn't be as opinionated as it is now.
Repository to reproduce this issue