Skip to content

Commit e0e2187

Browse files
committed
Fix linter issues
1 parent ae44744 commit e0e2187

File tree

11 files changed

+41
-25
lines changed

11 files changed

+41
-25
lines changed

packages/connect-react/package.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@
1818
},
1919
"scripts": {
2020
"build": "vite build",
21+
"lint": "eslint src",
22+
"lint:fix": "eslint src --fix",
2123
"prepare": "pnpm run build",
2224
"watch": "NODE_ENV=development vite build --watch --mode development"
2325
},

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ export function Control<T extends ConfigurableProps, U extends ConfigurableProp>
3939
}
4040

4141
if ("options" in prop && prop.options) {
42+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
4243
const options: LabelValueOption<any>[] = prop.options.map(sanitizeOption);
4344
return <ControlSelect options={options} components={{
4445
IndicatorSeparator: () => null,

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

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -93,8 +93,7 @@ export function ControlApp({ app }: ControlAppProps) {
9393
useQueryOpts: {
9494
enabled: !!app,
9595

96-
// this seems to work (this overrides enabled so don't just set to true)
97-
// @ts-ignore
96+
// @ts-expect-error this seems to work (this overrides enabled so don't just set to true)
9897
suspense: !!app,
9998
},
10099
},
@@ -124,7 +123,9 @@ export function ControlApp({ app }: ControlAppProps) {
124123
const selectOptions = useMemo<SelectValue[]>(() => [
125124
...accounts,
126125
newAccountPlaceholder,
127-
], [accounts]);
126+
], [
127+
accounts,
128+
]);
128129

129130
const selectValue = useMemo<SelectValue>(() => {
130131
if (value?.authProvisionId) {

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

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,9 @@ import {
33
useMemo,
44
useState,
55
} from "react";
6-
import type { CSSObjectWithLabel, MenuListProps } from "react-select";
6+
import type {
7+
CSSObjectWithLabel, MenuListProps,
8+
} from "react-select";
79
import Select, {
810
components,
911
Props as ReactSelectProps,
@@ -12,7 +14,7 @@ import CreatableSelect from "react-select/creatable";
1214
import type { BaseReactSelectProps } from "../hooks/customization-context";
1315
import { useCustomize } from "../hooks/customization-context";
1416
import { useFormFieldContext } from "../hooks/form-field-context";
15-
import { LabelValueOption, RawPropOption } from "../types";
17+
import { LabelValueOption } from "../types";
1618
import {
1719
isOptionWithLabel,
1820
sanitizeOption,
@@ -26,7 +28,7 @@ type ControlSelectProps<T> = {
2628
selectProps?: ReactSelectProps<LabelValueOption<T>, boolean>;
2729
showLoadMoreButton?: boolean;
2830
onLoadMore?: () => void;
29-
components?: ReactSelectProps<LabelValueOption<T>, boolean>['components'];
31+
components?: ReactSelectProps<LabelValueOption<T>, boolean>["components"];
3032
};
3133

3234
export function ControlSelect<T>({
@@ -89,8 +91,7 @@ export function ControlSelect<T>({
8991
selectOptions.find((item) => item.value === o) || {
9092
label: String(o),
9193
value: o,
92-
}
93-
);
94+
});
9495
}
9596
} else if (ret && typeof ret === "object" && "__lv" in ret) {
9697
// Extract the actual option from __lv wrapper

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

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -38,13 +38,15 @@ export function ControlSubmit<T extends ConfigurableProps>(props: ControlSubmitP
3838

3939
return <input
4040
type="submit"
41-
value={submitting ? "Submitting..." : "Submit"}
41+
value={submitting
42+
? "Submitting..."
43+
: "Submit"}
4244
{
43-
...getProps(
44-
"controlSubmit",
45-
baseStyles(!!propsNeedConfiguring.length || submitting),
46-
props as ControlSubmitProps<ConfigurableProps>
47-
)
45+
...getProps(
46+
"controlSubmit",
47+
baseStyles(!!propsNeedConfiguring.length || submitting),
48+
props as ControlSubmitProps<ConfigurableProps>,
49+
)
4850
}
4951
disabled={!!propsNeedConfiguring.length || submitting}
5052
/>;

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

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import type { ConfigurableProp, ConfigurablePropApp } from "@pipedream/sdk";
1+
import type { ConfigurableProp } from "@pipedream/sdk";
22
import { FormFieldContext } from "../hooks/form-field-context";
33
import { useFormContext } from "../hooks/form-context";
44
import { Field } from "./Field";
@@ -28,8 +28,7 @@ export function InternalField<T extends ConfigurableProp>({
2828
useQueryOpts: {
2929
enabled: !!appSlug,
3030

31-
// this seems to work (this overrides enabled so don't just set to true)
32-
// @ts-ignore
31+
// @ts-expect-error this seems to work (this overrides enabled so don't just set to true)
3332
suspense: !!appSlug,
3433
},
3534
});

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

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,12 @@ import { useState } from "react";
44
import { useFormContext } from "../hooks/form-context";
55
import { useFormFieldContext } from "../hooks/form-field-context";
66
import { useFrontendClient } from "../hooks/frontend-client-context";
7-
import { ConfigureComponentContext, RawPropOption } from "../types";
8-
import { isString, sanitizeOption } from "../utils/type-guards";
7+
import {
8+
ConfigureComponentContext, RawPropOption,
9+
} from "../types";
10+
import {
11+
isString, sanitizeOption,
12+
} from "../utils/type-guards";
913
import { ControlSelect } from "./ControlSelect";
1014

1115
export type RemoteOptionsContainerProps = {

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

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -252,7 +252,9 @@ export const FormContextProvider = <T extends ConfigurableProps>({
252252
if (prop.type === "app") {
253253
const field = fields[prop.name]
254254
if (field) {
255-
const app = "app" in field.extra ? field.extra.app : undefined
255+
const app = "app" in field.extra
256+
? field.extra.app
257+
: undefined
256258
errs.push(...(appPropErrors({
257259
prop,
258260
value,
@@ -529,6 +531,7 @@ export const FormContextProvider = <T extends ConfigurableProps>({
529531
}
530532
}
531533

534+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
532535
const errorFromDetails = (data: any, ret: SdkError[]) => {
533536
ret.push({
534537
name: data.error,

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

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,15 @@ import {
22
createContext, useContext,
33
} from "react";
44
import type {
5-
AppResponse, ConfigurableProp, ConfigurablePropApp, PropValue,
5+
ConfigurableProp,
6+
ConfigurablePropApp,
7+
PropValue,
68
} from "@pipedream/sdk";
79
import { App } from "@pipedream/sdk/browser";
810

911
export type FormFieldContextExtra<T extends ConfigurableProp> = T extends ConfigurablePropApp ? {
1012
app?: App;
11-
} : {};
13+
} : object;
1214

1315
export type FormFieldContext<T extends ConfigurableProp> = {
1416
id: string;

packages/connect-react/src/types.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ export type LabelValueOption<T> = {
3939
}
4040

4141
export type NestedLabelValueOption<T> = {
42-
__lv: LabelValueOption<T>;
42+
__lv: LabelValueOption<T> | T[];
4343
}
4444

4545
export type RawPropOption<T> =

0 commit comments

Comments
 (0)