Skip to content

Enforce/disallow v-bind same name shorthand style #2359

@FloEdelmann

Description

@FloEdelmann

Please describe what the rule should do:

v-bind same name shorthand was added in Vue 3.4 and is supported since #2355/#2357. A new rule (e.g. vue/v-bind-same-name-style) or a new option of the existing vue/v-bind-style rule should be added that allows always enforcing that shorthand where possible, or always disallow it.

What category should the rule belong to?
[x] Enforces code style (layout)
[ ] Warns about a potential error (problem)
[ ] Suggests an alternate way of doing something (suggestion)
[ ] Other (please specify:)

Provide 2-3 code examples that this rule should warn about:

"sameNameShorthand": "always"

<template> <!-- ✓ GOOD --> <div :foo /> <div v-bind:foo /> <div :foo="bar" /> <div :foo='bar' /> <div v-bind:foo="bar" /> <div v-bind:foo='bar' /> <!-- ✗ BAD --> <div :foo="foo" /> <div :foo='foo' /> <div v-bind:foo="foo" /> <div v-bind:foo='foo' /> </template>

"sameNameShorthand": "never"

<template> <!-- ✓ GOOD --> <div :foo="foo" /> <div :foo='foo' /> <div v-bind:foo="foo" /> <div v-bind:foo='foo' /> <div :foo="bar" /> <div :foo='bar' /> <div v-bind:foo="bar" /> <div v-bind:foo='bar' /> <!-- ✗ BAD --> <div :foo /> <div v-bind:foo /> </template>

Additional context:

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions