在 .vue 文件末尾插入新行

问题描述

我在使用 Typescript 的 Vue 项目中遇到了 prettier + eslint 的问题。一切都按预期工作,除了一件事,在文件末尾插入新行。

Insert `␍⏎`eslintprettier/prettier
Newline required at end of file but not found.eslinteol-last

我正在使用 VSCode。这些是我的设置:

我将 vetur 作为 vue 文件认格式化程序:

"[vue]": {
        "editor.defaultFormatter": "octref.vetur"
}

在 vetur 中,我有这样的格式化程序:

  • JS 的认格式化程序:prettier-eslint
  • TS 的认格式化程序:prettier-tslint

但是当我保存 `.vue 文件时,所有内容都已格式化但文件末尾没有新行。为什么不?我可以在 VSCode 中启用此设置:

Insert final new line and trim final new lines settings unchecked in VSCode

不过我觉得应该没必要,更漂亮的应该这样做。

我错过了什么吗?

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)