[英]How to disable prettier adding {" "} in jsx?
I have got a problem with prettier's formatting, which when I'm saving the code, it will add annoying {" "}
to some parts of the jsx
code eg:我遇到了更漂亮的格式问题,当我保存代码时,它会在
jsx
代码的某些部分添加烦人的{" "}
例如:
I've searched about how to fix this issue, but couldn't find any solution, can anybody help on this?我已经搜索了如何解决这个问题,但找不到任何解决方案,有人可以帮忙吗?
Here is the reprex: prettier playground and here is the related issue on github这是代表: 更漂亮的游乐场,这是github 上的相关问题
Since there is an issue about this on prettier's GitHub , and it has been closed without any practical solution, So this question does not have any practical answer.由于prettier 的 GitHub上有一个关于这个的问题,并且已经关闭,没有任何实际的解决方案,所以这个问题没有任何实际的答案。 The only answer which has been mentioned in that github issue is just use
//prettier-ignore
that will disable it:在 github 问题中提到的唯一答案就是使用
//prettier-ignore
将禁用它:
Default version:默认版本:
/*source*/
<p>hello <a href="#" target="_blank">LINK</a> world</p>
/*output*/
<p>
hello{" "}
<a href="#" target="_blank">
LINK
</a>{" "}
world
</p>;
Using //prettier-ignore
to disable it:使用
//prettier-ignore
禁用它:
/*source*/
//prettier-ignore
<p>hello <a href="#" target="_blank">LINK</a> world</p>
/*output:*/
//prettier-ignore
<p>hello <a href="#" target="_blank">LINK</a> world</p>
Here is the playground这里是游乐场
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.