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

解决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));

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

  1. 根据eslint的提示,将代码修改成符合格式的样子,使用webstorm或者vscode下载eslint插件,都会有提示功能,根据提示进行修改即可。
  2. 新手推荐: 关闭eslint语法检测,在.eslintrc.js文件中,注释掉 eslint:recommended。如图:
    在这里插入图片描述

猜你喜欢

转载自blog.csdn.net/weixin_46683645/article/details/116197279