Fix all lint errors

This commit is contained in:
Gregory Schier
2024-09-16 08:36:02 -07:00
parent 974ecd511d
commit 2951023ee8
19 changed files with 43 additions and 34 deletions

View File

@@ -89,6 +89,7 @@ export function ExportDataDialog({
}
/>
</td>
{/* eslint-disable-next-line jsx-a11y/no-noninteractive-element-interactions,jsx-a11y/click-events-have-key-events */}
<td
className="py-1 pl-4 text whitespace-nowrap overflow-x-auto hide-scrollbars"
onClick={() => setSelectedWorkspaces((prev) => ({ ...prev, [w.id]: !prev[w.id] }))}

View File

@@ -37,6 +37,7 @@ export function GraphQLEditor({ defaultValue, onChange, baseRequest, ...extraEdi
const variables = p.variables;
const operationName = p.operationName;
return { query, variables, operationName };
// eslint-disable-next-line @typescript-eslint/no-unused-vars
} catch (err) {
return { query: '' };
}
@@ -46,6 +47,7 @@ export function GraphQLEditor({ defaultValue, onChange, baseRequest, ...extraEdi
(b: GraphQLBody) => {
try {
onChange?.(JSON.stringify(b, null, 2));
// eslint-disable-next-line @typescript-eslint/no-unused-vars
} catch (err) {
// Meh, not much we can do here
}
@@ -62,6 +64,7 @@ export function GraphQLEditor({ defaultValue, onChange, baseRequest, ...extraEdi
(variables: string) => {
try {
handleChange({ query, variables: JSON.parse(variables || '{}') });
// eslint-disable-next-line @typescript-eslint/no-unused-vars
} catch (err) {
// Don't do anything if invalid JSON. The user probably hasn't finished
// typing yet.

View File

@@ -6,8 +6,10 @@ import {
handleRefresh,
jsonCompletion,
jsonSchemaLinter,
updateSchema,
// eslint-disable-next-line import/named
stateExtensions,
// eslint-disable-next-line import/named
updateSchema,
} from 'codemirror-json-schema';
import { useEffect, useMemo, useRef } from 'react';
import { useAlert } from '../hooks/useAlert';
@@ -136,10 +138,10 @@ export function GrpcEditor({
reflectionLoading
? 'secondary'
: reflectionUnavailable
? 'info'
: reflectionError
? 'danger'
: 'secondary'
? 'info'
: reflectionError
? 'danger'
: 'secondary'
}
isLoading={reflectionLoading}
onClick={() => {
@@ -160,14 +162,14 @@ export function GrpcEditor({
{reflectionLoading
? 'Inspecting Schema'
: reflectionUnavailable
? 'Select Proto Files'
: reflectionError
? 'Server Error'
: protoFiles.length > 0
? count('File', protoFiles.length)
: services != null && protoFiles.length === 0
? 'Schema Detected'
: 'Select Schema'}
? 'Select Proto Files'
: reflectionError
? 'Server Error'
: protoFiles.length > 0
? count('File', protoFiles.length)
: services != null && protoFiles.length === 0
? 'Schema Detected'
: 'Select Schema'}
</Button>
</div>,
],

View File

@@ -40,7 +40,7 @@ export function ImportCurlButton() {
await clear(); // Clear the clipboard so the button goes away
setClipboardText('');
} catch (e) {
// Nothing
console.log('Failed to import curl', e);
} finally {
setIsLoading(false);
}

View File

@@ -88,7 +88,6 @@ export function SettingsPlugins() {
function PluginInfo({ plugin }: { plugin: Plugin }) {
const pluginInfo = usePluginInfo(plugin.id);
if (pluginInfo.data == null) return null;
return (
<tr className="group">
<td className="pr-2">

View File

@@ -243,7 +243,7 @@ export function Sidebar({ className }: Props) {
await setHidden(false);
}
// Select 0 index on focus if none selected
// Select 0th index on focus if none selected
focusActiveRequest(
selectedTree != null && selectedId != null
? { forced: { id: selectedId, tree: selectedTree } }
@@ -310,7 +310,7 @@ export function Sidebar({ className }: Props) {
let hoveredIndex = dragIndex + (side === 'above' ? 0 : 1);
if (hoveredItem?.model === 'folder' && side === 'below' && !isCollapsed(hoveredItem.id)) {
// Move into folder if it's open and we're moving below it
// Move into the folder if it's open and we're moving below it
hoveredTree = hoveredTree?.children.find((n) => n.item.id === id) ?? null;
hoveredIndex = 0;
}
@@ -814,11 +814,10 @@ function SidebarItem({
hotKeyAction: 'http_request.duplicate',
hotKeyLabelOnly: true, // Would trigger for every request (bad)
leftSlot: <Icon icon="copy" />,
onSelect: () => {
onSelect: () =>
itemModel === 'http_request'
? duplicateHttpRequest.mutate()
: duplicateGrpcRequest.mutate();
},
: duplicateGrpcRequest.mutate(),
},
{
key: 'moveWorkspace',

View File

@@ -55,7 +55,8 @@ export const UrlBar = memo(function UrlBar({
const handleSubmit = (e: FormEvent<HTMLFormElement>) => {
e.preventDefault();
isLoading ? onCancel() : onSend();
if (isLoading) onCancel();
else onSend();
};
return (

View File

@@ -16,7 +16,8 @@ export function JsonViewer({ response, className }: Props) {
let parsed = {};
try {
parsed = JSON.parse(rawBody.data);
} catch (e) {
// eslint-disable-next-line @typescript-eslint/no-unused-vars
} catch (err) {
// Nothing yet
}