question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

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

See original GitHub issue

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). https://github.com/vuejs/vuepress/issues/678

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:6 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
michalsnikcommented, Jul 30, 2018

Updated on master

0reactions
ocavuecommented, Jul 29, 2018

ok, I will reopen this issue and change the title just for reminding.

image

Read more comments on GitHub >

github_iconTop Results From Across the Web

Available rules - eslint-plugin-vue
Rule ID Description vue/multi‑word‑component‑names require component names to be always multi‑word... vue/no‑arrow‑functions‑in‑watch disallow using arrow functions to define watcher... vue/no‑computed‑properties‑in‑data disallow accessing computed properties in data...
Read more >
Configuration Files - ESLint - Pluggable JavaScript Linter
A pluggable and configurable linter tool for identifying and reporting on patterns in JavaScript. Maintain your code quality with ease.
Read more >
@vue/eslint-plugin - npm
The most rules of eslint-plugin-vue require vue-eslint-parser to check <template> ASTs. Make sure you have one of the following settings in your ...
Read more >
ESLint and Prettier with Vite and Vue.js 3 - Vue School Blog
Learn how to set up Prettier and ESLint with Vite for your next Vue 3 ... to the 3 different priorities in the...
Read more >
Vue.js style guide - GitLab Docs
We default to eslint-vue-plugin, with the plugin:vue/recommended . Check the rules for more documentation. Basic Rules. The service has its own file; The...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found