Vize

vue/no-restricted-v-on

Proíbe o argumento de v-on configurado.

Severidade padrão Predefinições Correção automática Opções
warning Nenhuma Não Nenhuma

Aplicável a: Templates e blocos de SFC Vue, com o contexto do script quando exigido pela regra.

Incorreto

O botão escuta o evento proibido legacy-click.

<template>
  <button type="button" @legacy-click="save">x</button>
</template>

Correto

O botão escuta click.

<template>
  <button type="button" @click="save">x</button>
</template>

Configuração (Vite+)

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

export default defineConfig({}).withVue({
  linter: {
    "preset": "incremental",
    "rules": {
      "vue/no-restricted-v-on": "warn"
    },
    "ruleOptions": {
      "vue/no-restricted-v-on": [
        "legacy-click"
      ]
    }
  },
});

Depois, execute vp run lint.

Páginas relacionadas