Null instead of empty fragments

This commit is contained in:
Dustin Brett
2022-11-21 21:19:22 -08:00
parent e10e57629a
commit dba80fbc2b
7 changed files with 11 additions and 13 deletions

View File

@@ -114,7 +114,6 @@
"react/hook-use-state": "error",
"react-hooks/exhaustive-deps": "error",
"react/jsx-filename-extension": ["error", { "extensions": [".tsx"] }],
"react/jsx-no-useless-fragment": "off",
"react/jsx-props-no-spreading": "off",
"react/jsx-sort-props": [
"error",

View File

@@ -81,9 +81,8 @@ const FileExplorer: FC<ComponentProcessProps> = ({ id }) => {
<Navigation hideSearch={isMounted} id={id} />
<FileManager id={id} url={url} view="icon" showStatusBar />
</StyledFileExplorer>
) : (
<></>
);
) : // eslint-disable-next-line unicorn/no-null
null;
};
export default FileExplorer;

View File

@@ -133,9 +133,8 @@ const Menu: FC<MenuProps> = ({ subMenu }) => {
))}
</ol>
</StyledMenu>
) : (
<></>
);
) : // eslint-disable-next-line unicorn/no-null
null;
};
export default Menu;

View File

@@ -156,7 +156,8 @@ const Clock: FC = () => {
}
}, [currentWorker, supportsOffscreenCanvas]);
if (!time) return <></>;
// eslint-disable-next-line unicorn/no-null
if (!time) return null;
return (
<StyledClock

View File

@@ -65,9 +65,8 @@ const PeekWindow: FC<PeekWindowProps> = ({ id }) => {
<CloseIcon />
</Button>
</StyledPeekWindow>
) : (
<></>
);
) : // eslint-disable-next-line unicorn/no-null
null;
};
export default PeekWindow;

View File

@@ -117,7 +117,8 @@ const Icon = forwardRef<
failedUrls.length > 0 &&
failedUrls.includes(srcSet.split(" ")[0])
) {
return <></>;
// eslint-disable-next-line unicorn/no-null
return null;
}
return (

2
utils/types.d.ts vendored
View File

@@ -4,7 +4,7 @@
type FC<TProps = Record<string, unknown>> = (
props: React.PropsWithChildren<TProps>
) => JSX.Element;
) => JSX.Element | null;
type HTMLElementWithPriority<T> = T & {
fetchPriority?: "auto" | "high" | "low";