【Trailing spaces not allowed no-trailing-spaces】报错

当我们用 Eslint 插件检测我们代码的规范的时候,有时候会遇到 “Trailing spaces not allowed no-trailing-spaces”报错,意思是空格不允许,多了空格,错误如下:

D:\MyCodes\simulation-project\src\views\Register.vue
  61:6  error  Trailing spaces not allowed  no-trailing-spaces

✖ 1 problem (1 error, 0 warnings)
  1 error and 0 warnings potentially fixable with the `--fix` option.

这不是你的代码逻辑有错,而是你的代码不符合这个 Eslint 的规范
在这里我不想通过配置,屏蔽 Eslint 的检测,因为在公司中我们还是要符合规范的,这样与我们的初衷相违背。

解决:

  • 哪个组件?Register.vue组件,去这里改错
  • 第几行?error前面的61:6代表错误位置是61行第6个位置
  • 找到这个位置把鼠标放在这一行的末尾,删除多余空格
  • 重新保存代码即可。

总结:

  • 解决这类问题主要还是找到第几行出了错,一般都是多或者少空格(space)。

猜你喜欢

转载自blog.csdn.net/liuzr_/article/details/121606857
今日推荐