Skip to content
On this page

vue/script-setup-uses-vars

prevent <script setup> variables used in <template> to be marked as unused

  • 🚫 This rule was deprecated.

TIP

This rule is not needed when using vue-eslint-parser v9.0.0 or later.

ESLint no-unused-vars rule does not detect variables in <script setup> used in <template>. This rule will find variables in <script setup> used in <template> and mark them as used.

This rule only has an effect when the no-unused-vars rule is enabled.

📖 Rule Details

Without this rule this code triggers warning:

Now loading...

After turning on, Foo is being marked as used and no-unused-vars rule doesn't report an issue.

🔇 When Not To Use It

You can disable this rule in any of the following cases:

  • You are using vue-eslint-parser v9.0.0 or later.
  • You are not using <script setup>.
  • You do not use the no-unused-vars rule.

📚 Further Reading

🚀 Version

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

🔍 Implementation