Skip to content

Commit

Permalink
chore(imports) avoid react import
Browse files Browse the repository at this point in the history
Signed-off-by: David Edler <[email protected]>
  • Loading branch information
edlerd committed Feb 15, 2024
1 parent 7138f0f commit a5ea2e7
Show file tree
Hide file tree
Showing 281 changed files with 282 additions and 295 deletions.
1 change: 1 addition & 0 deletions .eslintrc.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -35,5 +35,6 @@ module.exports = {
semi: ["error", "always"],
"object-curly-spacing": ["error", "always"],
"@typescript-eslint/no-unused-vars": ["error", { argsIgnorePattern: "^_" }],
"react/react-in-jsx-scope": "off",
},
};
2 changes: 1 addition & 1 deletion src/App.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React, { FC, lazy, Suspense } from "react";
import { FC, lazy, Suspense } from "react";
import { Navigate, Route, Routes } from "react-router-dom";
import Loader from "components/Loader";
import ProjectRedirect from "pages/projects/ProjectRedirect";
Expand Down
2 changes: 1 addition & 1 deletion src/Root.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React, { FC } from "react";
import { FC } from "react";
import Navigation from "components/Navigation";
import { QueuedNotification } from "@canonical/react-components";
import { QueryClient, QueryClientProvider } from "@tanstack/react-query";
Expand Down
2 changes: 1 addition & 1 deletion src/components/Animate.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React, {
import {
FC,
PropsWithChildren,
useLayoutEffect,
Expand Down
2 changes: 1 addition & 1 deletion src/components/Aside.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React, { FC, ReactNode } from "react";
import { FC, ReactNode } from "react";
import classnames from "classnames";
import { Spinner } from "@canonical/react-components";

Expand Down
2 changes: 1 addition & 1 deletion src/components/AutoExpandingTextArea.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React, { FC, useLayoutEffect } from "react";
import { FC, useLayoutEffect } from "react";
import { Textarea, TextareaProps } from "@canonical/react-components";

type Props = {
Expand Down
2 changes: 1 addition & 1 deletion src/components/BaseLayout.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React, { FC, ReactNode } from "react";
import { FC, ReactNode } from "react";
import classnames from "classnames";

interface Props {
Expand Down
4 changes: 2 additions & 2 deletions src/components/ConfigurationRow.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React, { ReactElement, ReactNode } from "react";
import { cloneElement, ReactElement, ReactNode } from "react";
import { Button, Icon, Label, Tooltip } from "@canonical/react-components";
import { CpuLimit, MemoryLimit } from "types/limits";
import { MainTableRow } from "@canonical/react-components/dist/components/MainTable/MainTable";
Expand Down Expand Up @@ -74,7 +74,7 @@ export const getConfigurationRow = ({
<div className="override-form">
{wrapDisabledTooltip(
<div>
{React.cloneElement(children, {
{cloneElement(children, {
id: name,
name,
onBlur: formik.handleBlur,
Expand Down
2 changes: 1 addition & 1 deletion src/components/ConfigurationTable.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React, { FC, ReactNode } from "react";
import { FC, ReactNode } from "react";
import { MainTable, MainTableProps } from "@canonical/react-components";
import { MainTableRow } from "@canonical/react-components/dist/components/MainTable/MainTable";

Expand Down
2 changes: 1 addition & 1 deletion src/components/ConfirmationForce.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React, { Dispatch, FC, SetStateAction } from "react";
import { Dispatch, FC, SetStateAction } from "react";
import { CheckboxInput } from "@canonical/react-components";

interface Props {
Expand Down
2 changes: 1 addition & 1 deletion src/components/CustomLayout.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React, { FC, ReactNode } from "react";
import { FC, ReactNode } from "react";
import classnames from "classnames";

interface Props {
Expand Down
2 changes: 1 addition & 1 deletion src/components/DetailPanel.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React, { FC, ReactNode } from "react";
import { FC, ReactNode } from "react";
import { Button, Icon } from "@canonical/react-components";
import classnames from "classnames";
import Aside from "./Aside";
Expand Down
2 changes: 1 addition & 1 deletion src/components/ErrorBoundary.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React, { FC } from "react";
import { FC } from "react";
import type { PropsWithChildren } from "react";
import { Component } from "react";

Expand Down
2 changes: 1 addition & 1 deletion src/components/ErrorPage.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React, { FC, useEffect } from "react";
import { FC, useEffect } from "react";
import {
CodeSnippet,
CodeSnippetBlockAppearance,
Expand Down
2 changes: 1 addition & 1 deletion src/components/ExpandableList.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React, { FC, ReactNode, useState } from "react";
import { FC, ReactNode, useState } from "react";
import { Button } from "@canonical/react-components";

const DISPLAY_COUNT = 5;
Expand Down
2 changes: 1 addition & 1 deletion src/components/HelpLink.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React, { FC, ReactNode } from "react";
import { FC, ReactNode } from "react";
import { Icon } from "@canonical/react-components";

interface Props {
Expand Down
2 changes: 1 addition & 1 deletion src/components/ItemName.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React, { FC } from "react";
import { FC } from "react";

interface Props {
item: {
Expand Down
2 changes: 1 addition & 1 deletion src/components/Loader.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React, { FC } from "react";
import { FC } from "react";
import { Spinner } from "@canonical/react-components";

interface Props {
Expand Down
2 changes: 1 addition & 1 deletion src/components/Logo.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React, { FC } from "react";
import { FC } from "react";
import { useProject } from "context/project";
import { NavLink } from "react-router-dom";

Expand Down
2 changes: 1 addition & 1 deletion src/components/Meter.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React, { FC } from "react";
import { FC } from "react";

interface Props {
percentage: number;
Expand Down
2 changes: 1 addition & 1 deletion src/components/Navigation.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React, { FC, MouseEvent, useEffect, useState } from "react";
import { FC, MouseEvent, useEffect, useState } from "react";
import { NavLink } from "react-router-dom";
import { Button, Icon } from "@canonical/react-components";
import { useAuth } from "context/auth";
Expand Down
2 changes: 1 addition & 1 deletion src/components/NoMatch.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React, { FC } from "react";
import { FC } from "react";
import { Row, Col } from "@canonical/react-components";
import CustomLayout from "./CustomLayout";

Expand Down
2 changes: 1 addition & 1 deletion src/components/NotificationRow.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React, { FC } from "react";
import { FC } from "react";
import { NotificationConsumer, Row } from "@canonical/react-components";

const NotificationRow: FC = () => {
Expand Down
2 changes: 1 addition & 1 deletion src/components/OperationStatus.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { Icon } from "@canonical/react-components";
import { useOperations } from "context/operationsProvider";
import React, { useState } from "react";
import { useState } from "react";
import { isWidthBelow } from "util/helpers";
import useEventListener from "@use-it/event-listener";
import { Link } from "react-router-dom";
Expand Down
2 changes: 1 addition & 1 deletion src/components/PageHeader.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React, { FC, PropsWithChildren } from "react";
import { FC, PropsWithChildren } from "react";

const Left: FC<PropsWithChildren> = ({ children }) => {
return <div className="page-header__left">{children}</div>;
Expand Down
2 changes: 1 addition & 1 deletion src/components/PanelHeader.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React, { FC, MouseEvent, ReactNode } from "react";
import { FC, MouseEvent, ReactNode } from "react";
import usePanelParams from "util/usePanelParams";
import { Button, Icon } from "@canonical/react-components";

Expand Down
1 change: 0 additions & 1 deletion src/components/Panels.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import React from "react";
import useEventListener from "@use-it/event-listener";
import usePanelParams, { panels } from "util/usePanelParams";
import InstanceDetailPanel from "pages/instances/InstanceDetailPanel";
Expand Down
2 changes: 1 addition & 1 deletion src/components/ProgressBar.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React, { FC } from "react";
import { FC } from "react";

interface Props {
percentage: number;
Expand Down
1 change: 0 additions & 1 deletion src/components/ProtectedRoute.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import React from "react";
import { Navigate } from "react-router-dom";
import { useAuth } from "context/auth";
import Loader from "./Loader";
Expand Down
2 changes: 1 addition & 1 deletion src/components/RenameHeader.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React, { FC, ReactNode } from "react";
import { FC, ReactNode } from "react";
import { Button, Input, Tooltip } from "@canonical/react-components";
import SubmitButton from "components/SubmitButton";
import { FormikProps } from "formik/dist/types";
Expand Down
2 changes: 1 addition & 1 deletion src/components/ScrollableContainer.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React, { DependencyList, FC, ReactNode, useEffect, useRef } from "react";
import { DependencyList, FC, ReactNode, useEffect, useRef } from "react";
import useEventListener from "@use-it/event-listener";
import { getAbsoluteHeightBelow, getParentsBottomSpacing } from "util/helpers";

Expand Down
2 changes: 1 addition & 1 deletion src/components/ScrollableForm.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React, { FC, ReactNode } from "react";
import { FC, ReactNode } from "react";
import ScrollableContainer from "./ScrollableContainer";
import { useNotify } from "@canonical/react-components";

Expand Down
2 changes: 1 addition & 1 deletion src/components/ScrollableTable.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React, { DependencyList, FC, ReactNode, useEffect } from "react";
import { DependencyList, FC, ReactNode, useEffect } from "react";
import useEventListener from "@use-it/event-listener";
import { getAbsoluteHeightBelow, getParentsBottomSpacing } from "util/helpers";

Expand Down
2 changes: 1 addition & 1 deletion src/components/SelectableMainTable.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React, { FC } from "react";
import { FC } from "react";
import {
MainTableRow,
Props as MainTableProps,
Expand Down
2 changes: 1 addition & 1 deletion src/components/SelectedTableNotification.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React, { FC } from "react";
import { FC } from "react";
import { Button } from "@canonical/react-components";

interface Props {
Expand Down
2 changes: 1 addition & 1 deletion src/components/SnapshotDiabledWarningLink.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { Icon } from "@canonical/react-components";
import { useAuth } from "context/auth";
import React, { FC } from "react";
import { FC } from "react";
import { Link } from "react-router-dom";
import { LxdProject } from "types/project";

Expand Down
2 changes: 1 addition & 1 deletion src/components/SnapshotScheduleInput.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React, { FC, useState } from "react";
import { FC, useState } from "react";
import { Input, RadioInput, Select } from "@canonical/react-components";

const snapshotOptions = [
Expand Down
2 changes: 1 addition & 1 deletion src/components/StatusBar.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React, { FC } from "react";
import { FC } from "react";
import classnames from "classnames";
import Version from "./Version";
import OperationStatus from "./OperationStatus";
Expand Down
2 changes: 1 addition & 1 deletion src/components/SubmitButton.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React, { FC, MouseEventHandler } from "react";
import { FC, MouseEventHandler } from "react";
import { Button, Icon } from "@canonical/react-components";
import classnames from "classnames";

Expand Down
2 changes: 1 addition & 1 deletion src/components/TabLinks.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React, { FC } from "react";
import { FC } from "react";
import { Tabs } from "@canonical/react-components";
import { useNotify } from "@canonical/react-components";
import { useNavigate } from "react-router-dom";
Expand Down
2 changes: 1 addition & 1 deletion src/components/TableColumnsSelect.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React, { ReactElement } from "react";
import { ReactElement } from "react";
import {
CheckboxInput,
ContextualMenu,
Expand Down
2 changes: 1 addition & 1 deletion src/components/ToastNotification.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { Notification } from "@canonical/react-components";
import { DefaultTitles } from "@canonical/react-components/dist/components/Notification/Notification";
import { ToastNotificationType } from "context/toastNotificationProvider";
import React, { FC } from "react";
import { FC } from "react";
import { createPortal } from "react-dom";
import Animate from "./Animate";

Expand Down
2 changes: 1 addition & 1 deletion src/components/ToastNotificationList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import {
GroupedNotificationCount,
ToastNotificationType,
} from "context/toastNotificationProvider";
import React, { FC, useLayoutEffect, useRef, useState } from "react";
import { FC, useLayoutEffect, useRef, useState } from "react";
import { createPortal } from "react-dom";
import { iconLookup, severityOrder } from "util/notifications";
import Animate from "./Animate";
Expand Down
2 changes: 1 addition & 1 deletion src/components/Version.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React, { FC } from "react";
import { FC } from "react";
import { Icon, Tooltip } from "@canonical/react-components";
import { useSettings } from "context/useSettings";
import { RECENT_MAJOR_SERVER_VERSION, UI_VERSION } from "util/version";
Expand Down
2 changes: 1 addition & 1 deletion src/components/Xterm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
*/

import React, {
import {
forwardRef,
useEffect,
useImperativeHandle,
Expand Down
2 changes: 1 addition & 1 deletion src/components/forms/CloudInitConfig.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React, { FC } from "react";
import { FC } from "react";
import YamlForm from "components/forms/YamlForm";

interface Props {
Expand Down
2 changes: 1 addition & 1 deletion src/components/forms/CloudInitForm.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React, { FC } from "react";
import { FC } from "react";
import { Icon, Tooltip } from "@canonical/react-components";
import CloudInitConfig from "components/forms/CloudInitConfig";
import {
Expand Down
2 changes: 1 addition & 1 deletion src/components/forms/CpuLimitSelector.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React, { FC } from "react";
import { FC } from "react";
import { Input, RadioInput, useNotify } from "@canonical/react-components";
import { fetchResources } from "api/server";
import { useQuery } from "@tanstack/react-query";
Expand Down
2 changes: 1 addition & 1 deletion src/components/forms/DiskDeviceForm.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React, { FC } from "react";
import { FC } from "react";
import { Input, useNotify } from "@canonical/react-components";
import { useQuery } from "@tanstack/react-query";
import { queryKeys } from "util/queryKeys";
Expand Down
2 changes: 1 addition & 1 deletion src/components/forms/DiskDeviceFormCustom.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React, { FC } from "react";
import { FC } from "react";
import { Icon, Input, Label } from "@canonical/react-components";
import { InstanceAndProfileFormikProps } from "./instanceAndProfileFormValues";
import { EditInstanceFormValues } from "pages/instances/EditInstance";
Expand Down
2 changes: 1 addition & 1 deletion src/components/forms/DiskDeviceFormInherited.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React, { FC } from "react";
import { FC } from "react";
import { Button, Icon } from "@canonical/react-components";
import { InstanceAndProfileFormikProps } from "./instanceAndProfileFormValues";
import ConfigurationTable from "components/ConfigurationTable";
Expand Down
2 changes: 1 addition & 1 deletion src/components/forms/DiskDeviceFormRoot.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React, { FC } from "react";
import { FC } from "react";
import { Button, Icon } from "@canonical/react-components";
import { LxdDiskDevice } from "types/device";
import { InstanceAndProfileFormikProps } from "./instanceAndProfileFormValues";
Expand Down
2 changes: 1 addition & 1 deletion src/components/forms/DiskDeviceRow.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React, { ReactNode } from "react";
import { ReactNode } from "react";
import { Button, Icon, Label } from "@canonical/react-components";
import { getConfigurationRowBase } from "components/ConfigurationRow";
import classnames from "classnames";
Expand Down
2 changes: 1 addition & 1 deletion src/components/forms/DiskSizeSelector.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React, { FC } from "react";
import { FC } from "react";
import { Input, Select } from "@canonical/react-components";
import { BYTES_UNITS } from "types/limits";
import { parseMemoryLimit } from "util/limits";
Expand Down
2 changes: 1 addition & 1 deletion src/components/forms/FormFooterLayout.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React, { FC, PropsWithChildren } from "react";
import { FC, PropsWithChildren } from "react";

interface Props {}

Expand Down
2 changes: 1 addition & 1 deletion src/components/forms/FormMenuItem.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React, { FC } from "react";
import { FC } from "react";
import { slugify } from "util/slugify";
import { Button } from "@canonical/react-components";
import classnames from "classnames";
Expand Down
2 changes: 1 addition & 1 deletion src/components/forms/InstanceSnapshotsForm.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React, { FC, ReactNode } from "react";
import { FC, ReactNode } from "react";
import { Input, Notification, Select } from "@canonical/react-components";
import { optionYesNo } from "util/instanceOptions";
import {
Expand Down
2 changes: 1 addition & 1 deletion src/components/forms/MemoryLimitSelector.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React, { FC } from "react";
import { FC } from "react";
import {
Input,
RadioInput,
Expand Down
2 changes: 1 addition & 1 deletion src/components/forms/NetworkDevicesForm.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React, { FC } from "react";
import { FC } from "react";
import {
Button,
Icon,
Expand Down
4 changes: 2 additions & 2 deletions src/components/forms/RenameDiskDeviceInput.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React, { FC } from "react";
import { FC, useState } from "react";
import { Button, Icon, Input, Label } from "@canonical/react-components";

interface Props {
Expand All @@ -14,7 +14,7 @@ const RenameDiskDeviceInput: FC<Props> = ({
setName,
readOnly,
}) => {
const [isEditing, setEditing] = React.useState(false);
const [isEditing, setEditing] = useState(false);

if (readOnly) {
return (
Expand Down
2 changes: 1 addition & 1 deletion src/components/forms/ResourceLimitsForm.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React, { FC } from "react";
import { FC } from "react";
import { Input, Select } from "@canonical/react-components";
import { CreateInstanceFormValues } from "pages/instances/CreateInstance";
import MemoryLimitSelector from "./MemoryLimitSelector";
Expand Down
Loading

0 comments on commit a5ea2e7

Please sign in to comment.