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 defineOptions in require-name-property rule #2196

Open
jd-solanki opened this issue May 30, 2023 · 2 comments · May be fixed by #2686
Open

✨ Add support for defineOptions in require-name-property rule #2196

jd-solanki opened this issue May 30, 2023 · 2 comments · May be fixed by #2686

Comments

@jd-solanki
Copy link

What rule do you want to change?
This doesn't support defineOptions ATM. If we leave defineOptions with empty object

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

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

Please provide some example code that this change will affect:

<script lang="ts" setup>
// Below should throw error
defineOptions({})
</script>

What does the rule currently do for this code?
No error

What will the rule do after it's changed?
Should throw error like we do in options API

Additional context

N/A

@ota-meshi
Copy link
Member

Thank you for posting the issue.
I think that feature addition is good, but I think it should be an option. Because <script setup> infers the name option.

https://vuejs.org/api/options-misc.html#name

TIP
Since version 3.2.34, a single-file component using <script setup> will automatically infer its name option based on the filename, removing the need to manually declare the name even when used with <KeepAlive>.

@jd-solanki
Copy link
Author

but I think it should be an option

Maybe we can use it as "explicit: true" because name is automatically inferred?

@chouchouji chouchouji linked a pull request Feb 16, 2025 that will close this issue
2 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants