Appearance
vue/script-setup-uses-vars
防止在
<template>
中使用的<script setup>
变量被标记为未使用
- ⛔ 此规则已在 eslint-plugin-vue v10.0.0 中删除。
提示
使用 vue-eslint-parser
v9.0.0 或更高版本时不需要此规则。
¥This rule is not needed when using vue-eslint-parser
v9.0.0 or later.
ESLint no-unused-vars
规则不检测 <template>
中使用的 <script setup>
中的变量。此规则将查找在 <template>
中使用的 <script setup>
中的变量并将其标记为已使用。
¥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.
此规则仅在启用 no-unused-vars
规则时才有效。
¥This rule only has an effect when the no-unused-vars
rule is enabled.
📖 规则详情
如果没有此规则,此代码将触发警告:
¥Without this rule this code triggers warning:
开启后,Foo
被标记为已使用,no-unused-vars
规则未报告问题。
¥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:
你使用的是
vue-eslint-parser
v9.0.0 或更高版本。¥You are using
vue-eslint-parser
v9.0.0 or later.你没有使用
<script setup>
。¥You are not using
<script setup>
.你不使用
no-unused-vars
规则。¥You do not use the
no-unused-vars
rule.
👫相关规则
¥👫 Related Rules
📚扩展阅读
¥📚 Further Reading
🚀版本
¥🚀 Version
此规则在 eslint-plugin-vue v7.13.0 中引入
¥This rule was introduced in eslint-plugin-vue v7.13.0
🔍代码实现
¥🔍 Implementation