pageClass | sidebarDepth | title | description |
---|---|---|---|
rule-details |
0 |
vue/valid-define-options |
enforce valid `defineOptions` compiler macro |
enforce valid
defineOptions
compiler macro
- ❗ This rule has not been released yet.
This rule checks whether defineOptions
compiler macro is valid.
This rule reports defineOptions
compiler macros in the following cases:
defineOptions
are referencing locally declared variables.defineOptions
has been called multiple times.- Options are not defined in
defineOptions
. defineOptions
has type arguments.defineOptions
hasprops
,emits
,expose
orslots
options.
<script setup>
/* ✓ GOOD */
defineOptions({ name: 'foo' })
</script>
<script>
const def = { name: 'foo' }
</script>
<script setup>
/* ✓ GOOD */
defineOptions(def)
</script>
<script setup>
/* ✗ BAD */
const def = { name: 'foo' }
defineOptions(def)
</script>
<script setup>
/* ✗ BAD */
defineOptions({ name: 'foo' })
defineOptions({ inheritAttrs: false })
</script>
<script setup>
/* ✗ BAD */
defineOptions()
</script>
<script setup lang="ts">
/* ✗ BAD */
defineOptions<{ name: 'Foo' }>()
</script>
<script setup>
/* ✗ BAD */
defineOptions({ props: { msg: String } })
</script>
Nothing.