Skip to content

vue/no-setup-props-destructure false negatives in object or array initialization #2007

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
2 tasks done
FloEdelmann opened this issue Oct 11, 2022 · 0 comments · Fixed by #2244
Closed
2 tasks done
Labels

Comments

@FloEdelmann
Copy link
Member

FloEdelmann commented Oct 11, 2022

Checklist

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

Tell us about your environment

  • ESLint version: 8.24.0
  • eslint-plugin-vue version: 9.6.0
  • Node version: 16.17.0
  • Operating System: Kubuntu 22.04

Please show your full configuration:

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

What did you do?
In setup function:

const foo = props.foo          // ESLint correctly reports a `vue/no-setup-props-destructure` error
const bar = { foo: props.foo } // no `vue/no-setup-props-destructure` error
const baz = [props.foo]        // no `vue/no-setup-props-destructure` error
const complex = [{
  foo: [props.foo],            // no `vue/no-setup-props-destructure` error
}]

What did you expect to happen?
An error is thrown for all statements, because they all destructure the props object, causing them to lose reactivity.

What actually happened?
Only an error for the first statement.

Repository to reproduce this issue
None created yet, will do if required.

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

Successfully merging a pull request may close this issue.

1 participant