mirror of
https://github.com/mountain-loop/yaak.git
synced 2026-03-21 17:09:09 +01:00
Fix all lint errors
This commit is contained in:
@@ -19,6 +19,7 @@ module.exports = {
|
||||
'src-tauri/**/*',
|
||||
'plugins/**/*',
|
||||
'tailwind.config.cjs',
|
||||
'vite.config.ts',
|
||||
],
|
||||
settings: {
|
||||
react: {
|
||||
|
||||
2
package-lock.json
generated
2
package-lock.json
generated
@@ -89,7 +89,7 @@
|
||||
"react-devtools": "^5.3.1",
|
||||
"rimraf": "^6.0.1",
|
||||
"tailwindcss": "^3.4.10",
|
||||
"typescript": "^5.6.2",
|
||||
"typescript": "^5.6.0",
|
||||
"vite": "^5.4.4",
|
||||
"vite-plugin-static-copy": "^1.0.6",
|
||||
"vite-plugin-svgr": "^4.2.0",
|
||||
|
||||
@@ -108,7 +108,7 @@
|
||||
"react-devtools": "^5.3.1",
|
||||
"rimraf": "^6.0.1",
|
||||
"tailwindcss": "^3.4.10",
|
||||
"typescript": "^5.6.2",
|
||||
"typescript": "^5.6.0",
|
||||
"vite": "^5.4.4",
|
||||
"vite-plugin-static-copy": "^1.0.6",
|
||||
"vite-plugin-svgr": "^4.2.0",
|
||||
|
||||
@@ -20,6 +20,6 @@
|
||||
"npm-run-all": "^4.1.5",
|
||||
"ts-node": "^10.9.2",
|
||||
"ts-proto": "^2.2.0",
|
||||
"typescript": "^5.6.2"
|
||||
"typescript": "^5.6.0"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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] }))}
|
||||
|
||||
@@ -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.
|
||||
|
||||
@@ -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>,
|
||||
],
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
@@ -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">
|
||||
|
||||
@@ -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',
|
||||
|
||||
@@ -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 (
|
||||
|
||||
@@ -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
|
||||
}
|
||||
|
||||
|
||||
@@ -47,11 +47,10 @@ export function useGrpc(
|
||||
});
|
||||
|
||||
const debouncedUrl = useDebouncedValue<string>(req?.url ?? '', 1000);
|
||||
const debouncedMessage = useDebouncedValue<string>(req?.message ?? '', 1000);
|
||||
|
||||
const reflect = useQuery<ReflectResponseService[], string>({
|
||||
enabled: req != null,
|
||||
queryKey: ['grpc_reflect', req?.id ?? 'n/a', debouncedUrl, debouncedMessage, protoFiles],
|
||||
queryKey: ['grpc_reflect', req?.id ?? 'n/a', debouncedUrl, protoFiles],
|
||||
queryFn: async () =>
|
||||
(await minPromiseMillis(
|
||||
invokeCmd('cmd_grpc_reflect', { requestId, protoFiles }),
|
||||
|
||||
@@ -14,8 +14,7 @@ export function keyValueQueryKey({
|
||||
return ['key_value', { namespace, key: buildKeyValueKey(key) }];
|
||||
}
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/ban-types
|
||||
export function useKeyValue<T extends Object | null>({
|
||||
export function useKeyValue<T extends object | boolean | number | string | null>({
|
||||
namespace = DEFAULT_NAMESPACE,
|
||||
key,
|
||||
fallback,
|
||||
|
||||
@@ -19,7 +19,8 @@ export function isJSON(text: string): boolean {
|
||||
try {
|
||||
JSON.parse(text);
|
||||
return true;
|
||||
} catch (_) {
|
||||
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
||||
} catch (err) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -8,7 +8,8 @@ export function tryFormatJson(text: string, pretty = true): string {
|
||||
try {
|
||||
if (pretty) return JSON.stringify(JSON.parse(text), null, INDENT);
|
||||
else return JSON.stringify(JSON.parse(text));
|
||||
} catch (_) {
|
||||
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
||||
} catch (err) {
|
||||
return text;
|
||||
}
|
||||
}
|
||||
@@ -18,7 +19,8 @@ export function tryFormatXml(text: string): string {
|
||||
|
||||
try {
|
||||
return xmlFormat(text, { throwOnFailure: true, strictMode: false, indentation: INDENT });
|
||||
} catch (_) {
|
||||
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
||||
} catch (err) {
|
||||
return text;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -49,6 +49,7 @@ export function extractKeyValue<T>(kv: KeyValue | null): T | undefined {
|
||||
try {
|
||||
return JSON.parse(kv.value) as T;
|
||||
} catch (err) {
|
||||
console.log('Failed to parse kv value', kv.value, err);
|
||||
return undefined;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -9,7 +9,8 @@ export async function getResponseBodyText(response: HttpResponse): Promise<strin
|
||||
|
||||
try {
|
||||
return new TextDecoder(charset ?? 'utf-8', { fatal: true }).decode(bytes);
|
||||
} catch (_) {
|
||||
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
||||
} catch (err) {
|
||||
// Failed to decode as text, so return null
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -20,7 +20,6 @@
|
||||
"include": [
|
||||
"src-web",
|
||||
"src-web/modules.d.ts",
|
||||
"vite.config.ts"
|
||||
],
|
||||
"references": [{ "path": "./tsconfig.node.json" }]
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user