vue/no-deprecated-slot-attribute
削除済みの slot 属性を検出します。
| 既定の重大度 | プリセット | 自動修正 | オプション |
|---|---|---|---|
error |
essential, happy-path, nuxt, ecosystem, opinionated |
なし | なし |
適用範囲:Vue SFC のテンプレートと各ブロック。ルールに必要な script の文脈も例に含めています。
悪い例
旧来の slot 属性で header のスロットを選んでいます。
<template>
<Foo>
<template slot="header"><h1>Title</h1></template>
<div :slot="name">Title</div>
</Foo>
</template>
良い例
現在の v-slot:header で header のスロットを指定します。
<template>
<Foo>
<template v-slot:header><h1>Title</h1></template>
</Foo>
</template>
設定(Vite+)
import { defineConfig } from "@vizejs/vite-plugin/vite-plus";
export default defineConfig({}).withVue({
linter: {
"preset": "incremental",
"rules": {
"vue/no-deprecated-slot-attribute": "error"
}
},
});
設定したら vp run lint を実行します。