当前位置:   article > 正文

解决You may use special comments to disable some warnings.

you may use special comments to disable some warnings. use // eslint-disable

解决You may use special comments to disable some warnings.

有时候我们在运行vue项目的时候,会弹出以下警告信息:

You may use special comments to disable some warnings.
Use // eslint-disable-next-line to ignore the next line.
Use /* eslint-disable */ to ignore all warnings in a file.

You may use special comments to disable some warnings.的翻译是:你可以使用一些特殊的注释来禁用一些警告

警告信息是提示你可以使用:
// eslint-disable-next-line来标记下一行内容不被eslint检测
/* eslint-disable */ 来标记整个文件不被eslint检测

使用方法如下:

// 下一行eslint规则失效
// eslint-disable-next-line
console.log(add(1, 10));
  • 1
  • 2
  • 3

解决方法:
出现这个提示的原因是因为我们使用了eslint语法检测工具(初学者不推荐使用,很容易让人崩溃的),如果我们不想出现上述提示,有两种解决方法:

  1. 根据eslint的提示,将代码修改成符合格式的样子,使用webstorm或者vscode下载eslint插件,都会有提示功能,根据提示进行修改即可。
  2. 新手推荐: 关闭eslint语法检测,在.eslintrc.js文件中,注释掉 eslint:recommended。如图:
    在这里插入图片描述
声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/Cpp五条/article/detail/442274
推荐阅读
  

闽ICP备14008679号