Skip to content

Commit

Permalink
Update array-type rule to array-simple
Browse files Browse the repository at this point in the history
  • Loading branch information
edmundito committed Jun 10, 2022
1 parent fe1e88b commit 7389500
Show file tree
Hide file tree
Showing 24 changed files with 34 additions and 34 deletions.
2 changes: 1 addition & 1 deletion airbyte-webapp/.eslintrc
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@
}
}
],
"@typescript-eslint/array-type": "warn",
"@typescript-eslint/array-type": ["warn", { "default": "array-simple" }],
"@typescript-eslint/ban-ts-comment": [
"warn",
{
Expand Down
4 changes: 2 additions & 2 deletions airbyte-webapp/src/components/BarChart/BarChart.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@ import { Bar, BarChart as BasicBarChart, CartesianGrid, Label, ResponsiveContain
import { barChartColors, theme } from "theme";

interface BarChartProps {
data: {
data: Array<{
name: string;
value: number;
}[];
}>;
legendLabels: string[];
xLabel?: string;
yLabel?: string;
Expand Down
2 changes: 1 addition & 1 deletion airbyte-webapp/src/components/Breadcrumbs/Breadcrumbs.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ const BreadcrumbsItem = styled.div`
`;

interface IProps {
data: { name: string | React.ReactNode; onClick?: () => void }[];
data: Array<{ name: string | React.ReactNode; onClick?: () => void }>;
}

const Breadcrumbs: React.FC<IProps> = ({ data }) => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { StatusIconStatus } from "components/StatusIcon/StatusIcon";

import { Status } from "../types";

const _statusConfig: { status: Status; statusIconStatus?: StatusIconStatus; titleId: string }[] = [
const _statusConfig: Array<{ status: Status; statusIconStatus?: StatusIconStatus; titleId: string }> = [
{ status: Status.ACTIVE, statusIconStatus: "success", titleId: "connection.successSync" },
{ status: Status.INACTIVE, statusIconStatus: "inactive", titleId: "connection.disabledConnection" },
{ status: Status.FAILED, titleId: "connection.failedSync" },
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@ import styled from "styled-components";
import ImageBlock from "components/ImageBlock";

interface IProps {
values: {
values: Array<{
name: string;
connector: string;
}[];
}>;
enabled?: boolean;
entity: "source" | "destination";
}
Expand Down
4 changes: 2 additions & 2 deletions airbyte-webapp/src/components/EntityTable/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@ interface EntityTableDataItem {
entityId: string;
entityName: string;
connectorName: string;
connectEntities: {
connectEntities: Array<{
name: string;
connector: string;
status: string;
lastSyncStatus: string | null;
}[];
}>;
enabled: boolean;
lastSync?: number | null;
connectorIcon?: string;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ describe("<StatusIcon />", () => {
expect(component.getByText(`${value}`)).toBeDefined();
});

const statusCases: { status: StatusIconStatus; icon: string }[] = [
const statusCases: Array<{ status: StatusIconStatus; icon: string }> = [
{ status: "success", icon: "check" },
{ status: "inactive", icon: "pause" },
{ status: "sleep", icon: "moon" },
Expand Down
4 changes: 2 additions & 2 deletions airbyte-webapp/src/components/Table/Table.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -99,14 +99,14 @@ const Th = styled.th<IThProps>`

interface IProps {
light?: boolean;
columns: (IHeaderProps | Column<Record<string, unknown>>)[];
columns: Array<IHeaderProps | Column<Record<string, unknown>>>;
erroredRows?: boolean;
// eslint-disable-next-line @typescript-eslint/no-explicit-any
data: any[];
// eslint-disable-next-line @typescript-eslint/no-explicit-any
onClickRow?: (data: any) => void;
// eslint-disable-next-line @typescript-eslint/no-explicit-any
sortBy?: SortingRule<any>[];
sortBy?: Array<SortingRule<any>>;
}

const Table: React.FC<IProps> = ({ columns, data, onClickRow, erroredRows, sortBy, light }) => {
Expand Down
2 changes: 1 addition & 1 deletion airbyte-webapp/src/config/configProviders.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ describe("applyProviders", () => {
innerProp: "1",
},
};
const providers: ProviderAsync<DeepPartial<Value>>[] = [
const providers: Array<ProviderAsync<DeepPartial<Value>>> = [
async () => ({
prop1: {
innerProp: "John",
Expand Down
2 changes: 1 addition & 1 deletion airbyte-webapp/src/config/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,6 @@ export type DeepPartial<T> = {
export type ProviderAsync<T> = () => Promise<T>;
export type Provider<T> = () => T;

export type ValueProvider<T> = ProviderAsync<DeepPartial<T>>[];
export type ValueProvider<T> = Array<ProviderAsync<DeepPartial<T>>>;

export type ConfigProvider<T extends Config = Config> = ProviderAsync<DeepPartial<T>>;
2 changes: 1 addition & 1 deletion airbyte-webapp/src/core/jsonSchema/schemaToUiWidget.ts
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ function isKeyRequired(key: string, parentSchema?: AirbyteJSONSchemaDefinition):
return isRequired;
}

const defaultFields: (keyof AirbyteJSONSchema)[] = [
const defaultFields: Array<keyof AirbyteJSONSchema> = [
"default",
"examples",
"description",
Expand Down
2 changes: 1 addition & 1 deletion airbyte-webapp/src/core/jsonSchema/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ function removeNestedPaths(

function applyFuncAt(
schema: JSONSchema7Definition,
path: (string | number)[],
path: Array<string | number>,
f: (schema: JSONSchema7Definition) => JSONSchema7
): JSONSchema7Definition {
if (typeof schema === "boolean") {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@ export interface CreditConsumptionByConnector {
export interface CloudWorkspaceUsage {
workspaceId: string;
creditConsumptionByConnector: CreditConsumptionByConnector[];
creditConsumptionByDay: {
creditConsumptionByDay: Array<{
date: [number, number, number];
creditsConsumed: number;
}[];
}>;
}
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,9 @@ export class UserService extends AirbyteRequestService {
}

public async invite(
users: {
users: Array<{
email: string;
}[],
}>,
workspaceId: string
): Promise<User[]> {
return Promise.all(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,9 @@ export const useUserHook = () => {
),
inviteUserLogic: useMutation(
async (payload: {
users: {
users: Array<{
email: string;
}[];
}>;
workspaceId: string;
}) => service.invite(payload.users, payload.workspaceId),
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import StarsIcon from "./components/StarsIcon";
import StepItem from "./components/StepItem";

interface StepsCounterProps {
steps: { id: StepType; name?: React.ReactNode }[];
steps: Array<{ id: StepType; name?: React.ReactNode }>;
currentStep: StepType;
}

Expand Down
2 changes: 1 addition & 1 deletion airbyte-webapp/src/pages/OnboardingPage/useStepsConfig.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ const useStepsConfig = (
): {
currentStep: StepType;
setCurrentStep: (step: StepType) => void;
steps: { name: JSX.Element; id: StepType }[];
steps: Array<{ name: JSX.Element; id: StepType }>;
} => {
const getInitialStep = () => {
if (hasSources) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,9 @@ interface StreamHeaderProps {
stream: SyncSchemaStream;
destName: string;
destNamespace: string;
availableSyncModes: {
availableSyncModes: Array<{
value: SyncSchema;
}[];
}>;
onSelectSyncMode: (selectedMode: DropDownRow.IDataItem) => void;
onSelectStream: () => void;
primitiveFields: SyncSchemaField[];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ export const PathPopout: React.FC<PathPopoutProps> = (props) => {
// @ts-expect-error need to solve issue with typings
isMulti={props.isMulti}
isSearchable
onChange={(options: PathPopoutProps["isMulti"] extends true ? { value: Path }[] : { value: Path }) => {
onChange={(options: PathPopoutProps["isMulti"] extends true ? Array<{ value: Path }> : { value: Path }) => {
const finalValues = Array.isArray(options) ? options.map((op) => op.value) : options.value;

props.onPathChange(finalValues);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -197,12 +197,12 @@ const SyncCatalogField: React.FC<SchemaViewProps> = ({
);

const filteredStreams = useMemo(() => {
const filters: ((s: SyncSchemaStream) => boolean)[] = [
const filters: Array<(s: SyncSchemaStream) => boolean> = [
(_: SyncSchemaStream) => true,
searchString
? (stream: SyncSchemaStream) => stream.stream?.name.toLowerCase().includes(searchString.toLowerCase())
: null,
].filter(Boolean) as ((s: SyncSchemaStream) => boolean)[];
].filter(Boolean) as Array<(s: SyncSchemaStream) => boolean>;

return sortedSchema.filter((stream) => filters.every((f) => f(stream)));
}, [searchString, sortedSchema]);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ interface FormikConnectionFormValues {

type ConnectionFormValues = ValuesProps;

const SUPPORTED_MODES: [SyncMode, DestinationSyncMode][] = [
const SUPPORTED_MODES: Array<[SyncMode, DestinationSyncMode]> = [
[SyncMode.incremental, DestinationSyncMode.append_dedup],
[SyncMode.full_refresh, DestinationSyncMode.overwrite],
[SyncMode.incremental, DestinationSyncMode.append],
Expand Down Expand Up @@ -204,7 +204,7 @@ const getInitialTransformations = (operations: OperationCreate[]): OperationRead
operations?.filter(isDbtTransformation) ?? [];

const getInitialNormalization = (
operations?: (OperationRead | OperationCreate)[],
operations?: Array<OperationRead | OperationCreate>,
isEditMode?: boolean
): NormalizationType => {
const initialNormalization =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ function useFormikOauthAdapter(connector: ConnectorDefinitionSpecification): {
const oauthInputProperties =
(
connector?.advancedAuth?.oauthConfigSpecification?.oauthUserInputFromConnectorConfigSpecification as {
properties: { path_in_connector_config: string[] }[];
properties: Array<{ path_in_connector_config: string[] }>;
}
)?.properties ?? {};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ function upgradeSchemaLegacyAuth(
const spec = connectorSpecification.authSpecification.oauth2Specification;
return applyFuncAt(
connectorSpecification.connectionSpecification as JSONSchema7Definition,
(spec?.rootObject ?? []) as (string | number)[],
(spec?.rootObject ?? []) as Array<string | number>,
(schema) => {
// Very hacky way to allow placing button within section
// @ts-expect-error json schema
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ export const Icon = styled.div`

const SidebarPopout: React.FC<{
children: (props: { onOpen: () => void }) => React.ReactNode;
options: { value: string; label?: React.ReactNode }[];
options: Array<{ value: string; label?: React.ReactNode }>;
}> = ({ children, options }) => {
const config = useConfig();

Expand Down

0 comments on commit 7389500

Please sign in to comment.