在 .vue 文件末尾插入新行

时间:2021-05-21 11:54:34

标签: typescript vue.js visual-studio-code prettier-eslint

我在使用 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

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

我错过了什么吗?

0 个答案:

没有答案