Skip to content

Commit

Permalink
chore: Avoid accidental rendering
Browse files Browse the repository at this point in the history
  • Loading branch information
oBusk committed Oct 31, 2022
1 parent 05136c3 commit 977b1d0
Show file tree
Hide file tree
Showing 7 changed files with 12 additions and 11 deletions.
1 change: 1 addition & 0 deletions .eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
"warnOnUnassignedImports": true
}
],
"react/jsx-no-leaked-render": "error",
"sort-imports": [
"error",
{ "ignoreCase": true, "ignoreDeclarationSort": true }
Expand Down
2 changes: 1 addition & 1 deletion src/components/Diff/DiffFile/DiffPlaceholder.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ const DiffPlaceholder = forwardRef<DiffPlaceholderProps, "div">(
<Button variant="ghost" colorScheme="blue">
Load Diff
</Button>
{reason && <span>{reason}</span>}
{reason ? <span>{reason}</span> : null}
</Stack>
),
);
Expand Down
8 changes: 4 additions & 4 deletions src/components/DiffIntro/DiffIntro.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ const DiffIntro = forwardRef<DiffIntroProps, "h2">(
}
/>
</Heading>
{packagephobiaResults && (
{packagephobiaResults ? (
<>
<Heading marginTop="8px" size="xs">
{Packagephobia.name}
Expand Down Expand Up @@ -142,8 +142,8 @@ const DiffIntro = forwardRef<DiffIntroProps, "h2">(
width="100%"
/>
</>
)}
{bundlephobiaResults && (
) : null}
{bundlephobiaResults ? (
<>
<Heading size="xs">{Bundlephobia.name}</Heading>
<BundlephobiaFlags data={bundlephobiaResults} />
Expand Down Expand Up @@ -185,7 +185,7 @@ const DiffIntro = forwardRef<DiffIntroProps, "h2">(
width="100%"
/>
</>
)}
) : null}
<Heading size="l">npm diff</Heading>
<Options options={options} />
{/* <Command
Expand Down
4 changes: 2 additions & 2 deletions src/components/DiffIntro/Options.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,12 @@ const Options = forwardRef<OptionsProps, typeof BorderBox>(
<Heading size="xs" marginBottom="1em">
Options
</Heading>
{diffFiles && (
{diffFiles ? (
<Text>
<b>files:</b>{" "}
<Code>{diffFiles.join(" ") || "\u00A0"}</Code>
</Text>
)}
) : null}
{specifiedOptions.map(([key, value]) => (
<Text key={key}>
<b>{key}:</b> <Code>{JSON.stringify(value)}</Code>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ const Suggestion: FunctionComponent<SuggestionProps> = ({
<>
<Title name={name} version={version} />

{body && <Text fontSize="xs">{body}</Text>}
{body ? <Text fontSize="xs">{body}</Text> : null}
<HStack marginTop="4px">
{tags.map((tag) => (
<VersionTag key={tag} value={tag} />
Expand Down
4 changes: 2 additions & 2 deletions src/components/theme/ButtonExpandBox.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,9 @@ const ButtonExpandBox = forwardRef<ButtonExpandBoxProps, "div">(
{...props}
ref={ref}
>
{isExpanded && (
{isExpanded ? (
<BorderBox overflow="auto">{children}</BorderBox>
)}
) : null}

<Tooltip label={buttonLabel}>
<Button
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ const CollapsableBorderBox = forwardRef<CollapsableBorderBoxProps, "div">(
>
{header}
</CollapsableBorderBoxHeader>
{isExpanded && <Box overflow="auto">{children}</Box>}
{isExpanded ? <Box overflow="auto">{children}</Box> : null}
</BorderBox>
);
},
Expand Down

1 comment on commit 977b1d0

@vercel
Copy link

@vercel vercel bot commented on 977b1d0 Oct 31, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.