vue/no-empty-component-block
空の SFC ブロックを検出します。
既定の重大度: warning
プリセット: nuxt, opinionated
自動修正: なし。修正内容を確認してください
適用範囲: Vue SFC のテンプレート・ブロック。必要な script の文脈も例に含めています。
オプション: ルール固有のオプションはありません。重大度とプリセットは設定できます。
設定(Vite+)
import { defineConfig } from "@vizejs/vite-plugin/vite-plus";
export default defineConfig({
lint: {
vize: {
"preset": "incremental",
"rules": {
"vue/no-empty-component-block": "warn"
}
},
},
});
vp run lint
悪い
template、script、style のブロックが空か、空白だけです。
<template></template>
<script></script>
<style>
</style>
良い
残すブロックには、マークアップ、script の宣言、style の宣言を入れます。
<template>
<div>Hello</div>
</template>
<script setup>
const message = "Hello";
</script>
<style scoped>
.button { color: red; }
</style>
良い例は上記の設定でこのルールの検出を避ける例です。他のルールでは検出される場合があります。