From bf08bfacb5433059e3940c4fc6474a642f4cb077 Mon Sep 17 00:00:00 2001 From: Tuan Dang Date: Wed, 26 Jul 2023 15:06:18 +0700 Subject: [PATCH] Fix lint errors --- .../ee/controllers/v1/workspaceController.ts | 4 ++-- backend/src/ee/routes/v1/users.ts | 2 +- backend/src/utils/ip/ip.ts | 2 +- backend/src/utils/setup/backfillData.ts | 6 +++--- frontend/src/hooks/api/index.tsx | 2 +- .../src/hooks/api/organization/queries.tsx | 1 + frontend/src/hooks/api/trustedIps/index.ts | 7 +++---- frontend/src/hooks/api/trustedIps/queries.ts | 2 ++ frontend/src/hooks/api/users/index.tsx | 2 +- .../pages/project/[id]/allowlist/index.tsx | 1 + .../components/IPAllowlistModal.tsx | 5 +++-- .../components/IPAllowlistSection.tsx | 8 ++++--- .../components/IPAllowlistTable.tsx | 21 ++++++++++--------- .../BillingDetailsTab/PmtMethodsSection.tsx | 1 + .../BillingDetailsTab/PmtMethodsTable.tsx | 1 + .../BillingDetailsTab/TaxIDModal.tsx | 1 + .../BillingReceiptsTab/InvoicesTable.tsx | 1 + .../EnvironmentSection/EnvironmentSection.tsx | 2 ++ 18 files changed, 41 insertions(+), 28 deletions(-) diff --git a/backend/src/ee/controllers/v1/workspaceController.ts b/backend/src/ee/controllers/v1/workspaceController.ts index 54c28177f..64b6980f8 100644 --- a/backend/src/ee/controllers/v1/workspaceController.ts +++ b/backend/src/ee/controllers/v1/workspaceController.ts @@ -1,5 +1,5 @@ import { Request, Response } from "express"; -import { PipelineStage, trusted, Types } from "mongoose"; +import { PipelineStage, Types } from "mongoose"; import { Secret } from "../../../models"; import { FolderVersion, @@ -15,7 +15,7 @@ import { getLatestSecretVersionIds } from "../../helpers/secretVersion"; import Folder, { TFolderSchema } from "../../../models/folder"; import { searchByFolderId } from "../../../services/FolderService"; import { EELicenseService } from "../../services"; -import { isValidIpOrCidr, extractIPDetails } from "../../../utils/ip"; +import { extractIPDetails, isValidIpOrCidr } from "../../../utils/ip"; /** * Return secret snapshots for workspace with id [workspaceId] diff --git a/backend/src/ee/routes/v1/users.ts b/backend/src/ee/routes/v1/users.ts index bf37f84c9..14dcaa49c 100644 --- a/backend/src/ee/routes/v1/users.ts +++ b/backend/src/ee/routes/v1/users.ts @@ -3,7 +3,7 @@ const router = express.Router(); import { requireAuth } from "../../../middleware"; -import { AUTH_MODE_JWT, AUTH_MODE_API_KEY } from "../../../variables"; +import { AUTH_MODE_API_KEY, AUTH_MODE_JWT } from "../../../variables"; import { usersController } from "../../controllers/v1"; router.get( diff --git a/backend/src/utils/ip/ip.ts b/backend/src/utils/ip/ip.ts index dc68d0b29..ac3b17149 100644 --- a/backend/src/utils/ip/ip.ts +++ b/backend/src/utils/ip/ip.ts @@ -88,7 +88,7 @@ export const isValidCidr = (cidr: string): boolean => { */ export const isValidIpOrCidr = (ip: string): boolean => { // if the string contains a slash, treat it as a CIDR block - if (ip.includes('/')) { + if (ip.includes("/")) { return isValidCidr(ip); } diff --git a/backend/src/utils/setup/backfillData.ts b/backend/src/utils/setup/backfillData.ts index 5e2e58910..fdc766316 100644 --- a/backend/src/utils/setup/backfillData.ts +++ b/backend/src/utils/setup/backfillData.ts @@ -4,11 +4,11 @@ import { Types } from "mongoose"; import { encryptSymmetric128BitHexKeyUTF8 } from "../crypto"; import { EESecretService } from "../../ee/services"; import { + IPType, ISecretVersion, - SecretSnapshot, + SecretSnapshot, SecretVersion, - TrustedIP, - IPType + TrustedIP } from "../../ee/models"; import { BackupPrivateKey, diff --git a/frontend/src/hooks/api/index.tsx b/frontend/src/hooks/api/index.tsx index 034e48b43..672e51052 100644 --- a/frontend/src/hooks/api/index.tsx +++ b/frontend/src/hooks/api/index.tsx @@ -14,7 +14,7 @@ export * from "./serviceTokens"; export * from "./ssoConfig"; export * from "./subscriptions"; export * from "./tags"; +export * from "./trustedIps"; export * from "./users"; export * from "./webhooks"; export * from "./workspace"; -export * from "./trustedIps"; diff --git a/frontend/src/hooks/api/organization/queries.tsx b/frontend/src/hooks/api/organization/queries.tsx index 5194b56a3..63de2773d 100644 --- a/frontend/src/hooks/api/organization/queries.tsx +++ b/frontend/src/hooks/api/organization/queries.tsx @@ -1,4 +1,5 @@ import { useMutation, useQuery, useQueryClient } from "@tanstack/react-query"; + import { apiRequest } from "@app/config/request"; import { diff --git a/frontend/src/hooks/api/trustedIps/index.ts b/frontend/src/hooks/api/trustedIps/index.ts index 8aea2ae84..eb86f8e40 100644 --- a/frontend/src/hooks/api/trustedIps/index.ts +++ b/frontend/src/hooks/api/trustedIps/index.ts @@ -1,6 +1,5 @@ export { - useGetTrustedIps, useAddTrustedIp, - useUpdateTrustedIp, - useDeleteTrustedIp -} from "./queries"; \ No newline at end of file + useDeleteTrustedIp, + useGetTrustedIps, + useUpdateTrustedIp} from "./queries"; \ No newline at end of file diff --git a/frontend/src/hooks/api/trustedIps/queries.ts b/frontend/src/hooks/api/trustedIps/queries.ts index c0cb7fbbd..f239bb0ca 100644 --- a/frontend/src/hooks/api/trustedIps/queries.ts +++ b/frontend/src/hooks/api/trustedIps/queries.ts @@ -1,5 +1,7 @@ import { useMutation, useQuery, useQueryClient } from "@tanstack/react-query"; + import { apiRequest } from "@app/config/request"; + import { TrustedIp } from "./types"; diff --git a/frontend/src/hooks/api/users/index.tsx b/frontend/src/hooks/api/users/index.tsx index 2d7b14f92..a209367e2 100644 --- a/frontend/src/hooks/api/users/index.tsx +++ b/frontend/src/hooks/api/users/index.tsx @@ -5,8 +5,8 @@ export { useCreateAPIKey, useDeleteAPIKey, useDeleteOrgMembership, - useGetMyIp, useGetMyAPIKeys, + useGetMyIp, useGetMySessions, useGetOrgUsers, useGetUser, diff --git a/frontend/src/pages/project/[id]/allowlist/index.tsx b/frontend/src/pages/project/[id]/allowlist/index.tsx index 0bc865dfb..9014cf0e9 100644 --- a/frontend/src/pages/project/[id]/allowlist/index.tsx +++ b/frontend/src/pages/project/[id]/allowlist/index.tsx @@ -1,5 +1,6 @@ import { useTranslation } from "react-i18next"; import Head from "next/head"; + import { IPAllowlistPage } from "@app/views/Project/IPAllowListPage"; const ProjectAllowlist = () => { diff --git a/frontend/src/views/Project/IPAllowListPage/components/IPAllowlistModal.tsx b/frontend/src/views/Project/IPAllowListPage/components/IPAllowlistModal.tsx index 52e202a2e..07de4425e 100644 --- a/frontend/src/views/Project/IPAllowListPage/components/IPAllowlistModal.tsx +++ b/frontend/src/views/Project/IPAllowListPage/components/IPAllowlistModal.tsx @@ -2,6 +2,7 @@ import { useEffect } from "react"; import { Controller, useForm } from "react-hook-form"; import { yupResolver } from "@hookform/resolvers/yup"; import * as yup from "yup"; + import { useNotificationContext } from "@app/components/context/Notifications/NotificationProvider"; import { Button, @@ -10,13 +11,13 @@ import { Modal, ModalContent } from "@app/components/v2"; -import { UsePopUpState } from "@app/hooks/usePopUp"; import { useWorkspace } from "@app/context"; import { - useGetMyIp, useAddTrustedIp, + useGetMyIp, useUpdateTrustedIp } from "@app/hooks/api"; +import { UsePopUpState } from "@app/hooks/usePopUp"; const schema = yup.object({ ipAddress: yup.string().required("IP address is required"), diff --git a/frontend/src/views/Project/IPAllowListPage/components/IPAllowlistSection.tsx b/frontend/src/views/Project/IPAllowListPage/components/IPAllowlistSection.tsx index 89ba6ce24..729ab549e 100644 --- a/frontend/src/views/Project/IPAllowListPage/components/IPAllowlistSection.tsx +++ b/frontend/src/views/Project/IPAllowListPage/components/IPAllowlistSection.tsx @@ -1,18 +1,20 @@ -import { useNotificationContext } from "@app/components/context/Notifications/NotificationProvider"; import { faPlus } from "@fortawesome/free-solid-svg-icons"; import { FontAwesomeIcon } from "@fortawesome/react-fontawesome"; + +import { useNotificationContext } from "@app/components/context/Notifications/NotificationProvider"; import { Button, DeleteActionModal, UpgradePlanModal } from "@app/components/v2"; +import { useSubscription,useWorkspace } from "@app/context"; import { useDeleteTrustedIp } from "@app/hooks/api"; -import { useSubscription,useWorkspace } from "@app/context"; import { usePopUp } from "@app/hooks/usePopUp"; -import { IPAllowlistTable } from "./IPAllowlistTable"; + import { IPAllowlistModal } from "./IPAllowlistModal"; +import { IPAllowlistTable } from "./IPAllowlistTable"; export const IPAllowlistSection = () => { const { createNotification } = useNotificationContext(); diff --git a/frontend/src/views/Project/IPAllowListPage/components/IPAllowlistTable.tsx b/frontend/src/views/Project/IPAllowListPage/components/IPAllowlistTable.tsx index 97d09f9a5..cd93d7c1b 100644 --- a/frontend/src/views/Project/IPAllowListPage/components/IPAllowlistTable.tsx +++ b/frontend/src/views/Project/IPAllowListPage/components/IPAllowlistTable.tsx @@ -1,22 +1,23 @@ +import { faGlobe, faPencil, faXmark } from "@fortawesome/free-solid-svg-icons"; +import { FontAwesomeIcon } from "@fortawesome/react-fontawesome"; + import { - TableContainer, + EmptyState, + IconButton, Table, - THead, - Tr, - Th, + TableContainer, + TableSkeleton, TBody, Td, - EmptyState, - TableSkeleton, - IconButton, + Th, + THead, + Tr, UpgradePlanModal } from "@app/components/v2"; import { useSubscription, useWorkspace } from "@app/context"; import { useGetTrustedIps } from "@app/hooks/api"; -import { FontAwesomeIcon } from "@fortawesome/react-fontawesome"; -import { faGlobe, faPencil, faXmark } from "@fortawesome/free-solid-svg-icons"; import { UsePopUpState } from "@app/hooks/usePopUp"; type Props = { @@ -56,7 +57,7 @@ export const IPAllowlistTable = ({ Format Comment {/* Status */} - + diff --git a/frontend/src/views/Settings/BillingSettingsPage/components/BillingDetailsTab/PmtMethodsSection.tsx b/frontend/src/views/Settings/BillingSettingsPage/components/BillingDetailsTab/PmtMethodsSection.tsx index 8098443fa..a124813ed 100644 --- a/frontend/src/views/Settings/BillingSettingsPage/components/BillingDetailsTab/PmtMethodsSection.tsx +++ b/frontend/src/views/Settings/BillingSettingsPage/components/BillingDetailsTab/PmtMethodsSection.tsx @@ -1,6 +1,7 @@ import { faPlus } from "@fortawesome/free-solid-svg-icons"; import { FontAwesomeIcon } from "@fortawesome/react-fontawesome"; + import { Button } from "@app/components/v2"; diff --git a/frontend/src/views/Settings/BillingSettingsPage/components/BillingDetailsTab/PmtMethodsTable.tsx b/frontend/src/views/Settings/BillingSettingsPage/components/BillingDetailsTab/PmtMethodsTable.tsx index e1e9c1bb9..743106998 100644 --- a/frontend/src/views/Settings/BillingSettingsPage/components/BillingDetailsTab/PmtMethodsTable.tsx +++ b/frontend/src/views/Settings/BillingSettingsPage/components/BillingDetailsTab/PmtMethodsTable.tsx @@ -1,5 +1,6 @@ import { faCreditCard, faXmark } from "@fortawesome/free-solid-svg-icons"; import { FontAwesomeIcon } from "@fortawesome/react-fontawesome"; + import { EmptyState, IconButton, diff --git a/frontend/src/views/Settings/BillingSettingsPage/components/BillingDetailsTab/TaxIDModal.tsx b/frontend/src/views/Settings/BillingSettingsPage/components/BillingDetailsTab/TaxIDModal.tsx index 73827e4f3..a6e039a9b 100644 --- a/frontend/src/views/Settings/BillingSettingsPage/components/BillingDetailsTab/TaxIDModal.tsx +++ b/frontend/src/views/Settings/BillingSettingsPage/components/BillingDetailsTab/TaxIDModal.tsx @@ -1,6 +1,7 @@ import { Controller, useForm } from "react-hook-form"; import { yupResolver } from "@hookform/resolvers/yup"; import * as yup from "yup"; + import { useNotificationContext } from "@app/components/context/Notifications/NotificationProvider"; import { Button, diff --git a/frontend/src/views/Settings/BillingSettingsPage/components/BillingReceiptsTab/InvoicesTable.tsx b/frontend/src/views/Settings/BillingSettingsPage/components/BillingReceiptsTab/InvoicesTable.tsx index 6807af0d5..612052a36 100644 --- a/frontend/src/views/Settings/BillingSettingsPage/components/BillingReceiptsTab/InvoicesTable.tsx +++ b/frontend/src/views/Settings/BillingSettingsPage/components/BillingReceiptsTab/InvoicesTable.tsx @@ -1,5 +1,6 @@ import { faDownload, faFileInvoice } from "@fortawesome/free-solid-svg-icons"; import { FontAwesomeIcon } from "@fortawesome/react-fontawesome"; + import { EmptyState, IconButton, diff --git a/frontend/src/views/Settings/ProjectSettingsPage/components/EnvironmentSection/EnvironmentSection.tsx b/frontend/src/views/Settings/ProjectSettingsPage/components/EnvironmentSection/EnvironmentSection.tsx index 80476eb5e..62a66e72c 100644 --- a/frontend/src/views/Settings/ProjectSettingsPage/components/EnvironmentSection/EnvironmentSection.tsx +++ b/frontend/src/views/Settings/ProjectSettingsPage/components/EnvironmentSection/EnvironmentSection.tsx @@ -1,5 +1,6 @@ import { faPlus } from "@fortawesome/free-solid-svg-icons"; import { FontAwesomeIcon } from "@fortawesome/react-fontawesome"; + import { useNotificationContext } from "@app/components/context/Notifications/NotificationProvider"; import { Button, @@ -11,6 +12,7 @@ import { useDeleteWsEnvironment } from "@app/hooks/api"; import { usePopUp } from "@app/hooks/usePopUp"; + import { AddEnvironmentModal } from "./AddEnvironmentModal"; import { EnvironmentTable } from "./EnvironmentTable"; import { UpdateEnvironmentModal } from "./UpdateEnvironmentModal";