pageClass | sidebarDepth | title | description | since |
---|---|---|---|---|
rule-details |
0 |
vue/experimental-script-setup-vars |
prevent variables defined in `<script setup>` to be marked as undefined |
v7.0.0 |
prevent variables defined in
<script setup>
to be marked as undefined
- ⚙️ This rule is included in all of
"plugin:vue/base"
,"plugin:vue/essential"
,"plugin:vue/vue3-essential"
,"plugin:vue/strongly-recommended"
,"plugin:vue/vue3-strongly-recommended"
,"plugin:vue/recommended"
and"plugin:vue/vue3-recommended"
.
:::warning This rule is an experimental rule. It may be removed without notice. :::
This rule will find variables defined in <script setup="args">
and mark them as defined variables.
This rule only has an effect when the no-undef
rule is enabled.
Without this rule this code triggers warning:
<script setup="props, { emit }">
import { watchEffect } from 'vue'
watchEffect(() => console.log(props.msg))
emit('foo')
</script>
After turning on, props
and emit
are being marked as defined and no-undef
rule doesn't report an issue.
This rule was introduced in eslint-plugin-vue v7.0.0