简体   繁体   English

Eslint airbnb和更漂亮的配置删除文本中的点后的所有空格

[英]Eslint airbnb and prettier config removes all spaces after dots in text

Eslint airbnb and prettier config removes all spaces after dots in lorem ipsum text. Eslint airbnb和更漂亮的配置会删除lorem ipsum文本中的点后的所有空格。 All the other spaces remain correct. 所有其他空格保持正确。 I configured .eslintrc, .prettierrc, .eslintignore, .prettierignore and .editorconfig when configuring a new react project from the template. 从模板配置新的React项目时,我配置了.eslintrc,.prettierrc,.eslintignore,.prettierignore和.editorconfig。 What can be the mistake? 可能是什么错误?

Airbnb ESlint rules include no-trailing-spaces . Airbnb ESlint规则包括no-trailing-spaces So if you use --fix mode, linter may remove all your spaces. 因此,如果使用--fix模式,则--fix可能会删除所有空格。

More about Airbnb styles: https://github.com/airbnb/javascript 有关Airbnb样式的更多信息: https : //github.com/airbnb/javascript

I managed to fix my bug in the following way: How to prevent insert spaces in JSX code . 我设法通过以下方式修复了我的错误: 如何防止在JSX代码中插入空格 I just manually changed in VS Code Javascript to Javascript React. 我只是在VS Code Javascript中手动更改为Javascript React。

I ended up removing prettier altogether, and I just run eslint with --fix instead, as I found prettier had styles that contradicted my .eslintrc file. 我最终完全删除了漂亮的文件,而只使用--fix运行eslint,因为我发现漂亮的样式与我的.eslintrc文件相矛盾。

There are plug-ins for VS code that will run your eslint rules on save, similar to prettier, like this one: https://marketplace.visualstudio.com/items?itemName=dbaeumer.vscode-eslint 有一些VS代码插件可以在保存时运行您的eslint规则,类似于更漂亮的插件,例如: https ://marketplace.visualstudio.com/items?itemName=dbaeumer.vscode-eslint

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

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