Skip to content

Latest commit

 

History

History
52 lines (35 loc) · 1.53 KB

experimental-script-setup-vars.md

File metadata and controls

52 lines (35 loc) · 1.53 KB
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

vue/experimental-script-setup-vars

prevent variables defined in <script setup> to be marked as undefined

  • ⚠️ This rule was deprecated.

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

:::warning <script setup="args"> syntax wasn't rejected by Vue's RFC. Check out the new syntax. :::

📖 Rule Details

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.

🚀 Version

This rule was introduced in eslint-plugin-vue v7.0.0

🔍 Implementation