简体   繁体   English

如何更漂亮地打破所有联合类型?

[英]How to make prettier break all union types?

I want this:我要这个:

type SomeType = Variant1 | Variant2

to always format into this:始终格式化为:

type SomeType =
  | Variant1 
  | Variant2

No matter whether it overflows the specified column width or not.不管它是否溢出指定的列宽。

If you need that degree of control over formatting you're likely not the target audience for Prettier because such things are intentionally not configurable in it.如果您需要对格式进行那种程度的控制,那么您可能不是 Prettier 的目标受众,因为这些东西是故意不可配置的。 See Prettier's option philosophy .请参阅Prettier 的期权哲学 That said, you still can achieve what you want by creating a fork or a plugin.也就是说,您仍然可以通过创建分叉或插件来实现您想要的。

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

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