From 462a859afece1db8fb5054c247f2449882dcf44f Mon Sep 17 00:00:00 2001 From: Himself65 Date: Fri, 17 Feb 2023 22:52:14 -0600 Subject: [PATCH] style: remove unused import (#1113) --- .eslintrc.js | 2 ++ .../src/preload/components/enable-workspace-modal/index.tsx | 1 - apps/desktop/src/preload/components/icons/index.tsx | 1 - packages/component/src/components/BlockSuiteEditor.tsx | 1 - packages/component/src/stories/BlockSuiteEditor.stories.tsx | 2 +- .../component/src/stories/BlockSuiteErrorBoundary.stories.tsx | 1 - packages/component/src/stories/Breadcrumbs.stories.tsx | 1 - packages/component/src/stories/Button.stories.tsx | 1 - packages/component/src/styles/styled.tsx | 1 - packages/component/src/ui/button/Button.tsx | 1 - packages/component/src/ui/button/IconButton.tsx | 1 - packages/component/src/ui/button/Loading.tsx | 2 -- packages/component/src/ui/button/TextButton.tsx | 1 - packages/component/src/ui/confirm/Confirm.tsx | 1 - packages/component/src/ui/empty/Empty.tsx | 1 - packages/component/src/ui/empty/EmptySVG.tsx | 1 - packages/component/src/ui/input/Input.tsx | 1 - packages/component/src/ui/menu/Menu.tsx | 1 - packages/component/src/ui/menu/MenuItem.tsx | 1 - packages/component/src/ui/modal/Modal.tsx | 1 - packages/component/src/ui/modal/ModalCloseButton.tsx | 1 - packages/component/src/ui/popper/PopoverArrow.tsx | 1 - packages/component/src/ui/popper/Popper.tsx | 1 - packages/component/src/ui/table/Table.tsx | 1 - packages/component/src/ui/table/TableBody.tsx | 1 - packages/component/src/ui/table/TableCell.tsx | 1 - packages/component/src/ui/table/TableHead.tsx | 1 - packages/component/src/ui/table/TableRow.tsx | 1 - packages/component/src/ui/tooltip/Tooltip.tsx | 1 - packages/logger/pages/index.tsx | 2 -- 30 files changed, 3 insertions(+), 31 deletions(-) diff --git a/.eslintrc.js b/.eslintrc.js index 46ed530687..630cee3d94 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -11,6 +11,7 @@ module.exports = { extends: [ 'eslint:recommended', 'plugin:react/recommended', + 'plugin:react/jsx-runtime', 'plugin:@typescript-eslint/recommended', ], parser: '@typescript-eslint/parser', @@ -39,6 +40,7 @@ module.exports = { '@typescript-eslint/no-explicit-any': 'off', '@typescript-eslint/no-empty-function': 'off', '@typescript-eslint/no-unused-vars': 'off', + 'unused-imports/no-unused-imports': 'error', 'simple-import-sort/imports': 'error', 'simple-import-sort/exports': 'error', '@typescript-eslint/ban-ts-comment': 0, diff --git a/apps/desktop/src/preload/components/enable-workspace-modal/index.tsx b/apps/desktop/src/preload/components/enable-workspace-modal/index.tsx index ce058d3fc7..b32c1160cc 100644 --- a/apps/desktop/src/preload/components/enable-workspace-modal/index.tsx +++ b/apps/desktop/src/preload/components/enable-workspace-modal/index.tsx @@ -5,7 +5,6 @@ import { useTranslation } from '@affine/i18n'; import { CloseIcon } from '@blocksuite/icons'; import router from 'next/router'; import { useCallback, useState } from 'react'; -import React from 'react'; import { useGlobalState } from '@/store/app'; diff --git a/apps/desktop/src/preload/components/icons/index.tsx b/apps/desktop/src/preload/components/icons/index.tsx index ed4267da18..29b5aad57f 100644 --- a/apps/desktop/src/preload/components/icons/index.tsx +++ b/apps/desktop/src/preload/components/icons/index.tsx @@ -5,7 +5,6 @@ import { LocalWorkspaceIcon as DefaultLocalWorkspaceIcon, PublishIcon as DefaultPublishIcon, } from '@blocksuite/icons'; -import React from 'react'; // Here are some icons with special color or size export const JoinedWorkspaceIcon = () => { diff --git a/packages/component/src/components/BlockSuiteEditor.tsx b/packages/component/src/components/BlockSuiteEditor.tsx index b5d214dea5..509a94587a 100644 --- a/packages/component/src/components/BlockSuiteEditor.tsx +++ b/packages/component/src/components/BlockSuiteEditor.tsx @@ -1,5 +1,4 @@ import { Editor, EditorProps } from '@blocksuite/react/editor'; -import React from 'react'; export type BlockSuiteEditorProps = EditorProps; export const BlockSuiteEditor = (props: BlockSuiteEditorProps) => { return ; diff --git a/packages/component/src/stories/BlockSuiteEditor.stories.tsx b/packages/component/src/stories/BlockSuiteEditor.stories.tsx index a30960044d..ca20f6adca 100644 --- a/packages/component/src/stories/BlockSuiteEditor.stories.tsx +++ b/packages/component/src/stories/BlockSuiteEditor.stories.tsx @@ -2,7 +2,7 @@ import { builtInSchemas } from '@blocksuite/blocks/models'; import { Page, Workspace } from '@blocksuite/store'; import { Meta, Story } from '@storybook/react'; -import React, { Suspense } from 'react'; +import { Suspense } from 'react'; import { BlockSuiteEditor, diff --git a/packages/component/src/stories/BlockSuiteErrorBoundary.stories.tsx b/packages/component/src/stories/BlockSuiteErrorBoundary.stories.tsx index 908a69e74d..a6b1c66159 100644 --- a/packages/component/src/stories/BlockSuiteErrorBoundary.stories.tsx +++ b/packages/component/src/stories/BlockSuiteErrorBoundary.stories.tsx @@ -1,7 +1,6 @@ /* deepscan-disable USELESS_ARROW_FUNC_BIND */ import { MigrationError } from '@blocksuite/global/error'; import { Meta, StoryFn } from '@storybook/react'; -import React from 'react'; import { BlockSuiteErrorBoundary, diff --git a/packages/component/src/stories/Breadcrumbs.stories.tsx b/packages/component/src/stories/Breadcrumbs.stories.tsx index e3ac5d0cb1..14fa83a1df 100644 --- a/packages/component/src/stories/Breadcrumbs.stories.tsx +++ b/packages/component/src/stories/Breadcrumbs.stories.tsx @@ -1,7 +1,6 @@ /* deepscan-disable USELESS_ARROW_FUNC_BIND */ import { Link, Typography } from '@mui/material'; import { Meta, Story } from '@storybook/react'; -import React from 'react'; import { Breadcrumbs } from '..'; diff --git a/packages/component/src/stories/Button.stories.tsx b/packages/component/src/stories/Button.stories.tsx index a8d731ca4a..f7c935ea18 100644 --- a/packages/component/src/stories/Button.stories.tsx +++ b/packages/component/src/stories/Button.stories.tsx @@ -1,6 +1,5 @@ /* deepscan-disable USELESS_ARROW_FUNC_BIND */ import { Meta, Story } from '@storybook/react'; -import React from 'react'; import { Button } from '..'; import { ButtonProps } from '../ui/button/interface'; diff --git a/packages/component/src/styles/styled.tsx b/packages/component/src/styles/styled.tsx index 8f49ce848c..ade405c725 100644 --- a/packages/component/src/styles/styled.tsx +++ b/packages/component/src/styles/styled.tsx @@ -1,7 +1,6 @@ import { ThemeProvider as EmotionThemeProvider } from '@emotion/react'; import emotionStyled from '@emotion/styled'; import type { PropsWithChildren } from 'react'; -import React from 'react'; import { AffineTheme } from './types'; export { css, keyframes } from '@emotion/react'; diff --git a/packages/component/src/ui/button/Button.tsx b/packages/component/src/ui/button/Button.tsx index 04023057fa..e20bbdd7dd 100644 --- a/packages/component/src/ui/button/Button.tsx +++ b/packages/component/src/ui/button/Button.tsx @@ -1,5 +1,4 @@ import { Children, cloneElement, forwardRef } from 'react'; -import React from 'react'; import { ButtonProps } from './interface'; import { Loading } from './Loading'; diff --git a/packages/component/src/ui/button/IconButton.tsx b/packages/component/src/ui/button/IconButton.tsx index 4f0daf149c..56ffa30f23 100644 --- a/packages/component/src/ui/button/IconButton.tsx +++ b/packages/component/src/ui/button/IconButton.tsx @@ -6,7 +6,6 @@ import { HTMLAttributes, ReactElement, } from 'react'; -import React from 'react'; import { StyledIconButton } from './styles'; const SIZE_SMALL = 'small' as const; diff --git a/packages/component/src/ui/button/Loading.tsx b/packages/component/src/ui/button/Loading.tsx index 7d6d654be1..11cb776628 100644 --- a/packages/component/src/ui/button/Loading.tsx +++ b/packages/component/src/ui/button/Loading.tsx @@ -1,5 +1,3 @@ -import React from 'react'; - import { styled } from '../../styles'; import { ButtonProps } from './interface'; import { getButtonColors } from './utils'; diff --git a/packages/component/src/ui/button/TextButton.tsx b/packages/component/src/ui/button/TextButton.tsx index 64037c02cf..69c2859368 100644 --- a/packages/component/src/ui/button/TextButton.tsx +++ b/packages/component/src/ui/button/TextButton.tsx @@ -1,5 +1,4 @@ import { Children, cloneElement, forwardRef } from 'react'; -import React from 'react'; import { ButtonProps } from './interface'; import { StyledTextButton } from './styles'; diff --git a/packages/component/src/ui/confirm/Confirm.tsx b/packages/component/src/ui/confirm/Confirm.tsx index 2728620674..75a5488d06 100644 --- a/packages/component/src/ui/confirm/Confirm.tsx +++ b/packages/component/src/ui/confirm/Confirm.tsx @@ -1,6 +1,5 @@ import { useTranslation } from '@affine/i18n'; import { useState } from 'react'; -import React from 'react'; import { Button } from '../button'; import { Modal, ModalCloseButton, ModalProps } from '../modal'; diff --git a/packages/component/src/ui/empty/Empty.tsx b/packages/component/src/ui/empty/Empty.tsx index 1dbfb8d4a2..ade1e07e6a 100644 --- a/packages/component/src/ui/empty/Empty.tsx +++ b/packages/component/src/ui/empty/Empty.tsx @@ -1,5 +1,4 @@ import { CSSProperties } from 'react'; -import React from 'react'; import { EmptySVG } from './EmptySVG'; import { StyledEmptyContainer } from './style'; diff --git a/packages/component/src/ui/empty/EmptySVG.tsx b/packages/component/src/ui/empty/EmptySVG.tsx index 943e6af640..a6a0fce58e 100644 --- a/packages/component/src/ui/empty/EmptySVG.tsx +++ b/packages/component/src/ui/empty/EmptySVG.tsx @@ -1,5 +1,4 @@ import SvgIcon, { SvgIconProps } from '@mui/material/SvgIcon'; -import React from 'react'; export const EmptySVG = (props: SvgIconProps) => { return ( diff --git a/packages/component/src/ui/input/Input.tsx b/packages/component/src/ui/input/Input.tsx index ea9b2981c5..916f0db264 100644 --- a/packages/component/src/ui/input/Input.tsx +++ b/packages/component/src/ui/input/Input.tsx @@ -6,7 +6,6 @@ import { useEffect, useState, } from 'react'; -import React from 'react'; import { StyledInput } from './style'; type inputProps = { diff --git a/packages/component/src/ui/menu/Menu.tsx b/packages/component/src/ui/menu/Menu.tsx index fbf40a4307..a6493c797d 100644 --- a/packages/component/src/ui/menu/Menu.tsx +++ b/packages/component/src/ui/menu/Menu.tsx @@ -1,5 +1,4 @@ import { TooltipProps } from '@mui/material'; -import React from 'react'; import { Popper, type PopperProps } from '../popper'; import { StyledMenuWrapper } from './styles'; diff --git a/packages/component/src/ui/menu/MenuItem.tsx b/packages/component/src/ui/menu/MenuItem.tsx index bb5783c5e4..7c7f5eb236 100644 --- a/packages/component/src/ui/menu/MenuItem.tsx +++ b/packages/component/src/ui/menu/MenuItem.tsx @@ -5,7 +5,6 @@ import { PropsWithChildren, ReactElement, } from 'react'; -import React from 'react'; import { StyledArrow, StyledMenuItem } from './styles'; export type IconMenuProps = PropsWithChildren<{ diff --git a/packages/component/src/ui/modal/Modal.tsx b/packages/component/src/ui/modal/Modal.tsx index 3dba76ea30..c96d4e446c 100644 --- a/packages/component/src/ui/modal/Modal.tsx +++ b/packages/component/src/ui/modal/Modal.tsx @@ -1,6 +1,5 @@ import { ModalUnstyledOwnProps } from '@mui/base/ModalUnstyled'; import Fade from '@mui/material/Fade'; -import React from 'react'; import { StyledBackdrop, StyledModal } from './styles'; const Backdrop = ({ diff --git a/packages/component/src/ui/modal/ModalCloseButton.tsx b/packages/component/src/ui/modal/ModalCloseButton.tsx index 8f1ace1329..9890c8ad7d 100644 --- a/packages/component/src/ui/modal/ModalCloseButton.tsx +++ b/packages/component/src/ui/modal/ModalCloseButton.tsx @@ -1,6 +1,5 @@ import { CloseIcon } from '@blocksuite/icons'; import { HTMLAttributes } from 'react'; -import React from 'react'; import { styled } from '../../styles'; import { IconButton, IconButtonProps } from '../button/IconButton'; diff --git a/packages/component/src/ui/popper/PopoverArrow.tsx b/packages/component/src/ui/popper/PopoverArrow.tsx index f65253104a..1f49d5da52 100644 --- a/packages/component/src/ui/popper/PopoverArrow.tsx +++ b/packages/component/src/ui/popper/PopoverArrow.tsx @@ -1,5 +1,4 @@ import { forwardRef } from 'react'; -import React from 'react'; import { styled } from '../../styles'; import { PopperArrowProps } from './interface'; diff --git a/packages/component/src/ui/popper/Popper.tsx b/packages/component/src/ui/popper/Popper.tsx index b6e9760592..01791dfe8a 100644 --- a/packages/component/src/ui/popper/Popper.tsx +++ b/packages/component/src/ui/popper/Popper.tsx @@ -9,7 +9,6 @@ import { useRef, useState, } from 'react'; -import React from 'react'; import { styled } from '../../styles'; import { PopperProps, VirtualElement } from './interface'; diff --git a/packages/component/src/ui/table/Table.tsx b/packages/component/src/ui/table/Table.tsx index a9f892fc70..b14ad9ed4c 100644 --- a/packages/component/src/ui/table/Table.tsx +++ b/packages/component/src/ui/table/Table.tsx @@ -1,5 +1,4 @@ import { Children, HTMLAttributes, PropsWithChildren, ReactNode } from 'react'; -import React from 'react'; import { StyledTable } from './styles'; const childrenHasEllipsis = (children: ReactNode | ReactNode[]): boolean => { diff --git a/packages/component/src/ui/table/TableBody.tsx b/packages/component/src/ui/table/TableBody.tsx index c6bb9e425e..8b64d6e957 100644 --- a/packages/component/src/ui/table/TableBody.tsx +++ b/packages/component/src/ui/table/TableBody.tsx @@ -1,5 +1,4 @@ import { HTMLAttributes, PropsWithChildren } from 'react'; -import React from 'react'; import { StyledTableBody } from './styles'; export const TableBody = ({ diff --git a/packages/component/src/ui/table/TableCell.tsx b/packages/component/src/ui/table/TableCell.tsx index e9c788f770..390ac4afd1 100644 --- a/packages/component/src/ui/table/TableCell.tsx +++ b/packages/component/src/ui/table/TableCell.tsx @@ -1,5 +1,4 @@ import { HTMLAttributes, PropsWithChildren } from 'react'; -import React from 'react'; import { TableCellProps } from './interface'; import { StyledTableCell } from './styles'; diff --git a/packages/component/src/ui/table/TableHead.tsx b/packages/component/src/ui/table/TableHead.tsx index 1a284094f0..c2cf83d01a 100644 --- a/packages/component/src/ui/table/TableHead.tsx +++ b/packages/component/src/ui/table/TableHead.tsx @@ -1,5 +1,4 @@ import { HTMLAttributes, PropsWithChildren } from 'react'; -import React from 'react'; import { StyledTableHead } from './styles'; diff --git a/packages/component/src/ui/table/TableRow.tsx b/packages/component/src/ui/table/TableRow.tsx index 7b8559c0e0..e8ca202546 100644 --- a/packages/component/src/ui/table/TableRow.tsx +++ b/packages/component/src/ui/table/TableRow.tsx @@ -1,5 +1,4 @@ import { HTMLAttributes, PropsWithChildren } from 'react'; -import React from 'react'; import { StyledTableRow } from './styles'; export const TableRow = ({ diff --git a/packages/component/src/ui/tooltip/Tooltip.tsx b/packages/component/src/ui/tooltip/Tooltip.tsx index 2f4b54560d..a8106e9383 100644 --- a/packages/component/src/ui/tooltip/Tooltip.tsx +++ b/packages/component/src/ui/tooltip/Tooltip.tsx @@ -1,5 +1,4 @@ import type { TooltipProps } from '@mui/material'; -import React from 'react'; import { styled } from '../../styles'; import { Popper, type PopperProps } from '../popper'; diff --git a/packages/logger/pages/index.tsx b/packages/logger/pages/index.tsx index b9a0c9da75..5e3f2d3581 100644 --- a/packages/logger/pages/index.tsx +++ b/packages/logger/pages/index.tsx @@ -1,5 +1,3 @@ -import React from 'react'; - // eslint-disable-next-line @typescript-eslint/no-restricted-imports import { Logger } from '../src';