简体   繁体   English

错误删除“CR”更漂亮/更漂亮的 Visual Studio 代码

[英]Error Delete 'CR' prettier/prettier Visual Studio Code

After installing Nuxt.js with this command npx create-nuxt-app <myapp> everything working fine, but when I tried to change the styles code on layout/default.vue I got these errors:使用此命令安装 Nuxt.js 后 npx npx create-nuxt-app <myapp>一切正常,但是当我尝试更改layout/default.vue上的样式代码时,出现以下错误:

241:9 error Insert prettier/prettier 241:9 错误插入更漂亮/更漂亮

I'm using Visual Studio Code, so I changed the settings from Preferences > settings > Extensions > Vetur , I changed the Format > Default Formatter: CSS = none and Default Formatter: HTML = none .我使用的是 Visual Studio Code,所以我从Preferences > settings > Extensions > Vetur更改了设置,我更改了Format > Default Formatter: CSS = noneDefault Formatter: HTML = none

Still, the problem persists.尽管如此,问题仍然存在。 I tried to fix using this command I found on GitHub npm run lint -- --fix and it worked, but every time I add a new file to the project, I got the error again!我尝试使用我在 GitHub npm run lint -- --fix上找到的这个命令来修复它并且它起作用了,但是每次我向项目添加一个新文件时,我都会再次出现错误! So funny!太搞笑了! I'm new in Nuxt.js.我是 Nuxt.js 的新手。

I have another's projects using only VueJS and everything working fine.我有另一个只使用 VueJS 的项目,一切正常。

Help!帮助! Thanks in advance!提前致谢!

In the root open the .editorconfig file and change:在根目录中打开 .editorconfig 文件并更改:

end_of_line = lf

to

end_of_line = auto

This should fix it for new files.这应该为新文件修复它。

to resolve this issue, use below command要解决此问题,请使用以下命令

yarn lint --fix纱线绒毛 --fix

if you have not installed yarn yet then install the yarn first.如果您还没有安装纱线,请先安装纱线

So I was getting the error when I tried to commit.所以当我尝试提交时我收到了错误。 I did this and it skipped the verification:我这样做了,它跳过了验证:

git commit -m "" --no-verify

I also followed this for VSCode https://medium.com/@csmunuku/windows-and-linux-eol-sequence-configure-vs-code-and-git-37be98ef71df我也遵循了 VSCode https://medium.com/@csmunuku/windows-and-linux-eol-sequence-configure-vs-code-and-git-37be98ef71df

VS Code => Settings => Files: EoL And choose “\\n” as EoL character if you would like your files to have Unix Style line endings and choose “\\r\\n” if you would like your files to have Windows Style line endings. VS Code => Settings => Files: EoL 如果您希望文件具有 Unix 样式行结尾,请选择“\\n”作为 EoL 字符,如果您希望文件具有 Windows 样式行,请选择“\\r\\n”结局。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM