Vize

vue/no-deprecated-v-bind-sync

禁止在 v-bind 上使用已弃用的 .sync 修饰符。

默认严重程度 预设 自动修复 选项
error essential, happy-path, nuxt, ecosystem, opinionated 不支持 无

适用范围:Vue SFC 模板和代码块,包括规则所需的脚本上下文。

错误示例

绑定使用了已移除的 .sync 修饰符,包括它与 .camel 的组合。

<template>
<MyComponent :title.sync="title" />
<MyComponent v-bind:title.sync="title" />
<MyComponent :title.sync.camel="title" />
</template>

正确示例

使用普通的单向 title 绑定;需要更新通道时,则使用 v-model:title。

<template>
<MyComponent :title="title" />
<MyComponent v-model:title="title" />
</template>

配置(Vite+)

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

export default defineConfig({}).withVue({
  linter: {
    "preset": "incremental",
    "rules": {
      "vue/no-deprecated-v-bind-sync": "error"
    }
  },
});

然后运行 vp run lint。

相关页面