Add eslint rule and fix as many issues as possible

This commit is contained in:
Khoa Le
2023-06-19 23:42:04 -04:00
parent e9eacc445d
commit 9d33e4756b
689 changed files with 9446 additions and 21821 deletions
@@ -1,28 +1,28 @@
import { useState } from 'react';
import { useRouter } from 'next/router';
import { useState } from "react";
import { useRouter } from "next/router";
import { Button, Card, CardTitle, FormControl, Input } from '../../../components/v2';
import saveIntegrationAccessToken from '../../api/integrations/saveIntegrationAccessToken';
import { Button, Card, CardTitle, FormControl, Input } from "../../../components/v2";
import saveIntegrationAccessToken from "../../api/integrations/saveIntegrationAccessToken";
export default function RailwayAuthorizeIntegrationPage() {
const router = useRouter();
const [apiKey, setApiKey] = useState('');
const [apiKeyErrorText, setApiKeyErrorText] = useState('');
const [apiKey, setApiKey] = useState("");
const [apiKeyErrorText, setApiKeyErrorText] = useState("");
const [isLoading, setIsLoading] = useState(false);
const handleButtonClick = async () => {
try {
setApiKeyErrorText('');
setApiKeyErrorText("");
if (apiKey.length === 0) {
setApiKeyErrorText('API Key cannot be blank');
setApiKeyErrorText("API Key cannot be blank");
return;
}
setIsLoading(true);
const integrationAuth = await saveIntegrationAccessToken({
workspaceId: localStorage.getItem('projectData.id'),
integration: 'railway',
workspaceId: localStorage.getItem("projectData.id"),
integration: "railway",
accessId: null,
accessToken: apiKey,
url: null,
@@ -44,7 +44,7 @@ export default function RailwayAuthorizeIntegrationPage() {
<FormControl
label="Railway API Key"
errorText={apiKeyErrorText}
isError={apiKeyErrorText !== '' ?? false}
isError={apiKeyErrorText !== "" ?? false}
>
<Input placeholder="" value={apiKey} onChange={(e) => setApiKey(e.target.value)} />
</FormControl>
@@ -1,6 +1,6 @@
import { useEffect, useState } from 'react';
import { useRouter } from 'next/router';
import queryString from 'query-string';
import { useEffect, useState } from "react";
import { useRouter } from "next/router";
import queryString from "query-string";
import {
Button,
@@ -10,39 +10,39 @@ import {
Input,
Select,
SelectItem
} from '../../../components/v2';
} from "../../../components/v2";
import {
useGetIntegrationAuthApps,
useGetIntegrationAuthById,
useGetIntegrationAuthRailwayEnvironments,
useGetIntegrationAuthRailwayServices
} from '../../../hooks/api/integrationAuth';
import { useGetWorkspaceById } from '../../../hooks/api/workspace';
import createIntegration from '../../api/integrations/createIntegration';
} from "../../../hooks/api/integrationAuth";
import { useGetWorkspaceById } from "../../../hooks/api/workspace";
import createIntegration from "../../api/integrations/createIntegration";
export default function RailwayCreateIntegrationPage() {
const router = useRouter();
const [targetAppId, setTargetAppId] = useState('');
const [targetEnvironmentId, setTargetEnvironmentId] = useState('');
const [targetServiceId, setTargetServiceId] = useState('');
const [targetAppId, setTargetAppId] = useState("");
const [targetEnvironmentId, setTargetEnvironmentId] = useState("");
const [targetServiceId, setTargetServiceId] = useState("");
const [selectedSourceEnvironment, setSelectedSourceEnvironment] = useState('');
const [secretPath, setSecretPath] = useState('/');
const [selectedSourceEnvironment, setSelectedSourceEnvironment] = useState("");
const [secretPath, setSecretPath] = useState("/");
const [isLoading, setIsLoading] = useState(false);
const { integrationAuthId } = queryString.parse(router.asPath.split('?')[1]);
const { data: integrationAuth } = useGetIntegrationAuthById((integrationAuthId as string) ?? '');
const { data: workspace } = useGetWorkspaceById(localStorage.getItem('projectData.id') ?? '');
const { integrationAuthId } = queryString.parse(router.asPath.split("?")[1]);
const { data: integrationAuth } = useGetIntegrationAuthById((integrationAuthId as string) ?? "");
const { data: workspace } = useGetWorkspaceById(localStorage.getItem("projectData.id") ?? "");
const { data: integrationAuthApps } = useGetIntegrationAuthApps({
integrationAuthId: (integrationAuthId as string) ?? ''
integrationAuthId: (integrationAuthId as string) ?? ""
});
const { data: targetEnvironments } = useGetIntegrationAuthRailwayEnvironments({
integrationAuthId: (integrationAuthId as string) ?? '',
integrationAuthId: (integrationAuthId as string) ?? "",
appId: targetAppId
});
const { data: targetServices } = useGetIntegrationAuthRailwayServices({
integrationAuthId: (integrationAuthId as string) ?? '',
integrationAuthId: (integrationAuthId as string) ?? "",
appId: targetAppId
});
@@ -57,7 +57,7 @@ export default function RailwayCreateIntegrationPage() {
if (integrationAuthApps.length > 0) {
setTargetAppId(integrationAuthApps[0].appId as string);
} else {
setTargetAppId('none');
setTargetAppId("none");
}
}
}, [integrationAuthApps]);
@@ -67,14 +67,14 @@ export default function RailwayCreateIntegrationPage() {
if (targetEnvironments.length > 0) {
setTargetEnvironmentId(targetEnvironments[0].environmentId);
} else {
setTargetEnvironmentId('none');
setTargetEnvironmentId("none");
}
}
}, [targetEnvironments]);
const filteredServices = targetServices?.concat({
name: '',
serviceId: ''
name: "",
serviceId: ""
});
const handleButtonClick = async () => {
@@ -114,7 +114,7 @@ export default function RailwayCreateIntegrationPage() {
setIsLoading(false);
router.push(`/integrations/${localStorage.getItem('projectData.id')}`);
router.push(`/integrations/${localStorage.getItem("projectData.id")}`);
} catch (err) {
console.error(err);
}