From 22116f29421e157080fe7ceb78488ee4b4421ee1 Mon Sep 17 00:00:00 2001 From: Zachary Belford Date: Thu, 28 Nov 2024 17:18:34 -0800 Subject: [PATCH 1/6] fix(inspector): fix eslint errors in TransportDropdown - Add key props to mapped MenuItem components\n- Escape quotes in Typography component\n- Remove unused index variables in map functions --- .../inspector/src/components/TransportDropdown.tsx | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/packages/inspector/src/components/TransportDropdown.tsx b/packages/inspector/src/components/TransportDropdown.tsx index 6313ba4..a6e8b98 100644 --- a/packages/inspector/src/components/TransportDropdown.tsx +++ b/packages/inspector/src/components/TransportDropdown.tsx @@ -71,8 +71,8 @@ const TransportDropdown: React.FC = ({ selectedTransport, transports, on style={{ padding: "30px", paddingTop: "10px", paddingBottom: "10px", marginTop: "10px" }}> Custom Transport Plugin - Transport plugins are created by implementing the "connect", - "sendData", and "close" methods over JSON-RPC. + Transport plugins are created by implementing the "connect", + "sendData", and "close" methods over JSON-RPC. @@ -122,8 +122,9 @@ const TransportDropdown: React.FC = ({ 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) => ( handleCustomTransportDialogMenuItemClick(transport)} >{transport.name} ))} @@ -153,8 +154,8 @@ const TransportDropdown: React.FC = ({ selectedTransport, transports, on open={Boolean(anchorEl)} onClose={handleClose} > - {transports.map((transport, i) => ( - handleMenuItemClick(transport)}>{transport.name} + {transports.map((transport) => ( + handleMenuItemClick(transport)}>{transport.name} ))} setDialogOpen(true)}> Add Transport From 686aaf0e82b8340626c49780d31a98e8a9ec314d Mon Sep 17 00:00:00 2001 From: Zachary Belford Date: Thu, 28 Nov 2024 17:19:40 -0800 Subject: [PATCH 2/6] fix(inspector): fix eslint errors in Inspector - Replace empty object type with Record\n- Add key props to ListItem and Tab components in map functions --- .../inspector/src/containers/Inspector.tsx | 69 ++++++++++--------- 1 file changed, 38 insertions(+), 31 deletions(-) diff --git a/packages/inspector/src/containers/Inspector.tsx b/packages/inspector/src/containers/Inspector.tsx index 624524e..fc6655f 100644 --- a/packages/inspector/src/containers/Inspector.tsx +++ b/packages/inspector/src/containers/Inspector.tsx @@ -382,7 +382,7 @@ const Inspector: React.FC = (props) => { // eslint-disable-next-line react-hooks/exhaustive-deps }, [historyOpen]); - const handleTabIndexChange = (event: React.ChangeEvent<{}>, newValue: number) => { + const handleTabIndexChange = (event: React.ChangeEvent>, newValue: number) => { setTabIndex(newValue); }; @@ -429,7 +429,9 @@ const Inspector: React.FC = (props) => { : {requestHistory.map((requestHistoryItem: any, historyIndex: number) => ( - setHistorySelectedIndex(historyIndex)} selected={historyIndex === historySelectedIndex}> = (props) => { onChange={handleTabIndexChange} > {tabs.map((tab, index) => ( - setTabEditing(tab, true)} label={ -
- {tab.editing - ? handleLabelChange(ev, tab)} - onBlur={() => setTabEditing(tab, false)} - autoFocus - style={{ maxWidth: "80px", marginRight: "25px" }} - /> - : {tab.name} - } - {tabIndex === index - ? - - handleClose(ev, index) - } style={{ position: "absolute", right: "10px", top: "25%" }} size="small"> - - - - : null - } -
- }>
+ setTabEditing(tab, true)} + label={ +
+ {tab.editing + ? handleLabelChange(ev, tab)} + onBlur={() => setTabEditing(tab, false)} + autoFocus + style={{ maxWidth: "80px", marginRight: "25px" }} + /> + : {tab.name} + } + {tabIndex === index + ? + + handleClose(ev, index) + } style={{ position: "absolute", right: "10px", top: "25%" }} size="small"> + + + + : null + } +
+ }>
))} From 3ca5cd444d56f04ea8c823f716fbd8337a7ae9e7 Mon Sep 17 00:00:00 2001 From: Zachary Belford Date: Thu, 28 Nov 2024 17:21:51 -0800 Subject: [PATCH 3/6] fix(inspector): fix eslint errors in useTabs Replace empty object type with Record in handleClose event type --- packages/inspector/src/hooks/useTabs.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/inspector/src/hooks/useTabs.ts b/packages/inspector/src/hooks/useTabs.ts index c89e759..1fe7237 100644 --- a/packages/inspector/src/hooks/useTabs.ts +++ b/packages/inspector/src/hooks/useTabs.ts @@ -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>, index: number) => { if (tabs.length === 1) { return; } From 4cab202df1241fca2152887b7a10cc62465e0163 Mon Sep 17 00:00:00 2001 From: Zachary Belford Date: Thu, 28 Nov 2024 17:24:53 -0800 Subject: [PATCH 4/6] fix(playground): fix eslint errors in TransportDropdown - Add key props to mapped MenuItem components\n- Escape quotes in Typography component\n- Remove unused index variables in map functions --- .../playground/src/components/TransportDropdown.tsx | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/packages/playground/src/components/TransportDropdown.tsx b/packages/playground/src/components/TransportDropdown.tsx index 2a006b4..3ebdf9a 100644 --- a/packages/playground/src/components/TransportDropdown.tsx +++ b/packages/playground/src/components/TransportDropdown.tsx @@ -74,8 +74,8 @@ const TransportDropdown: React.FC = ({ selectedTransport, transports, on style={{ padding: "30px", paddingTop: "10px", paddingBottom: "10px", marginTop: "10px" }}> Custom Transport Plugin - Transport plugins are created by implementing the "connect", - "sendData", and "close" methods over JSON-RPC. + Transport plugins are created by implementing the "connect", + "sendData", and "close" methods over JSON-RPC. @@ -125,8 +125,9 @@ const TransportDropdown: React.FC = ({ 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) => ( handleCustomTransportDialogMenuItemClick(transport)} >{transport.name} ))} @@ -156,8 +157,8 @@ const TransportDropdown: React.FC = ({ selectedTransport, transports, on open={Boolean(anchorEl)} onClose={handleClose} > - {transports && transports.map((transport, i) => ( - handleMenuItemClick(transport)}>{transport.name} + {transports && transports.map((transport) => ( + handleMenuItemClick(transport)}>{transport.name} ))} setDialogOpen(true)}> Add Transport From 1ceff2e2833a63cdda60af1d0970fcadbf4ec53f Mon Sep 17 00:00:00 2001 From: Zachary Belford Date: Thu, 28 Nov 2024 17:25:41 -0800 Subject: [PATCH 5/6] fix(playground): fix eslint errors in App Replace empty object type with Record in editor state --- packages/playground/src/App.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/playground/src/App.tsx b/packages/playground/src/App.tsx index 89cddd8..4bf7dc4 100644 --- a/packages/playground/src/App.tsx +++ b/packages/playground/src/App.tsx @@ -37,7 +37,7 @@ const App: React.FC = () => { const [error, setError] = useState(); const [notification, setNotification] = useState(); const [UISchema, setUISchemaBySection]: [IUISchema, any] = UISchemaStore(); - const [editor, setEditor]: [any, Dispatch<{}>] = useState(); + const [editor, setEditor]: [any, Dispatch>] = useState(); const [horizontalSplit, privateSetHorizontalSplit] = useState(false); const [parsedSchema, setParsedSchema] = useParsedSchema( defaultValue ? JSON.parse(defaultValue) : null, From 3427b53573eb7242acecf3a336d734ecc7cf05c5 Mon Sep 17 00:00:00 2001 From: Zachary Belford Date: Thu, 28 Nov 2024 17:26:48 -0800 Subject: [PATCH 6/6] fix(playground): fix eslint errors in ExampleDocumentsDropdown - Add key prop to MenuItem component\n- Remove unused event parameter from onClick handler --- .../src/ExampleDocumentsDropdown/ExampleDocumentsDropdown.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/playground/src/ExampleDocumentsDropdown/ExampleDocumentsDropdown.tsx b/packages/playground/src/ExampleDocumentsDropdown/ExampleDocumentsDropdown.tsx index 996168c..f5b1774 100644 --- a/packages/playground/src/ExampleDocumentsDropdown/ExampleDocumentsDropdown.tsx +++ b/packages/playground/src/ExampleDocumentsDropdown/ExampleDocumentsDropdown.tsx @@ -57,7 +57,7 @@ const ExampleDocumentsDropdown: React.FC = ({ examples, onChange }) => { >
{examples.map((example: any) => ( - handleMenuItemClick(example)}> + handleMenuItemClick(example)}> {example.name}