Something went wrong. Try again.
[READ-ONLY] Mirror of https://github.com/sxzz/eslint-plugin-vuekit. Modern ESLint plugin for Vue 3 eslint-plugin-vuekit.sxzz.dev
eslint plugin vue
Something went wrong. Try again.
2.2 kB · 77 lines
Markdown
at main
pageClass: rule-details
sidebarDepth: 0
title: vue/valid-v-bind-sync
description: enforce valid .sync modifier on v-bind directives
since: v7.0.0 #
vue/valid-v-bind-sync #
enforce valid
.syncmodifier onv-binddirectives
- ⛔ This rule was removed in eslint-plugin-vue v11.0.0.
This rule checks whether every .sync modifier on v-bind directives is valid.
📖 Rule Details #
This rule reports .sync modifier on v-bind directives in the following cases:
- The
.syncmodifier does not have the attribute value which is valid as LHS. E.g.<MyComponent v-bind:aaa.sync="foo() + bar()" />,<MyComponent v-bind:aaa.sync="a?.b" /> - The
.syncmodifier has potential null object property access. E.g.<MyComponent v-bind:aaa.sync="(a?.b).c" /> - The
.syncmodifier is on non Vue-components. E.g.<input v-bind:aaa.sync="foo"></div> - The
.syncmodifier's reference is iteration variables. E.g.<div v-for="x in list"><MyComponent v-bind:aaa.sync="x" /></div>
<template>
<!-- ✓ GOOD -->
<MyComponent v-bind:aaa.sync="foo" />
<MyComponent :aaa.sync="foo" />
<div v-for="todo in todos">
<MyComponent v-bind:aaa.sync="todo.name" />
<MyComponent :aaa.sync="todo.name" />
</div>
<!-- ✗ BAD -->
<MyComponent v-bind:aaa.sync="foo + bar" />
<MyComponent :aaa.sync="foo + bar" />
<MyComponent :aaa.sync="a?.b.c" />
<MyComponent :aaa.sync="(a?.b).c" />
<input v-bind:aaa.sync="foo" />
<input :aaa.sync="foo" />
<div v-for="todo in todos">
<MyComponent v-bind:aaa.sync="todo" />
<MyComponent :aaa.sync="todo" />
</div>
</template>
::: warning Note This rule does not check syntax errors in directives because it's checked by vue/no-parsing-error rule. :::
🔧 Options #
Nothing.
👫 Related Rules #
📚 Further Reading #
🚀 Version #
This rule was introduced in eslint-plugin-vue v7.0.0