From 6f1fd7a2545865a30f8ef7bc1e39a16c78a25ff9 Mon Sep 17 00:00:00 2001 From: Gregory Schier Date: Mon, 14 Jul 2025 10:09:08 -0700 Subject: [PATCH] Fix lint errors after upgrades and narrow tsc --- plugins/action-copy-curl/tsconfig.json | 3 +++ plugins/action-copy-grpcurl/tsconfig.json | 3 +++ plugins/auth-basic/tsconfig.json | 3 +++ plugins/auth-bearer/tsconfig.json | 3 +++ plugins/auth-jwt/tsconfig.json | 3 +++ plugins/auth-oauth2/tsconfig.json | 3 +++ plugins/filter-jsonpath/tsconfig.json | 3 +++ plugins/filter-xpath/src/index.ts | 3 ++- plugins/filter-xpath/tsconfig.json | 3 +++ plugins/importer-curl/tsconfig.json | 3 +++ plugins/importer-insomnia/tsconfig.json | 3 +++ plugins/importer-openapi/tsconfig.json | 3 +++ plugins/importer-postman/tsconfig.json | 3 +++ plugins/importer-yaak/tsconfig.json | 3 +++ plugins/template-function-cookie/tsconfig.json | 3 +++ plugins/template-function-encode/tsconfig.json | 3 +++ plugins/template-function-fs/tsconfig.json | 3 +++ plugins/template-function-hash/tsconfig.json | 3 +++ plugins/template-function-json/tsconfig.json | 3 +++ plugins/template-function-prompt/tsconfig.json | 3 +++ plugins/template-function-regex/tsconfig.json | 3 +++ plugins/template-function-request/tsconfig.json | 3 +++ plugins/template-function-response/src/index.ts | 3 ++- plugins/template-function-response/tsconfig.json | 3 +++ plugins/template-function-uuid/tsconfig.json | 3 +++ plugins/template-function-xml/src/index.ts | 3 ++- plugins/template-function-xml/tsconfig.json | 3 +++ plugins/themes-yaak/tsconfig.json | 3 +++ src-web/commands/openSettings.tsx | 2 +- src-web/components/core/Dropdown.tsx | 7 +++++-- src-web/components/core/Editor/Editor.tsx | 8 +++++--- src-web/components/core/HttpResponseDurationTag.tsx | 2 +- src-web/components/core/Input.tsx | 4 ++-- src-web/components/core/PlainInput.tsx | 4 ++-- src-web/components/core/Tooltip.tsx | 2 +- 35 files changed, 98 insertions(+), 15 deletions(-) create mode 100644 plugins/action-copy-curl/tsconfig.json create mode 100644 plugins/action-copy-grpcurl/tsconfig.json create mode 100644 plugins/auth-basic/tsconfig.json create mode 100644 plugins/auth-bearer/tsconfig.json create mode 100644 plugins/auth-jwt/tsconfig.json create mode 100644 plugins/auth-oauth2/tsconfig.json create mode 100644 plugins/filter-jsonpath/tsconfig.json create mode 100644 plugins/filter-xpath/tsconfig.json create mode 100644 plugins/importer-curl/tsconfig.json create mode 100644 plugins/importer-insomnia/tsconfig.json create mode 100644 plugins/importer-openapi/tsconfig.json create mode 100644 plugins/importer-postman/tsconfig.json create mode 100644 plugins/importer-yaak/tsconfig.json create mode 100644 plugins/template-function-cookie/tsconfig.json create mode 100644 plugins/template-function-encode/tsconfig.json create mode 100644 plugins/template-function-fs/tsconfig.json create mode 100644 plugins/template-function-hash/tsconfig.json create mode 100644 plugins/template-function-json/tsconfig.json create mode 100644 plugins/template-function-prompt/tsconfig.json create mode 100644 plugins/template-function-regex/tsconfig.json create mode 100644 plugins/template-function-request/tsconfig.json create mode 100644 plugins/template-function-response/tsconfig.json create mode 100644 plugins/template-function-uuid/tsconfig.json create mode 100644 plugins/template-function-xml/tsconfig.json create mode 100644 plugins/themes-yaak/tsconfig.json diff --git a/plugins/action-copy-curl/tsconfig.json b/plugins/action-copy-curl/tsconfig.json new file mode 100644 index 00000000..4082f16a --- /dev/null +++ b/plugins/action-copy-curl/tsconfig.json @@ -0,0 +1,3 @@ +{ + "extends": "../../tsconfig.json" +} diff --git a/plugins/action-copy-grpcurl/tsconfig.json b/plugins/action-copy-grpcurl/tsconfig.json new file mode 100644 index 00000000..4082f16a --- /dev/null +++ b/plugins/action-copy-grpcurl/tsconfig.json @@ -0,0 +1,3 @@ +{ + "extends": "../../tsconfig.json" +} diff --git a/plugins/auth-basic/tsconfig.json b/plugins/auth-basic/tsconfig.json new file mode 100644 index 00000000..4082f16a --- /dev/null +++ b/plugins/auth-basic/tsconfig.json @@ -0,0 +1,3 @@ +{ + "extends": "../../tsconfig.json" +} diff --git a/plugins/auth-bearer/tsconfig.json b/plugins/auth-bearer/tsconfig.json new file mode 100644 index 00000000..4082f16a --- /dev/null +++ b/plugins/auth-bearer/tsconfig.json @@ -0,0 +1,3 @@ +{ + "extends": "../../tsconfig.json" +} diff --git a/plugins/auth-jwt/tsconfig.json b/plugins/auth-jwt/tsconfig.json new file mode 100644 index 00000000..4082f16a --- /dev/null +++ b/plugins/auth-jwt/tsconfig.json @@ -0,0 +1,3 @@ +{ + "extends": "../../tsconfig.json" +} diff --git a/plugins/auth-oauth2/tsconfig.json b/plugins/auth-oauth2/tsconfig.json new file mode 100644 index 00000000..4082f16a --- /dev/null +++ b/plugins/auth-oauth2/tsconfig.json @@ -0,0 +1,3 @@ +{ + "extends": "../../tsconfig.json" +} diff --git a/plugins/filter-jsonpath/tsconfig.json b/plugins/filter-jsonpath/tsconfig.json new file mode 100644 index 00000000..4082f16a --- /dev/null +++ b/plugins/filter-jsonpath/tsconfig.json @@ -0,0 +1,3 @@ +{ + "extends": "../../tsconfig.json" +} diff --git a/plugins/filter-xpath/src/index.ts b/plugins/filter-xpath/src/index.ts index 4920d734..9a5dd4f7 100644 --- a/plugins/filter-xpath/src/index.ts +++ b/plugins/filter-xpath/src/index.ts @@ -7,7 +7,8 @@ export const plugin: PluginDefinition = { name: 'XPath', description: 'Filter XPath', onFilter(_ctx, args) { - const doc = new DOMParser().parseFromString(args.payload, 'text/xml'); + // eslint-disable-next-line @typescript-eslint/no-explicit-any + const doc: any = new DOMParser().parseFromString(args.payload, 'text/xml'); try { const result = xpath.select(args.filter, doc, false); if (Array.isArray(result)) { diff --git a/plugins/filter-xpath/tsconfig.json b/plugins/filter-xpath/tsconfig.json new file mode 100644 index 00000000..4082f16a --- /dev/null +++ b/plugins/filter-xpath/tsconfig.json @@ -0,0 +1,3 @@ +{ + "extends": "../../tsconfig.json" +} diff --git a/plugins/importer-curl/tsconfig.json b/plugins/importer-curl/tsconfig.json new file mode 100644 index 00000000..4082f16a --- /dev/null +++ b/plugins/importer-curl/tsconfig.json @@ -0,0 +1,3 @@ +{ + "extends": "../../tsconfig.json" +} diff --git a/plugins/importer-insomnia/tsconfig.json b/plugins/importer-insomnia/tsconfig.json new file mode 100644 index 00000000..4082f16a --- /dev/null +++ b/plugins/importer-insomnia/tsconfig.json @@ -0,0 +1,3 @@ +{ + "extends": "../../tsconfig.json" +} diff --git a/plugins/importer-openapi/tsconfig.json b/plugins/importer-openapi/tsconfig.json new file mode 100644 index 00000000..4082f16a --- /dev/null +++ b/plugins/importer-openapi/tsconfig.json @@ -0,0 +1,3 @@ +{ + "extends": "../../tsconfig.json" +} diff --git a/plugins/importer-postman/tsconfig.json b/plugins/importer-postman/tsconfig.json new file mode 100644 index 00000000..4082f16a --- /dev/null +++ b/plugins/importer-postman/tsconfig.json @@ -0,0 +1,3 @@ +{ + "extends": "../../tsconfig.json" +} diff --git a/plugins/importer-yaak/tsconfig.json b/plugins/importer-yaak/tsconfig.json new file mode 100644 index 00000000..4082f16a --- /dev/null +++ b/plugins/importer-yaak/tsconfig.json @@ -0,0 +1,3 @@ +{ + "extends": "../../tsconfig.json" +} diff --git a/plugins/template-function-cookie/tsconfig.json b/plugins/template-function-cookie/tsconfig.json new file mode 100644 index 00000000..4082f16a --- /dev/null +++ b/plugins/template-function-cookie/tsconfig.json @@ -0,0 +1,3 @@ +{ + "extends": "../../tsconfig.json" +} diff --git a/plugins/template-function-encode/tsconfig.json b/plugins/template-function-encode/tsconfig.json new file mode 100644 index 00000000..4082f16a --- /dev/null +++ b/plugins/template-function-encode/tsconfig.json @@ -0,0 +1,3 @@ +{ + "extends": "../../tsconfig.json" +} diff --git a/plugins/template-function-fs/tsconfig.json b/plugins/template-function-fs/tsconfig.json new file mode 100644 index 00000000..4082f16a --- /dev/null +++ b/plugins/template-function-fs/tsconfig.json @@ -0,0 +1,3 @@ +{ + "extends": "../../tsconfig.json" +} diff --git a/plugins/template-function-hash/tsconfig.json b/plugins/template-function-hash/tsconfig.json new file mode 100644 index 00000000..4082f16a --- /dev/null +++ b/plugins/template-function-hash/tsconfig.json @@ -0,0 +1,3 @@ +{ + "extends": "../../tsconfig.json" +} diff --git a/plugins/template-function-json/tsconfig.json b/plugins/template-function-json/tsconfig.json new file mode 100644 index 00000000..4082f16a --- /dev/null +++ b/plugins/template-function-json/tsconfig.json @@ -0,0 +1,3 @@ +{ + "extends": "../../tsconfig.json" +} diff --git a/plugins/template-function-prompt/tsconfig.json b/plugins/template-function-prompt/tsconfig.json new file mode 100644 index 00000000..4082f16a --- /dev/null +++ b/plugins/template-function-prompt/tsconfig.json @@ -0,0 +1,3 @@ +{ + "extends": "../../tsconfig.json" +} diff --git a/plugins/template-function-regex/tsconfig.json b/plugins/template-function-regex/tsconfig.json new file mode 100644 index 00000000..4082f16a --- /dev/null +++ b/plugins/template-function-regex/tsconfig.json @@ -0,0 +1,3 @@ +{ + "extends": "../../tsconfig.json" +} diff --git a/plugins/template-function-request/tsconfig.json b/plugins/template-function-request/tsconfig.json new file mode 100644 index 00000000..4082f16a --- /dev/null +++ b/plugins/template-function-request/tsconfig.json @@ -0,0 +1,3 @@ +{ + "extends": "../../tsconfig.json" +} diff --git a/plugins/template-function-response/src/index.ts b/plugins/template-function-response/src/index.ts index ff44c932..b2153983 100644 --- a/plugins/template-function-response/src/index.ts +++ b/plugins/template-function-response/src/index.ts @@ -159,7 +159,8 @@ function filterJSONPath(body: string, path: string): string { } function filterXPath(body: string, path: string): string { - const doc = new DOMParser().parseFromString(body, 'text/xml'); + // eslint-disable-next-line @typescript-eslint/no-explicit-any + const doc: any = new DOMParser().parseFromString(body, 'text/xml'); const items = xpath.select(path, doc, false); if (Array.isArray(items)) { diff --git a/plugins/template-function-response/tsconfig.json b/plugins/template-function-response/tsconfig.json new file mode 100644 index 00000000..4082f16a --- /dev/null +++ b/plugins/template-function-response/tsconfig.json @@ -0,0 +1,3 @@ +{ + "extends": "../../tsconfig.json" +} diff --git a/plugins/template-function-uuid/tsconfig.json b/plugins/template-function-uuid/tsconfig.json new file mode 100644 index 00000000..4082f16a --- /dev/null +++ b/plugins/template-function-uuid/tsconfig.json @@ -0,0 +1,3 @@ +{ + "extends": "../../tsconfig.json" +} diff --git a/plugins/template-function-xml/src/index.ts b/plugins/template-function-xml/src/index.ts index ce68f799..38945b9d 100755 --- a/plugins/template-function-xml/src/index.ts +++ b/plugins/template-function-xml/src/index.ts @@ -19,7 +19,8 @@ export const plugin: PluginDefinition = { ], async onRender(_ctx: Context, args: CallTemplateFunctionArgs): Promise { try { - const doc = new DOMParser().parseFromString(String(args.values.input), 'text/xml'); + // eslint-disable-next-line @typescript-eslint/no-explicit-any + const doc: any = new DOMParser().parseFromString(String(args.values.input), 'text/xml'); const result = xpath.select(String(args.values.query), doc, false); if (Array.isArray(result)) { return String(result.map((c) => String(c.firstChild))[0] ?? ''); diff --git a/plugins/template-function-xml/tsconfig.json b/plugins/template-function-xml/tsconfig.json new file mode 100644 index 00000000..4082f16a --- /dev/null +++ b/plugins/template-function-xml/tsconfig.json @@ -0,0 +1,3 @@ +{ + "extends": "../../tsconfig.json" +} diff --git a/plugins/themes-yaak/tsconfig.json b/plugins/themes-yaak/tsconfig.json new file mode 100644 index 00000000..4082f16a --- /dev/null +++ b/plugins/themes-yaak/tsconfig.json @@ -0,0 +1,3 @@ +{ + "extends": "../../tsconfig.json" +} diff --git a/src-web/commands/openSettings.tsx b/src-web/commands/openSettings.tsx index 44ed88fe..39bfc16e 100644 --- a/src-web/commands/openSettings.tsx +++ b/src-web/commands/openSettings.tsx @@ -14,7 +14,7 @@ export const openSettings = createFastMutation const location = router.buildLocation({ to: '/workspaces/$workspaceId/settings', params: { workspaceId }, - search: { tab }, + search: { tab: tab ?? undefined }, }); await invokeCmd('cmd_new_child_window', { diff --git a/src-web/components/core/Dropdown.tsx b/src-web/components/core/Dropdown.tsx index d5032d26..fbaa2a81 100644 --- a/src-web/components/core/Dropdown.tsx +++ b/src-web/components/core/Dropdown.tsx @@ -266,7 +266,7 @@ interface MenuProps { fullWidth?: boolean; isOpen: boolean; items: DropdownItem[]; - triggerRef?: RefObject; + triggerRef?: RefObject; } const Menu = forwardRef, MenuProps>( @@ -555,7 +555,10 @@ const Menu = forwardRef + {item.label} ); diff --git a/src-web/components/core/Editor/Editor.tsx b/src-web/components/core/Editor/Editor.tsx index 285a0f1c..d1db2c59 100644 --- a/src-web/components/core/Editor/Editor.tsx +++ b/src-web/components/core/Editor/Editor.tsx @@ -530,10 +530,12 @@ export const Editor = forwardRef(function E } results.push( Children.map(actions, (existingChild) => { - if (!isValidElement(existingChild)) return null; + if (!isValidElement<{ className?: string }>(existingChild)) return null; + const existingProps = existingChild.props; + return cloneElement(existingChild, { - ...existingChild.props, - className: classNames(existingChild.props.className, actionClassName), + ...existingProps, + className: classNames(existingProps.className, actionClassName), }); }), ); diff --git a/src-web/components/core/HttpResponseDurationTag.tsx b/src-web/components/core/HttpResponseDurationTag.tsx index cadb8e89..3474bb09 100644 --- a/src-web/components/core/HttpResponseDurationTag.tsx +++ b/src-web/components/core/HttpResponseDurationTag.tsx @@ -7,7 +7,7 @@ interface Props { export function HttpResponseDurationTag({ response }: Props) { const [fallbackElapsed, setFallbackElapsed] = useState(0); - const timeout = useRef(); + const timeout = useRef(undefined); // Calculate the duration of the response for use when the response hasn't finished yet useEffect(() => { diff --git a/src-web/components/core/Input.tsx b/src-web/components/core/Input.tsx index bcf6903f..741b63ad 100644 --- a/src-web/components/core/Input.tsx +++ b/src-web/components/core/Input.tsx @@ -263,8 +263,8 @@ const BaseInput = forwardRef(function InputBase( inputWrapperClassName, 'w-full min-w-0 px-2', fullHeight && 'h-full', - leftSlot && 'pl-0.5 -ml-2', - rightSlot && 'pr-0.5 -mr-2', + leftSlot ? 'pl-0.5 -ml-2' : null, + rightSlot ? 'pr-0.5 -mr-2' : null, )} > void }, PlainInputProps>(fun (); const triggerRef = useRef(null); const tooltipRef = useRef(null); - const showTimeout = useRef(); + const showTimeout = useRef(undefined); const handleOpenImmediate = () => { if (triggerRef.current == null || tooltipRef.current == null) return;