在 Vue.js 的 eslint 中删除“组件已注册但未使用" [英] Remove 'component has been registered but not used' in eslint for Vue.js
问题描述
我正在使用动态组件:
然而,eslint 不断返回:
However, eslint keeps returning this:
60:16 错误 组件"组件已注册但未使用
vue/no-unused-components
60:16 error The "component" component has been registered but not used
vue/no-unused-components
如何在 eslint 上禁用上述规则?
How can I disable the rule above on eslint?
推荐答案
您可以通过在 JavaScript 文件的顶部写入以下内容来禁用该特定的 ESLint 规则: /* eslint-disable vue/no-unused-组件 */
.请注意,这可能位于单文件组件(即 .vue
文件)中的第一个 标记之后.
You can disable that particular ESLint rule by writing the following at the top of your JavaScript file: /* eslint-disable vue/no-unused-components */
. Note that this may be after the first <script>
tag in a single-file component (ie. a .vue
file).
但是,在您的情况下,您可能会发现通过将以下内容附加到导致错误的有问题行的末尾来禁用特定行的此错误更有用://eslint-disable-line vue/no-unused-components
.
In your situation, however, you may find it more useful to just disable this error for a particular line by appending the following to the end of the problematic line causing the error: // eslint-disable-line vue/no-unused-components
.
这篇关于在 Vue.js 的 eslint 中删除“组件已注册但未使用"的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!