# vue/experimental-script-setup-vars

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.

# 📖 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>
Now loading...

After turning on, props and emit are being marked as defined and no-undef rule doesn't report an issue.

# 🔍 Implementation