vue-pug/implicit-div
クラスと id の省略記法の前にあるタグ名 div を必須にする、または禁止します。
✅ configs.recommended で有効です(warn)。🔧 --fix で修正できます。
Rule の詳細
Pug では、.class や #id の省略記法で始まる行は div です。
always(デフォルト): 暗黙の形を使います。省略記法の前に明示的なdivがあると報告され、fix は名前を削除します。never:divを書きます。省略記法で始まるタグが報告され、fix はdivを挿入します。
省略記法のない div(div、div(v-if="ok"))は報告されません。always では、次の 2 つのケースが fix なしで報告されます。タグ補間の中の div(#[div.a x])と、最初の省略記法が名前の直後に続かない div(div(a).b)です。名前を削除すると、行が ( で始まってしまうためです。
正しくない例
vue
<template lang="pug">
div.card Content
</template>vue
<template lang="pug">
div#app.container
p Hello
</template>正しい例
vue
<template lang="pug">
.card Content
</template>vue
<template lang="pug">
#app.container
div(v-if="ready") Hello
</template>オプション
js
'vue-pug/implicit-div': ['warn', 'always']'always'(デフォルト)または 'never'。
["never"] での正しくない例
vue
<template lang="pug">
.card Content
</template>["never"] での正しい例
vue
<template lang="pug">
div.card Content
</template>