Skip to content

Rule proposal: no-use-v-if-with-v-for #403

@ota-meshi

Description

@ota-meshi

Please describe what the rule should do:

This rule warns never use v-if on the same element as v-for.

Style guide:
https://vuejs.org/v2/style-guide/#Avoid-v-if-with-v-for-essential

What category of rule is this? (place an "X" next to just one item)

[X] Enforces code style
[ ] Warns about a potential error
[ ] Suggests an alternate way of doing something
[ ] Other (please specify:)

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

<ul>
  <li
    v-for="user in users"
    v-if="user.isActive"
    :key="user.id"
  >
    {{ user.name }}
  </li>
</ul>

Why should this rule be included?

This rule is stated in the Style guide as ESSENTIAL.
It is similar to vue/no-confusing-v-for-v-if, but the content of code examples is not warned.

I confirmed issues, but I could not find duplicate rules.
I'm sorry if it was duplicated.

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

      pFad - Phonifier reborn

      Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

      Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


      Alternative Proxies:

      Alternative Proxy

      pFad Proxy

      pFad v3 Proxy

      pFad v4 Proxy