[vue]:解决You may use special comments to disable some warnings.

1,852 阅读1分钟

在写vue后npm run serve的时候出了这个bug:

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.
ERROR in xxx 7:0 error Parsing error: Adjacent JSX elements must be wrapped in an enclosing tag. Did you want a JSX fragment <>...</>? (7:0)

先放我最后找到的解决方法: 在vue.config.js文件中将lintOnSave改为false,没有就添加。

image.png

在网上搜的时候,发现基本清一色都是两种解决方式。

  1. 在build/webpack.base.conf.js文件中注释掉第43行代码,重新启动
  2. 在config/index.js文件中第26行中的useEslint的值true改为false

然而我并没有这两个,而且手动创建也不行,后来发现这个报错是eslint代码规范校验引起的,按这个思路搜才得以解决