chore: remove unused code (#16815)

This commit is contained in:
ケイラ
2025-03-05 13:53:21 -07:00
committed by GitHub
parent 9041646b81
commit deb95f948a
53 changed files with 26 additions and 86 deletions

View File

@ -26,7 +26,7 @@ import {
} from "@mui/material/styles";
import { DecoratorHelpers } from "@storybook/addon-themes";
import isChromatic from "chromatic/isChromatic";
import React, { StrictMode } from "react";
import { StrictMode } from "react";
import { HelmetProvider } from "react-helmet-async";
import { QueryClient, QueryClientProvider, parseQueryArgs } from "react-query";
import { withRouter } from "storybook-addon-remix-react-router";

View File

@ -510,7 +510,7 @@ export const waitUntilUrlIsNotResponding = async (url: string) => {
while (retries < maxRetries) {
try {
await axiosInstance.get(url);
} catch (error) {
} catch {
return;
}

View File

@ -1,4 +1,3 @@
import * as _storybook_types from "@storybook/react";
import type {
DeploymentValues,
Experiments,

View File

@ -1,6 +1,6 @@
import { API, type InsightsParams, type InsightsTemplateParams } from "api/api";
import type { GetUserStatusCountsResponse } from "api/typesGenerated";
import { type UseQueryOptions, UseQueryResult } from "react-query";
import type { UseQueryOptions } from "react-query";
export const insightsTemplate = (params: InsightsTemplateParams) => {
return {

View File

@ -2,7 +2,6 @@ import { API, type GetTemplatesOptions, type GetTemplatesQuery } from "api/api";
import type {
CreateTemplateRequest,
CreateTemplateVersionRequest,
Preset,
ProvisionerJob,
ProvisionerJobStatus,
Template,

View File

@ -7,12 +7,10 @@
*/
import * as DropdownMenuPrimitive from "@radix-ui/react-dropdown-menu";
import { Button } from "components/Button/Button";
import { Check, ChevronDownIcon, ChevronRight, Circle } from "lucide-react";
import { Check, ChevronRight, Circle } from "lucide-react";
import {
type ComponentPropsWithoutRef,
type ElementRef,
type FC,
type HTMLAttributes,
forwardRef,
} from "react";

View File

@ -1,13 +1,3 @@
/**
* @file A global error boundary designed to work with React Router.
*
* This is not documented well, but because of React Router works, it will
* automatically intercept any render errors produced in routes, and will
* "swallow" them, preventing the errors from bubbling up to any error
* boundaries above the router. The global error boundary must be explicitly
* bound to a route to work as expected.
*/
import type { Interpolation } from "@emotion/react";
import Link from "@mui/material/Link";
import { Button } from "components/Button/Button";
import { CoderIcon } from "components/Icons/CoderIcon";

View File

@ -1,11 +1,6 @@
import data from "@emoji-mart/data/sets/15/apple.json";
import EmojiMart from "@emoji-mart/react";
import {
type ComponentProps,
type FC,
useEffect,
useLayoutEffect,
} from "react";
import { type ComponentProps, type FC, useEffect } from "react";
import icons from "theme/icons.json";
const custom = [

View File

@ -88,7 +88,7 @@ const FeatureIcon: FC = () => {
};
const styles = {
root: (theme) => ({
root: {
display: "flex",
flexDirection: "row",
alignItems: "center",
@ -96,7 +96,7 @@ const styles = {
padding: "24px 36px",
borderRadius: 8,
gap: 18,
}),
},
title: {
fontWeight: 600,
fontFamily: "inherit",

View File

@ -1,5 +1,4 @@
import type { Meta, StoryObj } from "@storybook/react";
import { userEvent } from "@storybook/test";
import {
Select,
SelectContent,

View File

@ -1,5 +1,4 @@
import { useTheme } from "@emotion/react";
import LaunchOutlined from "@mui/icons-material/LaunchOutlined";
import { Button } from "components/Button/Button";
import { Stack } from "components/Stack/Stack";
import { SquareArrowOutUpRightIcon } from "lucide-react";

View File

@ -1,7 +1,6 @@
import { type Interpolation, type Theme, css, useTheme } from "@emotion/react";
import MenuItem from "@mui/material/MenuItem";
import { Button } from "components/Button/Button";
import { FeatureStageBadge } from "components/FeatureStageBadge/FeatureStageBadge";
import {
Popover,
PopoverContent,

View File

@ -2,7 +2,6 @@ import type { Meta, StoryObj } from "@storybook/react";
import { fn, userEvent, within } from "@storybook/test";
import { PointerEventsCheckLevel } from "@testing-library/user-event";
import type { FC } from "react";
import { chromaticWithTablet } from "testHelpers/chromatic";
import {
MockPrimaryWorkspaceProxy,
MockProxyLatencies,

View File

@ -13,7 +13,6 @@ import {
DropdownMenuSeparator,
DropdownMenuTrigger,
} from "components/DropdownMenu/DropdownMenu";
import { FeatureStageBadge } from "components/FeatureStageBadge/FeatureStageBadge";
import { displayError } from "components/GlobalSnackbar/utils";
import { Latency } from "components/Latency/Latency";
import type { ProxyContextValue } from "contexts/ProxyContext";

View File

@ -2,7 +2,6 @@ import type { Theme } from "@emotion/react";
import AlertTitle from "@mui/material/AlertTitle";
import { Alert, type AlertColor } from "components/Alert/Alert";
import { AlertDetail } from "components/Alert/Alert";
import { Stack } from "components/Stack/Stack";
import { ProvisionerTag } from "modules/provisioners/ProvisionerTag";
import type { FC } from "react";

View File

@ -1,7 +1,6 @@
import TextField from "@mui/material/TextField";
import type { ProvisionerDaemon } from "api/typesGenerated";
import { Button } from "components/Button/Button";
import { Input } from "components/Input/Input";
import { PlusIcon } from "lucide-react";
import { ProvisionerTag } from "modules/provisioners/ProvisionerTag";
import { type FC, useRef, useState } from "react";

View File

@ -1,5 +1,4 @@
import Link from "@mui/material/Link";
import type * as TypesGen from "api/typesGenerated";
import { TerminalIcon } from "components/Icons/TerminalIcon";
import type { FC, MouseEvent } from "react";
import { generateRandomString } from "utils/random";

View File

@ -1,8 +1,7 @@
import { authMethods, createUser } from "api/queries/users";
import { displaySuccess } from "components/GlobalSnackbar/utils";
import { Margins } from "components/Margins/Margins";
import { useDebouncedFunction } from "hooks/debounce";
import { type FC, useState } from "react";
import type { FC } from "react";
import { Helmet } from "react-helmet-async";
import { useMutation, useQuery, useQueryClient } from "react-query";
import { useNavigate } from "react-router-dom";

View File

@ -134,7 +134,7 @@ const CreateWorkspacePage: FC = () => {
});
onCreateWorkspace(newWorkspace);
} catch (err) {
} catch {
setMode("form");
}
});

View File

@ -1,4 +1,3 @@
import { Loader } from "components/Loader/Loader";
import { useDeploymentSettings } from "modules/management/DeploymentSettingsProvider";
import type { FC } from "react";
import { Helmet } from "react-helmet-async";

View File

@ -1,5 +1,4 @@
import { deploymentDAUs } from "api/queries/deployment";
import { entitlements } from "api/queries/entitlements";
import { availableExperiments, experiments } from "api/queries/experiments";
import { useEmbeddedMetadata } from "hooks/useEmbeddedMetadata";
import { useDeploymentSettings } from "modules/management/DeploymentSettingsProvider";

View File

@ -1,7 +1,6 @@
import AlertTitle from "@mui/material/AlertTitle";
import type {
DAUsResponse,
Entitlements,
Experiments,
SerpentOption,
} from "api/typesGenerated";

View File

@ -1,4 +1,3 @@
import { Loader } from "components/Loader/Loader";
import { useDeploymentSettings } from "modules/management/DeploymentSettingsProvider";
import type { FC } from "react";
import { Helmet } from "react-helmet-async";

View File

@ -11,7 +11,6 @@ import { TabLink, Tabs, TabsList } from "components/Tabs/Tabs";
import { useSearchParamsKey } from "hooks/useSearchParamsKey";
import { useDeploymentSettings } from "modules/management/DeploymentSettingsProvider";
import { castNotificationMethod } from "modules/notifications/utils";
import { Section } from "pages/UserSettingsPage/Section";
import type { FC } from "react";
import { Helmet } from "react-helmet-async";
import { useQueries } from "react-query";

View File

@ -28,7 +28,7 @@ const CreateOAuth2AppPage: FC = () => {
`Successfully added the OAuth2 application "${app.name}".`,
);
navigate(`/deployment/oauth2-provider/apps/${app.id}?created=true`);
} catch (ignore) {
} catch {
displayError("Failed to create OAuth2 application");
}
}}

View File

@ -1,4 +1,3 @@
import KeyboardArrowLeft from "@mui/icons-material/KeyboardArrowLeft";
import type * as TypesGen from "api/typesGenerated";
import { ErrorAlert } from "components/Alert/ErrorAlert";
import { Button } from "components/Button/Button";

View File

@ -62,7 +62,7 @@ const EditOAuth2AppPage: FC = () => {
`Successfully updated the OAuth2 application "${req.name}".`,
);
navigate("/deployment/oauth2-provider/apps?updated=true");
} catch (ignore) {
} catch {
displayError("Failed to update OAuth2 application");
}
}}
@ -73,7 +73,7 @@ const EditOAuth2AppPage: FC = () => {
`You have successfully deleted the OAuth2 application "${name}"`,
);
navigate("/deployment/oauth2-provider/apps?deleted=true");
} catch (error) {
} catch {
displayError("Failed to delete OAuth2 application");
}
}}
@ -82,7 +82,7 @@ const EditOAuth2AppPage: FC = () => {
const secret = await postSecretMutation.mutateAsync(appId);
displaySuccess("Successfully generated OAuth2 client secret");
setFullNewSecret(secret);
} catch (ignore) {
} catch {
displayError("Failed to generate OAuth2 client secret");
}
}}
@ -93,7 +93,7 @@ const EditOAuth2AppPage: FC = () => {
if (fullNewSecret?.id === secretId) {
setFullNewSecret(undefined);
}
} catch (ignore) {
} catch {
displayError("Failed to delete OAuth2 client secret");
}
}}

View File

@ -1,4 +1,3 @@
import { Loader } from "components/Loader/Loader";
import { useDashboard } from "modules/dashboard/useDashboard";
import { useDeploymentSettings } from "modules/management/DeploymentSettingsProvider";
import type { FC } from "react";

View File

@ -1,4 +1,3 @@
import { Loader } from "components/Loader/Loader";
import { useDeploymentSettings } from "modules/management/DeploymentSettingsProvider";
import type { FC } from "react";
import { Helmet } from "react-helmet-async";

View File

@ -1,4 +1,4 @@
import { type Interpolation, type Theme, useTheme } from "@emotion/react";
import type { Interpolation, Theme } from "@emotion/react";
import AddIcon from "@mui/icons-material/AddOutlined";
import AddOutlined from "@mui/icons-material/AddOutlined";
import Button from "@mui/material/Button";

View File

@ -8,7 +8,6 @@ import {
roleIdpSyncSettings,
} from "api/queries/organizations";
import { organizationRoles } from "api/queries/roles";
import type { GroupSyncSettings, RoleSyncSettings } from "api/typesGenerated";
import { ChooseOne, Cond } from "components/Conditionals/ChooseOne";
import { EmptyState } from "components/EmptyState/EmptyState";
import { displayError } from "components/GlobalSnackbar/utils";

View File

@ -1,4 +1,4 @@
import { screen, within } from "@testing-library/react";
import { screen } from "@testing-library/react";
import { http, HttpResponse } from "msw";
import {
MockDefaultOrganization,

View File

@ -1,4 +1,3 @@
import type { Interpolation, Theme } from "@emotion/react";
import TextField from "@mui/material/TextField";
import { isApiValidationError } from "api/errors";
import type {

View File

@ -1,5 +1,5 @@
import { provisionerDaemons } from "api/queries/organizations";
import type { Organization, ProvisionerDaemon } from "api/typesGenerated";
import type { ProvisionerDaemon } from "api/typesGenerated";
import { Avatar } from "components/Avatar/Avatar";
import { Button } from "components/Button/Button";
import { EmptyState } from "components/EmptyState/EmptyState";

View File

@ -1,5 +1,5 @@
import { provisionerJobs } from "api/queries/organizations";
import type { Organization, ProvisionerJob } from "api/typesGenerated";
import type { ProvisionerJob } from "api/typesGenerated";
import { Avatar } from "components/Avatar/Avatar";
import { Badge } from "components/Badge/Badge";
import { Button } from "components/Button/Button";

View File

@ -17,9 +17,7 @@ import {
PopoverContent,
PopoverTrigger,
} from "components/deprecated/Popover/Popover";
import { ChevronDownIcon, ChevronRightIcon } from "lucide-react";
import { type FC, useEffect, useState } from "react";
import { cn } from "utils/cn";
const roleDescriptions: Record<string, string> = {
owner:

View File

@ -1,5 +1,5 @@
import type { Meta, StoryObj } from "@storybook/react";
import { expect, spyOn, userEvent, within } from "@storybook/test";
import { spyOn, userEvent, within } from "@storybook/test";
import { API } from "api/api";
import { mockApiError } from "testHelpers/entities";
import { withGlobalSnackbar } from "testHelpers/storybook";

View File

@ -2,7 +2,7 @@ import type { Interpolation, Theme } from "@emotion/react";
import LoadingButton from "@mui/lab/LoadingButton";
import Button from "@mui/material/Button";
import TextField from "@mui/material/TextField";
import { isApiError, isApiValidationError } from "api/errors";
import { isApiValidationError } from "api/errors";
import { changePasswordWithOTP } from "api/queries/users";
import { ErrorAlert } from "components/Alert/ErrorAlert";
import { CustomLogo } from "components/CustomLogo/CustomLogo";

View File

@ -2,11 +2,9 @@ import { type Interpolation, type Theme, useTheme } from "@emotion/react";
import LoadingButton from "@mui/lab/LoadingButton";
import Button from "@mui/material/Button";
import TextField from "@mui/material/TextField";
import { getErrorMessage } from "api/errors";
import { requestOneTimePassword } from "api/queries/users";
import { ErrorAlert } from "components/Alert/ErrorAlert";
import { CustomLogo } from "components/CustomLogo/CustomLogo";
import { displayError } from "components/GlobalSnackbar/utils";
import { Stack } from "components/Stack/Stack";
import type { FC } from "react";
import { Helmet } from "react-helmet-async";

View File

@ -3,7 +3,7 @@ import { authMethods, createFirstUser } from "api/queries/users";
import { Loader } from "components/Loader/Loader";
import { useAuthContext } from "contexts/auth/AuthProvider";
import { useEmbeddedMetadata } from "hooks/useEmbeddedMetadata";
import { type FC, useEffect, useState } from "react";
import { type FC, useEffect } from "react";
import { Helmet } from "react-helmet-async";
import { useMutation, useQuery } from "react-query";
import { Navigate, useNavigate } from "react-router-dom";

View File

@ -17,7 +17,7 @@ import { PasswordField } from "components/PasswordField/PasswordField";
import { SignInLayout } from "components/SignInLayout/SignInLayout";
import { Stack } from "components/Stack/Stack";
import { type FormikContextType, useFormik } from "formik";
import { type ChangeEvent, type FC, useCallback } from "react";
import type { ChangeEvent, FC } from "react";
import { docs } from "utils/docs";
import {
getFormHelpers,

View File

@ -1,6 +1,5 @@
import type { Meta, StoryObj } from "@storybook/react";
import { chromatic } from "testHelpers/chromatic";
import { MockEntitlementsWithUserLimit } from "testHelpers/entities";
import { TemplateInsightsPageView } from "./TemplateInsightsPage";
const meta: Meta<typeof TemplateInsightsPageView> = {

View File

@ -1,7 +1,7 @@
import { screen, waitFor } from "@testing-library/react";
import userEvent from "@testing-library/user-event";
import { API, withDefaultFeatures } from "api/api";
import type { Template, UpdateTemplateMeta } from "api/typesGenerated";
import type { UpdateTemplateMeta } from "api/typesGenerated";
import { http, HttpResponse } from "msw";
import {
MockEntitlements,

View File

@ -1,5 +1,4 @@
import Inventory2 from "@mui/icons-material/Inventory2";
import NoteAddOutlined from "@mui/icons-material/NoteAddOutlined";
import UploadOutlined from "@mui/icons-material/UploadOutlined";
import { Button } from "components/Button/Button";
import {

View File

@ -21,7 +21,6 @@ import type {
} from "api/typesGenerated";
import { ErrorAlert } from "components/Alert/ErrorAlert";
import { Avatar } from "components/Avatar/Avatar";
import { AvatarData } from "components/Avatar/AvatarData";
import { Loader } from "components/Loader/Loader";
import {
MoreMenu,

View File

@ -1,12 +1,11 @@
import type { Meta, StoryObj } from "@storybook/react";
import { expect, spyOn, userEvent, waitFor, within } from "@storybook/test";
import { expect, spyOn, userEvent, within } from "@storybook/test";
import { API } from "api/api";
import {
notificationDispatchMethodsKey,
systemNotificationTemplatesKey,
userNotificationPreferencesKey,
} from "api/queries/notifications";
import { http, HttpResponse } from "msw";
import { reactRouterParameters } from "storybook-addon-remix-react-router";
import {
MockNotificationMethodsResponse,

View File

@ -8,7 +8,6 @@ import TableRow from "@mui/material/TableRow";
import type * as TypesGen from "api/typesGenerated";
import { ErrorAlert } from "components/Alert/ErrorAlert";
import { Avatar } from "components/Avatar/Avatar";
import { AvatarData } from "components/Avatar/AvatarData";
import { Stack } from "components/Stack/Stack";
import { TableLoader } from "components/TableLoader/TableLoader";
import type { FC } from "react";

View File

@ -1,13 +1,11 @@
import LoadingButton from "@mui/lab/LoadingButton";
import TextField from "@mui/material/TextField";
import type * as TypesGen from "api/typesGenerated";
import { Alert } from "components/Alert/Alert";
import { ErrorAlert } from "components/Alert/ErrorAlert";
import { Form, FormFields } from "components/Form/Form";
import { PasswordField } from "components/PasswordField/PasswordField";
import { type FormikContextType, useFormik } from "formik";
import type { FC } from "react";
import { useEffect } from "react";
import { getFormHelpers } from "utils/formUtils";
import * as Yup from "yup";

View File

@ -7,10 +7,7 @@ import {
type UseFilterMenuOptions,
useFilterMenu,
} from "components/Filter/menu";
import {
StatusIndicator,
StatusIndicatorDot,
} from "components/StatusIndicator/StatusIndicator";
import { StatusIndicatorDot } from "components/StatusIndicator/StatusIndicator";
import type { FC } from "react";
import { docs } from "utils/docs";

View File

@ -23,12 +23,7 @@ import { useDashboard } from "modules/dashboard/useDashboard";
import { type FC, useState } from "react";
import { Helmet } from "react-helmet-async";
import { useMutation, useQuery, useQueryClient } from "react-query";
import {
Navigate,
useLocation,
useNavigate,
useSearchParams,
} from "react-router-dom";
import { useLocation, useNavigate, useSearchParams } from "react-router-dom";
import { pageTitle } from "utils/page";
import { generateRandomString } from "utils/random";
import { ResetPasswordDialog } from "./ResetPasswordDialog";

View File

@ -5,7 +5,6 @@ import { ProxyContext, getPreferredProxy } from "contexts/ProxyContext";
import * as Mocks from "testHelpers/entities";
import { withDashboardProvider } from "testHelpers/storybook";
import { Workspace } from "./Workspace";
import { WorkspaceBuildLogsSection } from "./WorkspaceBuildLogsSection";
import type { WorkspacePermissions } from "./permissions";
const permissions: WorkspacePermissions = {

View File

@ -1,4 +1,3 @@
import ArrowForwardOutlined from "@mui/icons-material/ArrowForwardOutlined";
import type { Template } from "api/typesGenerated";
import { Avatar } from "components/Avatar/Avatar";
import { Button } from "components/Button/Button";

View File

@ -11,7 +11,6 @@ import {
useFilterMenu,
} from "components/Filter/menu";
import {
StatusIndicator,
StatusIndicatorDot,
type StatusIndicatorDotProps,
} from "components/StatusIndicator/StatusIndicator";