vue/no-deprecated-v-on-native-modifier
削除済みの v-on の .native modifier を検出します。
既定の重大度: error
プリセット: essential, 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/no-deprecated-v-on-native-modifier": "error"
}
},
},
});
vp run lint
悪い
コンポーネントのイベントに、廃止された .native を指定しています。
<template>
<MyComponent @click.native="handler" />
<MyComponent v-on:click.native="handler" />
<MyComponent @click.native.stop="handler" />
</template>
良い
.native を取り除き、.stop などの他の modifier は残します。
<template>
<MyComponent @click="handler" />
<MyComponent @click.stop="handler" />
</template>
良い例は上記の設定でこのルールの検出を避ける例です。他のルールでは検出される場合があります。