Skip to content

vue/no-setup-props-destructure is too restrictive after latest update #2259

Closed
@l3d00m

Description

@l3d00m

What rule do you want to change?

vue/no-setup-props-destructure

Does this change cause the rule to produce more or fewer warnings?

fewer

How will the change be implemented? (New option, new default behavior, etc.)?

Revert #2244 and extract those rule changes into a new rule.

The changes now cause rule violations for example code directly from the vue documentation (see #2244 (comment)).

It now enforces more or less subjective defaults. I mostly agree with the defaults, but the rule is active in vue3-essential, which shouldn't happen for subjective defaults.

In addition to that, the name and documentation no longer matches with the behaviour.

Please provide some example code that this change will affect:

<script setup>
  const props = defineProps({ count: Number })
  const count = ref(props.count)
                         ^^^^^^ Failing
</script>

What does the rule currently do for this code?

The code is violating the rule, even though this is not a destructure, but a non reactive access.

What will the rule do after it's changed?

It shouldn't violate. This is a valid use case for setting an initial value, even though it might not be required to do so often. Still, it shouldn't be necessary to disable the rule for every line where this occurs.

Please consider making this a new rule, which could be placed in recommended instead. This has nothing to do with destructuring anymore, which is indeed critical and should fail.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions