Closed ota-meshi closed 2 months ago
I think default values for arrays and objects are handled slightly differently when using props destructuring. I don't believe it's necessary to use a function to construct them, as shown in the example in https://vuejs.org/api/sfc-script-setup.html#reactive-props-destructure:
interface Props {
msg?: string
labels?: string[]
}
const { msg = 'hello', labels = ['one', 'two'] } = defineProps<Props>()
I've opened an issue: https://github.com/vuejs/eslint-plugin-vue/issues/2578
This PR modifies the
vue/require-valid-default-prop
rule to add support for props destructure.related to #2121