Skip to content

Latest commit

 

History

History
67 lines (50 loc) · 1.79 KB

no-useless-template-attributes.md

File metadata and controls

67 lines (50 loc) · 1.79 KB
pageClass sidebarDepth title description since
rule-details
0
vue/no-useless-template-attributes
disallow useless attribute on `<template>`
v7.19.0

vue/no-useless-template-attributes

disallow useless attribute on <template>

📖 Rule Details

This rule to prevent any useless attribute on <template> tags.

<template>
  <!-- ✓ GOOD -->
  <template v-if="foo">...</template>
  <template v-if="foo">...</template>
  <template v-else-if="foo">...</template>
  <template v-else>...</template>
  <template v-for="i in foo" :key="i">...</template>
  <template v-slot:foo>...</template>
  <!-- for Vue<=2.5 -->
  <template slot="foo">...</template>
  <template :slot="foo">...</template>
  <template slot-scope="param">...</template>
  <!-- for Vue<=2.4 -->
  <template scope="param">...</template>

  <!-- ✗ BAD -->
  <template v-if="foo" class="heading">...</template>
  <template v-for="i in foo" :bar="i">...</template>
  <template v-slot:foo="foo" ref="input">...</template>
  <template v-if="foo" @click="click">...</template>

  <!-- Ignore -->
  <template class="heading">...</template>
  <template :bar="i">...</template>
  <template ref="input">...</template>
  <template @click="click">...</template>
</template>

🔧 Options

Nothing.

👫 Related Rules

🚀 Version

This rule was introduced in eslint-plugin-vue v7.19.0

🔍 Implementation