Skip to content

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

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
ota-meshi opened this issue Feb 22, 2018 · 4 comments
Closed

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

ota-meshi opened this issue Feb 22, 2018 · 4 comments

Comments

@ota-meshi
Copy link
Member

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.

@mysticatea
Copy link
Member

Thank you for this issue.

Looks good to me.
Maybe the existing vue/no-confusing-v-for-v-if rule should be deprecated after we add vue/no-use-v-if-with-v-for rule.

cc: @chrisvfritz @michalsnik

@ota-meshi
Copy link
Member Author

Thank you for considering the proposal !!

@chrisvfritz
Copy link
Contributor

I like it too. 🙂

@kenneyHong
Copy link

I like it too. 🙂
I do not like(我不喜欢)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants