eslint-plugin-vue
eslint-plugin-vue copied to clipboard
Add support for props destructure
Tell us about your environment
- ESLint version: v8.36.0
- eslint-plugin-vue version: v9.10.0
- Node version: v18.12.1
The problem you want to solve.
Add support for props destructure. It will be introduced in Vue 3.3.
<script setup lang="ts">
const { foo = 1, bar = 'ok' } = defineProps<{ foo?: number, bar?: string }>()
</script>
Your take on the correct solution to problem.
I think we should at least change the rules in the following list.
- [ ] Change
vue/no-setup-props-destructure
rule. Destructuring assignment immediately after defineProps() is allowed. However, Vue2 doesn't allow to use props destructure, so we may need to split rules. - [ ] Change
vue/require-valid-default-prop
rule. - [ ] Change
vue/require-default-prop
rule. - [ ] Change
vue/no-boolean-default
rule. We need to support a new way to specify defaults.
Additional context
https://github.com/vuejs/core/pull/7986
Since it's still an experimental feature, eslint-plugin-vue won't support it yet until it's GA.
https://blog.vuejs.org/posts/vue-3-3#experimental-features