Skip to content

Instantly share code, notes, and snippets.

@Jack-Works
Created November 13, 2023 07:39
Show Gist options
  • Save Jack-Works/404ea508a87765e61be1dbf0f2fe0613 to your computer and use it in GitHub Desktop.
Save Jack-Works/404ea508a87765e61be1dbf0f2fe0613 to your computer and use it in GitHub Desktop.
prettier 3.1 feedback
//// Case 1
// before
len = len > 32 ? (len > 48 ? 66 : 48) : 32
// after
len =
len > 32 ?
len > 48 ?
66
: 48
: 32
// expected
len =
len > 32 ?
len > 48 ? 66 : 48
: 32
//// Case 2
// before
'__REACT_DEVTOOLS_GLOBAL_HOOK__' in globalThis ||
isBeta ||
isTest ||
!isEnvironment(Environment.HasBrowserAPI)
? 'open'
: 'closed'
// after
(
'__REACT_DEVTOOLS_GLOBAL_HOOK__' in globalThis ||
isBeta ||
isTest ||
!isEnvironment(Environment.HasBrowserAPI)
) ?
'open'
: 'closed'
// expected
'__REACT_DEVTOOLS_GLOBAL_HOOK__' in globalThis ||
isBeta ||
isTest ||
!isEnvironment(Environment.HasBrowserAPI) ?
'open'
: 'closed'
//// Case 3
// before
const bg = supportColor
? null
: {
backgroundImage: `url(${selected.u()})`,
backgroundSize: 'contain',
}
// after
const bg =
supportColor ? null : (
{
backgroundImage: `url(${selected.u()})`,
backgroundSize: 'contain',
}
)
// expected
const bg = supportColor ? null : {
backgroundImage: `url(${selected.u()})`,
backgroundSize: 'contain',
}
// before
{borderless ? (
children
) : (
<div
className={classNames('border rounded-lg border-line-light dark:border-neutral-800', {
'overflow-hidden': clipEdge,
})}>
{children}
</div>
)}
// after, I like no `()`s, but I think it can also be ported to prettier without flags now.
{borderless ?
children
: <div
className={classNames('border rounded-lg border-line-light dark:border-neutral-800', {
'overflow-hidden': clipEdge,
})}>
{children}
</div>
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment