简体   繁体   English

如何禁用拆分为更漂亮的新行?

[英]How to disable splitting into new line in prettier?

I am using Prettier for better formatting of the code.我正在使用 Prettier 来更好地格式化代码。 How do I disable the new line?如何禁用新行?

Before Saving:保存前:

在此处输入图片说明

After Saving:保存后:

在此处输入图片说明

I prefer them just to be like on Image 1 on saving.我更喜欢它们就像图像 1 上的保存一样。 How can I disable it so that it won't be like on image 2?我怎样才能禁用它,使它不像图 2 那样?

Prettier is quite strict so doesn't let you change much. Prettier 非常严格,所以不会让你改变太多。 There are a list of options on the docs, I think this is the closest to what you want: https://prettier.io/docs/en/options.html#jsx-brackets文档上有一个选项列表,我认为这是最接近你想要的: https : //prettier.io/docs/en/options.html#jsx-brackets

It might take a while to get used to it, but I quite like having the props on each line as it makes it easier to track changes in git history, so maybe over time it'll grow on you too :)习惯它可能需要一段时间,但我非常喜欢在每一行都有道具,因为它可以更容易地跟踪 git 历史中的变化,所以随着时间的推移,它也会在你身上成长:)

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

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