Description
disallow use other than available
lang
However, the rule doesn't perform a check if the script
tag is missing.
It also says:
This rule disallows the use of languages other than those available in the your application for the lang attribute of block elements.
Which could imply that the check shouldn't be performed if the script tag is omitted. However, then the rule is not fulfilling its purpose, which is to force TypeScript (or another language) in all Vue SFCs.
I am using TypeScript with
tsconfig.json
>vueCompilerOptions.strictTemplates: true
@typescript-eslint
And so I want linting and type checking in all templates. This only happens if I specify <script lang="ts">
in all my .vue
files. But my team is able to circumvent this in some components where the <script>
tag is not otherwise needed.
Checklist
- I have tried restarting my IDE and the issue persists.
- I have read the FAQ and my problem is not listed.
Tell us about your environment
- ESLint version: 9.12.0
- eslint-plugin-vue version: 10.1.1
- Vue version: 3.5.13
- Node version: 22.9.0
- Operating System: MacOS
Please show your full configuration:
Simplified version:
export default tseslint.config(
{
rules: {
'vue/block-lang': [
'error',
{
script: {
lang: 'ts',
},
},
],
}
}
What did you do?
<template>
<div>
</template>
What did you expect to happen?
An ESLint error, because I am not using lang="ts"
What actually happened?
There was no ESLint error
Repository to reproduce this issue
https://github.com/johannes-lindgren/eslint-plugin-vue_issue_block-lang