[英]How to turn off prettier replacing space with {' '} in formatter?
Sometimes I write some space at the front of the Text string
有时我在
Text string
的前面写一些空格
eg例如
<Text> something something</Text>
But after I format It.但是在我格式化之后。 Prettier automatically convert it to
Prettier 自动将其转换为
<Text>{' '} ... </Text>
Can I turn off this setting?我可以关闭此设置吗?
TLDR: You can't, there is no such option and they'll not add new options. TLDR:你不能,没有这样的选项,他们不会添加新选项。
Prettier generally is built to be a set of configurations that should not be changed. Prettier 通常被构建为一组不应更改的配置。
from their page: Prettier is not a kitchen-sink code formatter that attempts to print your code in any way you wish. It is opinionated.
来自他们的页面:
Prettier is not a kitchen-sink code formatter that attempts to print your code in any way you wish. It is opinionated.
Prettier is not a kitchen-sink code formatter that attempts to print your code in any way you wish. It is opinionated.
https://prettier.io/docs/en/option-philosophy.html https://prettier.io/docs/en/option-philosophy.html
This is their philosophy, prettier is best used by just sticking to the defaults.这是他们的理念,prettier 最好通过坚持默认设置来使用。
If you want to customize how your code is formatted, you'll have to do the work yourself with eslint, for example如果您想自定义代码的格式,您必须自己使用 eslint 完成这项工作,例如
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.