Skip to content

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

Closed
@FloEdelmann

Description

@FloEdelmann

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions