Vize

vue/no-deprecated-slot-scope-attribute

削除済みの slot-scope 属性を検出します。

既定の重大度 プリセット 自動修正 オプション
error essential, happy-path, nuxt, ecosystem, opinionated なし なし

適用範囲:Vue SFC のテンプレートと各ブロック。ルールに必要な script の文脈も例に含めています。

悪い例

廃止された slot-scope でスロットの props を受け取っています。

<template>
<Card><template slot-scope="props">{{ props.name }}</template></Card>
</template>

良い例

#default で同じ props を受け取り、slot-scope を取り除きます。

<template>
<Card><template #default="props">{{ props.name }}</template></Card>
</template>

設定(Vite+)

import { defineConfig } from "@vizejs/vite-plugin/vite-plus";

export default defineConfig({}).withVue({
  linter: {
    "preset": "incremental",
    "rules": {
      "vue/no-deprecated-slot-scope-attribute": "error"
    }
  },
});

設定したら vp run lint を実行します。

関連ページ