Skip to content
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

Add support for props destructure #2121

Closed
6 tasks done
ota-meshi opened this issue Apr 3, 2023 · 4 comments
Closed
6 tasks done

Add support for props destructure #2121

ota-meshi opened this issue Apr 3, 2023 · 4 comments

Comments

@ota-meshi
Copy link
Member

ota-meshi commented Apr 3, 2023

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.

Additional context

vuejs/core#7986

@ota-meshi
Copy link
Member Author

ota-meshi commented May 13, 2023

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

@n0099
Copy link

n0099 commented Sep 6, 2024

It's stable now: https://blog.vuejs.org/posts/vue-3-5#reactive-props-destructure

@henribru
Copy link

henribru commented Sep 10, 2024

Perhaps a bit niche, but an optional rule that bans props destructure could also be useful, to keep consistency with existing code that doesn't use it.

Or perhaps one that you can configure to either enforce that everything uses props destructure or that nothing does.

@ota-meshi
Copy link
Member Author

I believe we have merged the necessary changes into the master branch so I will close this issue.

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

No branches or pull requests

3 participants