jsprettier

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