Skip to content

Same rule has different priority in style guide and in eslint-plugin-vue #540

@ocavue

Description

@ocavue

Please describe what the rule should do:

Provide a warning when using v-if on the same element as v-for.

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:

<PostCard
    v-for="page in pages"
    v-if="isVisiblePost(page)"
    :key="page.key"
    :page="page"
    :showContent="false"
    :showLink="true"
/>
<ul>
  <li
    v-for="user in users"
    v-if="shouldShowUsers"
    :key="user.id"
  >
    {{ user.name }}
  <li>
</ul>

Why should this rule be included

  1. Style guide has provided some reasons. This rule's priority is essential, which is the same priority as rule vue/valid-v-for
  2. Because of unknown reason, I found out that if I use v-if with v-for, safari will have some wrong behave. I can bypass it if I follow style guide's suggestion (see link above). Wrong behave in Safari vuepress#678

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions