Skip to content

Files

Latest commit

 

History

History
71 lines (50 loc) · 1.46 KB

no-useless-v-bind.md

File metadata and controls

71 lines (50 loc) · 1.46 KB

Pattern: Use of v-bind with string literal value

Issue: -

Description

This rule reports v-bind with a string literal value.
The v-bind with a string literal value can be changed to a static attribute definition.

<template>
  <!-- ✓ GOOD -->
  <div foo="bar"/>
  <div :foo="bar"/>

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

Options

{
  "vue/no-useless-v-bind": ["error", {
    "ignoreIncludesComment": false,
    "ignoreStringEscape": false
  }]
}
  • ignoreIncludesComment ... If true, do not report expressions containing comments. default false.
  • ignoreStringEscape ... If true, do not report string literals with useful escapes. default false.

"ignoreIncludesComment": true

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

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

"ignoreStringEscape": true

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

Further Reading