vue/no-deprecated-v-bind-sync
Proibir o modificador obsoleto .sync em v-bind.
| Severidade padrão | Predefinições | Correção automática | Opções |
|---|---|---|---|
error |
essential, happy-path, nuxt, ecosystem, opinionated |
Não | Nenhuma |
Aplicável a: Templates e blocos de SFC Vue, com o contexto do script quando exigido pela regra.
Incorreto
As vinculações usam o modificador .sync removido, inclusive em combinação com .camel.
<template>
<MyComponent :title.sync="title" />
<MyComponent v-bind:title.sync="title" />
<MyComponent :title.sync.camel="title" />
</template>
Correto
Use uma vinculação comum unidirecional de title ou v-model:title quando for necessário um canal de atualização.
<template>
<MyComponent :title="title" />
<MyComponent v-model:title="title" />
</template>
Configuração (Vite+)
import { defineConfig } from "@vizejs/vite-plugin/vite-plus";
export default defineConfig({}).withVue({
linter: {
"preset": "incremental",
"rules": {
"vue/no-deprecated-v-bind-sync": "error"
}
},
});
Depois, execute vp run lint.