简体   繁体   中英

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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