Vize

vue/block-lang

Disallow languages other than the configured lang on an SFC block.

Default severity Presets Automatic fix Options
warning None No None

Applies to: Vue SFC templates and blocks, with script context where the rule requires it.

Bad

The script block omits the configured lang attribute.

<script setup>
const label = "a";
</script>
<template>
  <p>{{ label }}</p>
</template>

Good

The script block sets lang to the configured language.

<script setup lang="ts">
const label = "a";
</script>
<template>
  <p>{{ label }}</p>
</template>

Configuration (Vite+)

import { defineConfig } from "@vizejs/vite-plugin/vite-plus";

export default defineConfig({}).withVue({
  linter: {
    "preset": "incremental",
    "rules": {
      "vue/block-lang": "warn"
    },
    "ruleOptions": {
      "vue/block-lang": {
        "script": {
          "lang": "ts",
          "allowNoLang": false
        }
      }
    }
  },
});

Then run vp run lint.