Skip to content

Commit b254699

Browse files
committed
lint
1 parent 505f24b commit b254699

File tree

6 files changed

+57
-55
lines changed

6 files changed

+57
-55
lines changed

site/src/@types/emotion.d.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import type { Theme as MuiTheme } from "@mui/material/styles";
2-
import type { NewTheme } from "theme/experimental";
32

43
declare module "@emotion/react" {
54
interface Theme extends MuiTheme {}

site/src/components/Filter/filter.tsx

Lines changed: 29 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
/* eslint-disable eslint-comments/no-unlimited-disable -- no u */
2-
/* eslint-disable -- no u */
31
import TextField from "@mui/material/TextField";
42
import Button, { type ButtonProps } from "@mui/material/Button";
53
import Menu, { type MenuProps } from "@mui/material/Menu";
@@ -126,24 +124,29 @@ const stringifyFilter = (filterValue: FilterValues): string => {
126124
return result.trim();
127125
};
128126

129-
const BaseSkeleton = (props: SkeletonProps) => {
127+
const BaseSkeleton: FC<SkeletonProps> = ({ children, ...skeltonProps }) => {
130128
return (
131129
<Skeleton
132130
variant="rectangular"
133131
height={36}
134-
{...props}
132+
{...skeltonProps}
135133
css={(theme) => ({
136134
backgroundColor: theme.palette.background.paperLight,
137135
borderRadius: "6px",
138136
})}
139-
/>
137+
>
138+
{children}
139+
</Skeleton>
140140
);
141141
};
142142

143-
export const SearchFieldSkeleton = () => <BaseSkeleton width="100%" />;
144-
export const MenuSkeleton = () => (
145-
<BaseSkeleton css={{ minWidth: 200, flexShrink: 0 }} />
146-
);
143+
export const SearchFieldSkeleton: FC = () => {
144+
return <BaseSkeleton width="100%" />;
145+
};
146+
147+
export const MenuSkeleton: FC = () => {
148+
return <BaseSkeleton css={{ minWidth: 200, flexShrink: 0 }} />;
149+
};
147150

148151
type FilterProps = {
149152
filter: ReturnType<typeof useFilter>;
@@ -551,18 +554,21 @@ const MenuButton = forwardRef<HTMLButtonElement, ButtonProps>((props, ref) => {
551554
);
552555
});
553556

554-
function SearchMenu<TOption extends { label: string; value: string }>({
557+
interface SearchMenuProps<TOption extends BaseOption>
558+
extends Pick<MenuProps, "anchorEl" | "open" | "onClose" | "id"> {
559+
options?: TOption[];
560+
renderOption: (option: TOption) => ReactNode;
561+
query: string;
562+
onQueryChange: (query: string) => void;
563+
}
564+
565+
function SearchMenu<TOption extends BaseOption>({
555566
options,
556567
renderOption,
557568
query,
558569
onQueryChange,
559570
...menuProps
560-
}: Pick<MenuProps, "anchorEl" | "open" | "onClose" | "id"> & {
561-
options?: TOption[];
562-
renderOption: (option: TOption) => ReactNode;
563-
query: string;
564-
onQueryChange: (query: string) => void;
565-
}) {
571+
}: SearchMenuProps<TOption>) {
566572
const menuListRef = useRef<HTMLUListElement>(null);
567573
const searchInputRef = useRef<HTMLInputElement>(null);
568574
const theme = useTheme();
@@ -587,6 +593,13 @@ function SearchMenu<TOption extends { label: string; value: string }>({
587593
enter: 250,
588594
exit: 0,
589595
}}
596+
onKeyDown={(e) => {
597+
e.stopPropagation();
598+
if (e.key === "ArrowDown" && menuListRef.current) {
599+
const firstItem = menuListRef.current.firstChild as HTMLElement;
600+
firstItem.focus();
601+
}
602+
}}
590603
>
591604
<li
592605
css={{
@@ -596,14 +609,6 @@ function SearchMenu<TOption extends { label: string; value: string }>({
596609
height: 40,
597610
borderBottom: `1px solid ${theme.palette.divider}`,
598611
}}
599-
// eslint-disable-next-line jsx-a11y/no-noninteractive-element-interactions -- try to figure out if we actually need this
600-
onKeyDown={(e) => {
601-
e.stopPropagation();
602-
if (e.key === "ArrowDown" && menuListRef.current) {
603-
const firstItem = menuListRef.current.firstChild as HTMLElement;
604-
firstItem.focus();
605-
}
606-
}}
607612
>
608613
<SearchOutlined
609614
css={{

site/src/components/GlobalSnackbar/EnterpriseSnackbar.tsx

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import IconButton from "@mui/material/IconButton";
22
import Snackbar, {
3-
SnackbarProps as MuiSnackbarProps,
3+
type SnackbarProps as MuiSnackbarProps,
44
} from "@mui/material/Snackbar";
55
import CloseIcon from "@mui/icons-material/Close";
66
import { type FC } from "react";
@@ -35,7 +35,7 @@ export const EnterpriseSnackbar: FC<EnterpriseSnackbarProps> = ({
3535
action,
3636
...snackbarProps
3737
}) => {
38-
const content = useClassName(classNames.content({ variant }), [variant]);
38+
const content = useClassName(classNames.content(variant), [variant]);
3939

4040
return (
4141
<Snackbar
@@ -74,13 +74,9 @@ const variantColor = (variant: EnterpriseSnackbarVariant, theme: Theme) => {
7474
}
7575
};
7676

77-
interface StyleOptions {
78-
variant: EnterpriseSnackbarVariant;
79-
}
80-
8177
const classNames = {
8278
content:
83-
({ variant }) =>
79+
(variant: EnterpriseSnackbarVariant): ClassName =>
8480
(css, theme) => css`
8581
border: 1px solid ${theme.palette.divider};
8682
border-left: 4px solid ${variantColor(variant, theme)};
@@ -91,7 +87,7 @@ const classNames = {
9187
background-color: ${theme.palette.background.paper};
9288
color: ${theme.palette.text.secondary};
9389
`,
94-
} satisfies Record<string, (options: StyleOptions) => ClassName>;
90+
};
9591

9692
const styles = {
9793
actionWrapper: {

site/src/components/Resources/PortForwardButton.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import Button from "@mui/material/Button";
12
import Link from "@mui/material/Link";
23
import CircularProgress from "@mui/material/CircularProgress";
34
import OpenInNewOutlined from "@mui/icons-material/OpenInNewOutlined";
@@ -25,7 +26,6 @@ import {
2526
PopoverContent,
2627
PopoverTrigger,
2728
} from "components/Popover/Popover";
28-
import { Button } from "@mui/material";
2929

3030
export interface PortForwardButtonProps {
3131
host: string;

site/src/components/TableToolbar/TableToolbar.tsx

Lines changed: 22 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,26 @@
1-
import { styled } from "@mui/material/styles";
2-
import Box from "@mui/material/Box";
31
import Skeleton from "@mui/material/Skeleton";
4-
import { type FC } from "react";
5-
6-
export const TableToolbar = styled(Box)(({ theme }) => ({
7-
fontSize: 13,
8-
marginBottom: "8px",
9-
marginTop: 0,
10-
height: "36px", // The size of a small button
11-
color: theme.palette.text.secondary,
12-
display: "flex",
13-
alignItems: "center",
14-
"& strong": {
15-
color: theme.palette.text.primary,
16-
},
17-
}));
2+
import { type FC, type PropsWithChildren } from "react";
3+
4+
export const TableToolbar: FC<PropsWithChildren> = ({ children }) => {
5+
return (
6+
<div
7+
css={(theme) => ({
8+
fontSize: 13,
9+
marginBottom: "8px",
10+
marginTop: 0,
11+
height: "36px", // The size of a small button
12+
color: theme.palette.text.secondary,
13+
display: "flex",
14+
alignItems: "center",
15+
"& strong": {
16+
color: theme.palette.text.primary,
17+
},
18+
})}
19+
>
20+
{children}
21+
</div>
22+
);
23+
};
1824

1925
type PaginationStatusProps =
2026
| BasePaginationStatusProps

site/src/pages/WorkspacesPage/WorkspacesSearchBox.tsx

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,3 @@
1-
/* eslint-disable eslint-comments/no-unlimited-disable -- no u */
2-
/* eslint-disable -- no u */
3-
41
/**
52
* @file Defines a controlled searchbox component for processing form state.
63
*
@@ -52,8 +49,6 @@ export const SearchBox = forwardRef(function SearchBox(
5249
height: "40px",
5350
borderBottom: `1px solid ${theme.palette.divider}`,
5451
}}
55-
// eslint-disable-next-line jsx-a11y/no-noninteractive-element-interactions -- try to figure out if we actually need this
56-
onKeyDown={onKeyDown}
5752
>
5853
<div css={{ width: 18 }}>
5954
<SearchIcon
@@ -78,6 +73,7 @@ export const SearchBox = forwardRef(function SearchBox(
7873
tabIndex={0}
7974
placeholder={placeholder}
8075
{...attrs}
76+
onKeyDown={onKeyDown}
8177
onChange={(e) => onValueChange(e.target.value)}
8278
css={{
8379
height: "100%",

0 commit comments

Comments
 (0)