vue/warn-custom-block
Warn about custom blocks in SFC files
Default severity: warning
Presets: nuxt, opinionated
Automatic fix: None; review the suggested change
Applies to: Vue SFC templates and blocks, with script context where the rule requires it
Options: No rule-specific options. Severity and preset selection are configurable.
Configuration (Vite+)
import { defineConfig } from "@vizejs/vite-plugin/vite-plus";
export default defineConfig({
lint: {
vize: {
"preset": "incremental",
"rules": {
"vue/warn-custom-block": "warn"
}
},
},
});
vp run lint
Bad
The SFC contains an <i18n> custom block, which needs an external integration beyond ordinary template/script/style processing.
<i18n>
{ "en": { "hello": "Hello" } }
</i18n>
<template>
<p>{{ hello }}</p>
</template>
Good
The example uses standard template and script-setup blocks. This optional portability warning does not mean every custom block is invalid Vue.
<template>
<p>{{ hello }}</p>
</template>
<script setup lang="ts">
const hello = "Hello";
</script>
Good avoids this rule's finding under the configuration above; other rules may still report diagnostics.