eslint-plugin-vue icon indicating copy to clipboard operation
eslint-plugin-vue copied to clipboard

`vue/setup-props-no-reactivity-loss`: false negative inside ternary operator

Open FloEdelmann opened this issue 1 year ago • 0 comments

Checklist

  • [x] I have tried restarting my IDE and the issue persists.
  • [x] I have read the FAQ and my problem is not listed.

Tell us about your environment

  • ESLint version: 8.56.0
  • eslint-plugin-vue version: 9.19.2
  • Node version: 18
  • Operating System: Ubuntu

Please show your full configuration:

{
  "rules": {
    "vue/setup-props-no-reactivity-loss": "error"
  }
}

What did you do?

export default defineComponent({
  setup(props) {
    const correct = props.foo;
    const incorrect = props.foo ? bar : undefined;
  },
});

What did you expect to happen? Two errors being reported by vue/no-setup-props-reactivity-loss.html, one for each line.

What actually happened? Only the first line is being reported.

Repository to reproduce this issue https://ota-meshi.github.io/eslint-plugin-vue-demo/#eJxtj8EKwjAMhl8l9KLC5sDjnHrwNXaZXQaFmZQ0Hcrou1uqBxEvIcn/JfmzGssjmtZ0wYrzeu7J3T2LwgojTo7wyrkmJIUEk/AdNkvEzbEnfBQuU0Oc9Zferj0BBNTot17Yhx2UDoBlCpqjCFqFExR1PzEfv3VHfwi4wG0QaCHS+9xYZlLVU9rltGs+X5jKSJwxmHY12W5DXBcrdVlVCw5W3eL0Wc8cMnVI6QWPvV6Q

FloEdelmann avatar Dec 18 '23 16:12 FloEdelmann