Skip to content
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

False Positive for 'Big v-if' Rule #466

Open
bchanez opened this issue Nov 23, 2024 · 1 comment
Open

False Positive for 'Big v-if' Rule #466

bchanez opened this issue Nov 23, 2024 · 1 comment
Labels
bug Something isn't working

Comments

@bchanez
Copy link
Contributor

bchanez commented Nov 23, 2024

Describe the bug
The vue-mess-detector plugin is triggering the "Big v-if" rule for my component, but I don't believe the v-if condition is large or complex enough to warrant this warning. The rule is being triggered on a relatively simple condition.

To Reproduce

  1. What is the exact code you are analyzing?
<script setup lang="ts">
defineProps({
  fieldError: {
    type: String as () => string,
    default: () => undefined,
  },
  generalErrors: {
    type: Array as () => string[],
    default: () => [],
  },
})
</script>

<template>
  <ion-text
    v-if="fieldError"
    class="ml-4 text-red-500"
  >
    {{ fieldError }}
  </ion-text>

  <div
    v-if="generalErrors.length"
    class="text-red-500 mt-4"
  >
    <ul>
      <li
        v-for="(error) in generalErrors"
        :key="error"
      >
        {{ error }}
      </li>
    </ul>
  </div>
</template>
  1. What is the output you are getting?
-  rrd ~ big v-if
   src/components/FormErrors.vue
   👉 Big v-if can be moved out to its own component. See: https://vue-mess-detector.webmania.cc/rules/rrd/big-vif.html
   line #9 has a v-if with 13 lines 🚨

Expected behavior
I expect the rule to not be triggered since the v-if condition is not that complex or large. The generalErrors condition is a simple check for an array length, and it does not seem to meet the threshold for a "big v-if" as per the rule.

Screenshots
N/A

Used version number of vue-mess-detector:
0.65.0

Used version number of node & yarn:
[email protected]

Additional context

@bchanez bchanez added the bug Something isn't working label Nov 23, 2024
@rrd108
Copy link
Owner

rrd108 commented Nov 23, 2024

Do you want to add a faling test or a fix?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants