Skip to content

Commit baafed7

Browse files
committed
Fix linter issues
1 parent 009aab7 commit baafed7

File tree

10 files changed

+37
-20
lines changed

10 files changed

+37
-20
lines changed

packages/connect-react/src/components/ControlInput.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ export function ControlInput() {
5959
id={id}
6060
type={inputType}
6161
name={prop.name}
62-
value={String(value) ?? ""}
62+
value={String(value ?? "")}
6363
onChange={(e) => onChange(toOnChangeValue(e.target.value))}
6464
{...getProps("controlInput", baseStyles, formFieldContextProps)}
6565
min={min}

packages/connect-react/src/components/ControlSelect.tsx

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -88,8 +88,7 @@ export function ControlSelect<T extends PropOptionValue>({
8888
// if simple, make lv (XXX combine this with other place this happens)
8989
if (!isOptionWithLabel(rawValue[0])) {
9090
return rawValue.map((o) =>
91-
selectOptions.find((item) => item.value === o) || sanitizeOption(o as T),
92-
);
91+
selectOptions.find((item) => item.value === o) || sanitizeOption(o as T));
9392
}
9493
} else if (rawValue && typeof rawValue === "object" && "__lv" in (rawValue as Record<string, unknown>)) {
9594
// Extract the actual option from __lv wrapper and sanitize to LV

packages/connect-react/src/components/Field.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,8 +58,9 @@ export function Field<T extends ConfigurableProp>(props: FieldProps<T>) {
5858
// XXX rename to FieldErrors + add FormErrors (to ComponentFormInternal)
5959
// XXX use similar pattern as app below for boolean and checkboxing DOM re-ordering?
6060

61+
const fieldProps = props as unknown as FieldProps<ConfigurableProp>;
6162
return (
62-
<div {...getProps("field", baseStyles, props)}>
63+
<div {...getProps("field", baseStyles, fieldProps)}>
6364
<Label text={labelText} field={field} form={form} />
6465
<Control field={field} form={form} />
6566
<Description markdown={prop.description} field={field} form={form} />

packages/connect-react/src/components/InternalField.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
import type { ConfigurableProp, ConfigurablePropApp } from "@pipedream/sdk";
1+
import type {
2+
ConfigurableProp, ConfigurablePropApp,
3+
} from "@pipedream/sdk";
24
import { FormFieldContext } from "../hooks/form-field-context";
35
import { useFormContext } from "../hooks/form-context";
46
import { Field } from "./Field";

packages/connect-react/src/components/RemoteOptionsContainer.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
import type { ConfigurePropOpts, PropOptionValue } from "@pipedream/sdk";
1+
import type {
2+
ConfigurePropOpts, PropOptionValue,
3+
} from "@pipedream/sdk";
24
import { useQuery } from "@tanstack/react-query";
35
import { useState } from "react";
46
import { useFormContext } from "../hooks/form-context";

packages/connect-react/src/hooks/customization-context.tsx

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,6 @@ import { ControlSubmit } from "../components/ControlSubmit";
3939
import { Description } from "../components/Description";
4040
import { Errors } from "../components/Errors";
4141
import { Field } from "../components/Field";
42-
import type { FieldProps } from "../components/Field";
4342
import { Label } from "../components/Label";
4443
import { LoadMoreButton } from "../components/LoadMoreButton";
4544
import { OptionalFieldButton } from "../components/OptionalFieldButton";
@@ -85,8 +84,7 @@ export type CustomizableProps = {
8584
description: ComponentProps<typeof Description>;
8685
error: ComponentProps<typeof Errors>;
8786
errors: ComponentProps<typeof Errors>;
88-
// Accept any field generic to avoid forcing a specific T at call sites
89-
field: FieldProps<any>;
87+
field: ComponentProps<typeof Field>;
9088
heading: ComponentProps<typeof ComponentForm>;
9189
label: ComponentProps<typeof Label>;
9290
optionalFields: ComponentProps<typeof ComponentForm>;

packages/connect-react/src/hooks/form-context.tsx

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
import {
2-
createContext, useContext, useEffect, useId, useMemo, useState, type ReactNode,
2+
createContext,
3+
useContext,
4+
useEffect,
5+
useId,
6+
useMemo,
7+
useState,
8+
type ReactNode,
39
} from "react";
410
import isEqual from "lodash.isequal";
511
import { useQuery } from "@tanstack/react-query";
@@ -14,7 +20,6 @@ import type {
1420
ConfiguredProps,
1521
DynamicProps,
1622
Observation,
17-
ObservationError,
1823
ReloadPropsOpts,
1924
ReloadPropsResponse,
2025
Component,
@@ -24,10 +29,16 @@ import { useFrontendClient } from "./frontend-client-context";
2429
import type { ComponentFormProps } from "../components/ComponentForm";
2530
import type { FormFieldContext } from "./form-field-context";
2631
import {
27-
appPropErrors, arrayPropErrors, booleanPropErrors, integerPropErrors,
32+
appPropErrors,
33+
arrayPropErrors,
34+
booleanPropErrors,
35+
integerPropErrors,
2836
stringPropErrors,
2937
} from "../utils/component";
30-
import { SdkError, ObservationErrorDetails } from "../types";
38+
import {
39+
SdkError,
40+
ObservationErrorDetails,
41+
} from "../types";
3142
import { resolveUserId } from "../utils/resolve-user-id";
3243

3344
export type AnyFormFieldContext = Omit<FormFieldContext<ConfigurableProp>, "onChange"> & {
@@ -371,7 +382,8 @@ export const FormContextProvider = <T extends ConfigurableProps>({
371382
const value = configuredProps[prop.name as keyof ConfiguredProps<T>];
372383
if (value === undefined) {
373384
if ("default" in prop && prop.default != null) {
374-
newConfiguredProps[prop.name as keyof ConfiguredProps<T>] = prop.default as any; // default may be loosely typed
385+
// default may be loosely typed
386+
newConfiguredProps[prop.name as keyof ConfiguredProps<T>] = prop.default as any; // eslint-disable-line @typescript-eslint/no-explicit-any
375387
}
376388
} else {
377389
if (prop.type === "integer" && typeof value !== "number") {

packages/connect-react/src/hooks/use-app.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import { useFrontendClient } from "./frontend-client-context";
99
*/
1010
export const useApp = (
1111
slug: string,
12-
opts?: { useQueryOpts?: (Omit<UseQueryOptions<GetAppResponse>, "queryKey" | "queryFn"> & { suspense?: boolean }) }
12+
opts?: { useQueryOpts?: (Omit<UseQueryOptions<GetAppResponse>, "queryKey" | "queryFn"> & { suspense?: boolean }) },
1313
) => {
1414
const client = useFrontendClient();
1515
const query = useQuery({

packages/connect-react/src/hooks/use-apps.tsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
import { useQuery } from "@tanstack/react-query";
2-
import type { AppsListRequest, App } from "@pipedream/sdk";
2+
import type {
3+
AppsListRequest, App,
4+
} from "@pipedream/sdk";
35
import { useFrontendClient } from "./frontend-client-context";
46

57
/**
@@ -9,7 +11,6 @@ export const useApps = (input?: AppsListRequest): {
911
apps: App[];
1012
isLoading: boolean;
1113
error: Error | null;
12-
refetch: () => void;
1314
} => {
1415
const client = useFrontendClient();
1516
const query = useQuery({

packages/connect-react/src/hooks/use-components.tsx

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
1-
import { useQuery, UseQueryResult } from "@tanstack/react-query";
2-
import type { ComponentsListRequest, Component } from "@pipedream/sdk";
1+
import { useQuery } from "@tanstack/react-query";
2+
import type {
3+
ComponentsListRequest,
4+
Component,
5+
} from "@pipedream/sdk";
36
import { useFrontendClient } from "./frontend-client-context";
47

58
/**
@@ -9,7 +12,6 @@ export const useComponents = (input?: ComponentsListRequest): {
912
components: Component[];
1013
isLoading: boolean;
1114
error: Error | null;
12-
refetch: () => void;
1315
} => {
1416
const client = useFrontendClient();
1517
const query = useQuery({

0 commit comments

Comments
 (0)