Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix linting playground #11

Merged
merged 6 commits into from
Nov 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 6 additions & 5 deletions packages/inspector/src/components/TransportDropdown.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,8 @@ const TransportDropdown: React.FC<IProps> = ({ selectedTransport, transports, on
style={{ padding: "30px", paddingTop: "10px", paddingBottom: "10px", marginTop: "10px" }}>
<Typography variant="h6">Custom Transport Plugin</Typography>
<Typography variant="caption" gutterBottom>
Transport plugins are created by implementing the "connect",
"sendData", and "close" methods over JSON-RPC.
Transport plugins are created by implementing the &quot;connect&quot;,
&quot;sendData&quot;, and &quot;close&quot; methods over JSON-RPC.
</Typography>
<Grid container direction="column" spacing={1}>
<Grid item>
Expand Down Expand Up @@ -122,8 +122,9 @@ const TransportDropdown: React.FC<IProps> = ({ selectedTransport, transports, on
open={Boolean(dialogMenuAnchorEl)}
onClose={handleDialogAnchorClose}
>
{transports.filter((value) => value.type !== "plugin").map((transport, i) => (
{transports.filter((value) => value.type !== "plugin").map((transport) => (
<MenuItem
key={transport.name}
onClick={() => handleCustomTransportDialogMenuItemClick(transport)}
>{transport.name}</MenuItem>
))}
Expand Down Expand Up @@ -153,8 +154,8 @@ const TransportDropdown: React.FC<IProps> = ({ selectedTransport, transports, on
open={Boolean(anchorEl)}
onClose={handleClose}
>
{transports.map((transport, i) => (
<MenuItem onClick={() => handleMenuItemClick(transport)}>{transport.name}</MenuItem>
{transports.map((transport) => (
<MenuItem key={transport.name} onClick={() => handleMenuItemClick(transport)}>{transport.name}</MenuItem>
))}
<MenuItem onClick={() => setDialogOpen(true)}>
<PlusIcon style={{ marginRight: "5px" }} /><Typography variant="caption">Add Transport</Typography>
Expand Down
69 changes: 38 additions & 31 deletions packages/inspector/src/containers/Inspector.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -382,7 +382,7 @@ const Inspector: React.FC<IProps> = (props) => {
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [historyOpen]);

const handleTabIndexChange = (event: React.ChangeEvent<{}>, newValue: number) => {
const handleTabIndexChange = (event: React.ChangeEvent<Record<string, never>>, newValue: number) => {
setTabIndex(newValue);
};

Expand Down Expand Up @@ -429,7 +429,9 @@ const Inspector: React.FC<IProps> = (props) => {
: <Grid container style={{ paddingBottom: "30px" }}>
<List style={{ padding: "10px", overflowY: "scroll", height: "250px", width: "200px" }}>
{requestHistory.map((requestHistoryItem: any, historyIndex: number) => (
<ListItem button
<ListItem
key={`history-${historyIndex}`}
button
onClick={() => setHistorySelectedIndex(historyIndex)}
selected={historyIndex === historySelectedIndex}>
<ListItemText
Expand Down Expand Up @@ -466,35 +468,40 @@ const Inspector: React.FC<IProps> = (props) => {
onChange={handleTabIndexChange}
>
{tabs.map((tab, index) => (
<Tab disableRipple style={{
border: "none",
outline: "none",
userSelect: "none",
}} onDoubleClick={() => setTabEditing(tab, true)} label={
<div style={{ userSelect: "none" }}>
{tab.editing
? <InputBase
value={tab.name}
onChange={(ev) => handleLabelChange(ev, tab)}
onBlur={() => setTabEditing(tab, false)}
autoFocus
style={{ maxWidth: "80px", marginRight: "25px" }}
/>
: <Typography style={{ display: "inline", textTransform: "none", marginRight: "25px" }} variant="body1" >{tab.name}</Typography>
}
{tabIndex === index
?
<Tooltip title="Close Tab">
<IconButton onClick={
(ev) => handleClose(ev, index)
} style={{ position: "absolute", right: "10px", top: "25%" }} size="small">
<CloseIcon />
</IconButton>
</Tooltip>
: null
}
</div>
}></Tab>
<Tab
key={`tab-${index}`}
disableRipple
style={{
border: "none",
outline: "none",
userSelect: "none",
}}
onDoubleClick={() => setTabEditing(tab, true)}
label={
<div style={{ userSelect: "none" }}>
{tab.editing
? <InputBase
value={tab.name}
onChange={(ev) => handleLabelChange(ev, tab)}
onBlur={() => setTabEditing(tab, false)}
autoFocus
style={{ maxWidth: "80px", marginRight: "25px" }}
/>
: <Typography style={{ display: "inline", textTransform: "none", marginRight: "25px" }} variant="body1" >{tab.name}</Typography>
}
{tabIndex === index
?
<Tooltip title="Close Tab">
<IconButton onClick={
(ev) => handleClose(ev, index)
} style={{ position: "absolute", right: "10px", top: "25%" }} size="small">
<CloseIcon />
</IconButton>
</Tooltip>
: null
}
</div>
}></Tab>
))}
<Tab disableRipple style={{ minWidth: "50px" }} label={
<Tooltip title="Create New Tab">
Expand Down
2 changes: 1 addition & 1 deletion packages/inspector/src/hooks/useTabs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ const useTabs = (defaultTabs?: ITab[]) => {
defaultTabs || [{ name: "New Tab", content: emptyJSONRPC, url: undefined, logs: [] }],
);

const handleClose = (event: React.MouseEvent<{}>, index: number) => {
const handleClose = (event: React.MouseEvent<Record<string, never>>, index: number) => {
if (tabs.length === 1) {
return;
}
Expand Down
2 changes: 1 addition & 1 deletion packages/playground/src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ const App: React.FC = () => {
const [error, setError] = useState<string | undefined>();
const [notification, setNotification] = useState<ISnackBarNotification | undefined>();
const [UISchema, setUISchemaBySection]: [IUISchema, any] = UISchemaStore();
const [editor, setEditor]: [any, Dispatch<{}>] = useState();
const [editor, setEditor]: [any, Dispatch<Record<string, never>>] = useState();
const [horizontalSplit, privateSetHorizontalSplit] = useState(false);
const [parsedSchema, setParsedSchema] = useParsedSchema(
defaultValue ? JSON.parse(defaultValue) : null,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ const ExampleDocumentsDropdown: React.FC<IProps> = ({ examples, onChange }) => {
>
<div style={{ maxWidth: "525px" }}>
{examples.map((example: any) => (
<MenuItem onClick={(event) => handleMenuItemClick(example)}>
<MenuItem key={example.name} onClick={() => handleMenuItemClick(example)}>
<Grid container spacing={0}>
<Grid item xs={12}>
<Typography variant="subtitle1">{example.name}</Typography>
Expand Down
11 changes: 6 additions & 5 deletions packages/playground/src/components/TransportDropdown.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -74,8 +74,8 @@ const TransportDropdown: React.FC<IProps> = ({ selectedTransport, transports, on
style={{ padding: "30px", paddingTop: "10px", paddingBottom: "10px", marginTop: "10px" }}>
<Typography variant="h6">Custom Transport Plugin</Typography>
<Typography variant="caption" gutterBottom>
Transport plugins are created by implementing the "connect",
"sendData", and "close" methods over JSON-RPC.
Transport plugins are created by implementing the &quot;connect&quot;,
&quot;sendData&quot;, and &quot;close&quot; methods over JSON-RPC.
</Typography>
<Grid container direction="column" spacing={1}>
<Grid item>
Expand Down Expand Up @@ -125,8 +125,9 @@ const TransportDropdown: React.FC<IProps> = ({ selectedTransport, transports, on
open={Boolean(dialogMenuAnchorEl)}
onClose={handleDialogAnchorClose}
>
{transports && transports.filter((value) => value.type !== "plugin").map((transport, i) => (
{transports && transports.filter((value) => value.type !== "plugin").map((transport) => (
<MenuItem
key={transport.name}
onClick={() => handleCustomTransportDialogMenuItemClick(transport)}
>{transport.name}</MenuItem>
))}
Expand Down Expand Up @@ -156,8 +157,8 @@ const TransportDropdown: React.FC<IProps> = ({ selectedTransport, transports, on
open={Boolean(anchorEl)}
onClose={handleClose}
>
{transports && transports.map((transport, i) => (
<MenuItem onClick={() => handleMenuItemClick(transport)}>{transport.name}</MenuItem>
{transports && transports.map((transport) => (
<MenuItem key={transport.name} onClick={() => handleMenuItemClick(transport)}>{transport.name}</MenuItem>
))}
<MenuItem onClick={() => setDialogOpen(true)}>
<PlusIcon style={{ marginRight: "5px" }} /><Typography variant="caption">Add Transport</Typography>
Expand Down
Loading