vue/warn-custom-block
Warn about custom blocks in SFC files.
| Default severity | Presets | Automatic fix | Options |
|---|---|---|---|
warning |
nuxt, opinionated |
No | None |
Applies to: Vue SFC templates and blocks, with script context where the rule requires it.
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>
Configuration (Vite+)
import { defineConfig } from "@vizejs/vite-plugin/vite-plus";
export default defineConfig({}).withVue({
linter: {
"preset": "incremental",
"rules": {
"vue/warn-custom-block": "warn"
}
},
});
Then run vp run lint.