How to make prettier break all union types?

萝らか妹 提交于 2020-12-13 04:33:17

问题


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.


回答1:


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. See Prettier's option philosophy. That said, you still can achieve what you want by creating a fork or a plugin.



来源:https://stackoverflow.com/questions/61229101/how-to-make-prettier-break-all-union-types

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!