vue/mustache-interpolation-spacing
mustache 内の空白を揃えます。
既定の重大度: warning
プリセット: happy-path, nuxt, ecosystem, opinionated
自動修正: 対応する検出で利用可能
適用範囲: Vue SFC のテンプレート・ブロック。必要な script の文脈も例に含めています。
オプション: ルール固有のオプションはありません。重大度とプリセットは設定できます。
設定(Vite+)
import { defineConfig } from "@vizejs/vite-plugin/vite-plus";
export default defineConfig({
lint: {
vize: {
"preset": "incremental",
"rules": {
"vue/mustache-interpolation-spacing": "warn"
}
},
},
});
vp run lint
悪い
補間の式と区切りの間で、片側または両側の空白がありません。
<template>
<div>{{text}}</div>
<div>{{ text}}</div>
<div>{{text }}</div>
</template>
良い
式と mustache の開始・終了の両方の区切りに空白を入れます。
<template>
<div>{{ text }}</div>
<div>{{ foo.bar }}</div>
<div>{{ foo + bar }}</div>
</template>
良い例は上記の設定でこのルールの検出を避ける例です。他のルールでは検出される場合があります。