eslint-plugin-vue icon indicating copy to clipboard operation
eslint-plugin-vue copied to clipboard

✨ Add support for defineOptions in `require-name-property` rule

Open jd-solanki opened this issue 2 years ago • 2 comments

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

jd-solanki avatar May 30 '23 06:05 jd-solanki

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>.

ota-meshi avatar May 30 '23 08:05 ota-meshi

but I think it should be an option

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

jd-solanki avatar May 30 '23 08:05 jd-solanki