Last active
November 20, 2023 19:39
-
-
Save jurosh/eb0b10cdfa45c61ba99f6a441b316c21 to your computer and use it in GitHub Desktop.
Prettier ternaries format
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Prettier < 3 | |
const reactRouterResult = | |
children && !isEmptyChildren(children) | |
? children | |
: props.match | |
? component | |
? React.createElement(component, props) | |
: render | |
? render(props) | |
: null | |
: null; | |
// Prettier 3.1 (Back to the old days) | |
const reactRouterResult = | |
children && !isEmptyChildren(children) | |
? children | |
: props.match | |
? component | |
? React.createElement(component, props) | |
: render | |
? render(props) | |
: null | |
: null; | |
// Prettier 3+ (Experimental https://github.com/prettier/prettier/pull/13183) | |
const reactRouterResult = | |
children && !isEmptyChildren(children) ? children | |
: props.match ? | |
component ? React.createElement(component, props) | |
: render ? render(props) | |
: null | |
: null | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
prettier/prettier#13183