Skip to content

Commit

Permalink
fix lint errors
Browse files Browse the repository at this point in the history
  • Loading branch information
mollpo committed Aug 27, 2024
1 parent 4424cc9 commit 99cee5f
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 5 deletions.
11 changes: 8 additions & 3 deletions src/components/content/DescriptionItem/DescriptionItem.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -47,15 +47,20 @@ export function DescriptionItem({
title,
className,
contentProps,
...props
hideIfEmpty = false,
content,
}: DescriptionItemProps) {
return (
<>
{((props.hideIfEmpty && props.content) ?? !props.hideIfEmpty) && (
{((hideIfEmpty &&
content !== null &&
content !== undefined &&
content !== '') ||
!hideIfEmpty) && (
<DescriptionItemContainer className={className}>
<DescriptionItemTitle>{title}</DescriptionItemTitle>
<DescriptionItemContent {...contentProps}>
{props.content}
{content}
</DescriptionItemContent>
</DescriptionItemContainer>
)}
Expand Down
5 changes: 3 additions & 2 deletions src/components/content/WithPlaceholder/WithPlaceholder.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,15 @@ export function WithPlaceholder({
placeholder = '-',
children,
}: WithPlaceholderProps) {
/* eslint-disable @typescript-eslint/prefer-nullish-coalescing */
return (
<>
{typeof children === 'number'
? isNaN(children)
? placeholder
: children
: children || placeholder}
: children === null || children === undefined || children === ''
? placeholder
: children}
</>
)
}
2 changes: 2 additions & 0 deletions src/components/util/useId.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ const useIsomorphicLayoutEffect = canUseDOM() ? useLayoutEffect : useEffect
function canUseDOM() {
return Boolean(
typeof window !== 'undefined' &&
// eslint-disable-next-line @typescript-eslint/prefer-optional-chain
typeof window.document !== 'undefined' &&
typeof window.document.createElement !== 'undefined',
)
}
Expand Down

0 comments on commit 99cee5f

Please sign in to comment.