style: restrict type import (#1589)

This commit is contained in:
Himself65
2023-03-15 11:58:43 -05:00
committed by GitHub
parent 6ab2f83e13
commit efcf1fcaa0
154 changed files with 332 additions and 307 deletions

View File

@@ -1,12 +1,14 @@
/* deepscan-disable USELESS_ARROW_FUNC_BIND */
import { __unstableSchemas, builtInSchemas } from '@blocksuite/blocks/models';
import { EditorContainer } from '@blocksuite/editor';
import { Page, Workspace } from '@blocksuite/store';
import type { EditorContainer } from '@blocksuite/editor';
import type { Page } from '@blocksuite/store';
import { Workspace } from '@blocksuite/store';
import { expect } from '@storybook/jest';
import { Meta, StoryFn } from '@storybook/react';
import type { Meta, StoryFn } from '@storybook/react';
import { useEffect, useState } from 'react';
import { BlockSuiteEditor, EditorProps } from '.';
import type { EditorProps } from '.';
import { BlockSuiteEditor } from '.';
function initPage(page: Page, editor: Readonly<EditorContainer>): void {
// Add page block and surface block at root level

View File

@@ -1,7 +1,8 @@
import { BlockHub } from '@blocksuite/blocks';
import type { BlockHub } from '@blocksuite/blocks';
import { EditorContainer } from '@blocksuite/editor';
import type { Page, Workspace } from '@blocksuite/store';
import { CSSProperties, useEffect, useRef } from 'react';
import type { CSSProperties } from 'react';
import { useEffect, useRef } from 'react';
export type EditorProps = {
blockSuiteWorkspace: Workspace;

View File

@@ -1,7 +1,7 @@
/* deepscan-disable USELESS_ARROW_FUNC_BIND */
import { Link, Typography } from '@mui/material';
import { expect } from '@storybook/jest';
import { Meta, StoryFn } from '@storybook/react';
import type { Meta, StoryFn } from '@storybook/react';
import { within } from '@storybook/testing-library';
import { Breadcrumbs } from '..';

View File

@@ -1,8 +1,8 @@
/* deepscan-disable USELESS_ARROW_FUNC_BIND */
import { Meta, StoryFn } from '@storybook/react';
import type { Meta, StoryFn } from '@storybook/react';
import { Button } from '..';
import { ButtonProps } from '../ui/button/interface';
import type { ButtonProps } from '../ui/button/interface';
export default {
title: 'AFFiNE/Button',

View File

@@ -9,7 +9,7 @@ import {
import type { PropsWithChildren } from 'react';
import { useMemo } from 'react';
import { AffineTheme } from './types';
import type { AffineTheme } from './types';
export { css, keyframes, styled };

View File

@@ -2,7 +2,7 @@ import '@emotion/react';
import type { EditorContainer } from '@blocksuite/editor';
import { AffineTheme, AffineThemeCSSVariables } from './types';
import type { AffineTheme, AffineThemeCSSVariables } from './types';
const basicFontFamily =
'apple-system, BlinkMacSystemFont,Helvetica Neue, Tahoma, PingFang SC, Microsoft Yahei, Arial,Hiragino Sans GB, sans-serif, Apple Color Emoji, Segoe UI Emoji,Segoe UI Symbol, Noto Color Emoji';

View File

@@ -1,5 +1,5 @@
import { EditorContainer } from '@blocksuite/editor';
import { CSSProperties } from 'react';
import type { EditorContainer } from '@blocksuite/editor';
import type { CSSProperties } from 'react';
export type Theme = 'light' | 'dark';
export type ThemeMode = Theme | 'auto';

View File

@@ -1,4 +1,4 @@
import { ThemeMode } from '../types';
import type { ThemeMode } from '../types';
export class LocalStorageThemeHelper {
name = 'Affine-theme-mode';

View File

@@ -1,4 +1,4 @@
import { Theme } from '../types';
import type { Theme } from '../types';
export class SystemThemeHelper {
media: MediaQueryList = window.matchMedia('(prefers-color-scheme: light)');

View File

@@ -1,6 +1,6 @@
import { Children, cloneElement, forwardRef } from 'react';
import { ButtonProps } from './interface';
import type { ButtonProps } from './interface';
import { Loading } from './Loading';
import { StyledButton } from './styles';
import { getSize } from './utils';

View File

@@ -1,11 +1,5 @@
import {
Children,
cloneElement,
CSSProperties,
forwardRef,
HTMLAttributes,
ReactElement,
} from 'react';
import type { CSSProperties, HTMLAttributes, ReactElement } from 'react';
import { Children, cloneElement, forwardRef } from 'react';
import { StyledIconButton } from './styles';
const SIZE_SMALL = 'small' as const;

View File

@@ -1,5 +1,5 @@
import { styled } from '../../styles';
import { ButtonProps } from './interface';
import type { ButtonProps } from './interface';
import { getButtonColors } from './utils';
export const LoadingContainer = styled('div')<Pick<ButtonProps, 'type'>>(
({ theme, type = 'default' }) => {

View File

@@ -1,6 +1,6 @@
import { Children, cloneElement, forwardRef } from 'react';
import { ButtonProps } from './interface';
import type { ButtonProps } from './interface';
import { StyledTextButton } from './styles';
import { getSize } from './utils';
export const TextButton = forwardRef<HTMLButtonElement, ButtonProps>(

View File

@@ -1,4 +1,4 @@
import {
import type {
CSSProperties,
HTMLAttributes,
PropsWithChildren,

View File

@@ -1,7 +1,7 @@
import { CSSProperties } from 'react';
import type { CSSProperties } from 'react';
import { absoluteCenter, displayInlineFlex, styled } from '../../styles';
import { ButtonProps } from './interface';
import type { ButtonProps } from './interface';
import { getButtonColors, getSize } from './utils';
export const StyledIconButton = styled('button', {

View File

@@ -1,11 +1,7 @@
import { Theme } from '@mui/material';
import type { Theme } from '@mui/material';
import {
ButtonProps,
SIZE_DEFAULT,
SIZE_MIDDLE,
SIZE_SMALL,
} from './interface';
import type { ButtonProps } from './interface';
import { SIZE_DEFAULT, SIZE_MIDDLE, SIZE_SMALL } from './interface';
// TODO: Designer is not sure about the size, Now, is just use default size
export const SIZE_CONFIG = {

View File

@@ -1,7 +1,8 @@
import { useTranslation } from '@affine/i18n';
import { Button } from '../button';
import { Modal, ModalCloseButton, ModalProps } from '../modal';
import type { ModalProps } from '../modal';
import { Modal, ModalCloseButton } from '../modal';
import {
StyledColumnButtonWrapper,
StyledConfirmContent,

View File

@@ -1,4 +1,4 @@
import { CSSProperties } from 'react';
import type { CSSProperties } from 'react';
import { EmptySVG } from './EmptySVG';
import { StyledEmptyContainer } from './style';

View File

@@ -1,4 +1,5 @@
import SvgIcon, { SvgIconProps } from '@mui/material/SvgIcon';
import type { SvgIconProps } from '@mui/material/SvgIcon';
import SvgIcon from '@mui/material/SvgIcon';
export const EmptySVG = (props: SvgIconProps) => {
return (

View File

@@ -1,11 +1,10 @@
import {
import type {
FocusEventHandler,
HTMLAttributes,
InputHTMLAttributes,
KeyboardEventHandler,
useEffect,
useState,
} from 'react';
import { useEffect, useState } from 'react';
import { StyledInput } from './style';
type inputProps = {

View File

@@ -1,4 +1,4 @@
import { CSSProperties } from 'react';
import type { CSSProperties } from 'react';
import { styled, textEllipsis } from '../../styles';

View File

@@ -1,5 +1,5 @@
import { TooltipProps } from '@mui/material';
import { CSSProperties } from 'react';
import type { TooltipProps } from '@mui/material';
import type { CSSProperties } from 'react';
import { Popper, type PopperProps } from '../popper';
import { StyledMenuWrapper } from './styles';

View File

@@ -1,10 +1,5 @@
import {
cloneElement,
forwardRef,
HTMLAttributes,
PropsWithChildren,
ReactElement,
} from 'react';
import type { HTMLAttributes, PropsWithChildren, ReactElement } from 'react';
import { cloneElement, forwardRef } from 'react';
import { StyledArrow, StyledMenuItem } from './styles';
export type IconMenuProps = PropsWithChildren<{

View File

@@ -1,5 +1,5 @@
import { ArrowRightSmallIcon } from '@blocksuite/icons';
import { CSSProperties } from 'react';
import type { CSSProperties } from 'react';
import { displayFlex, styled } from '../../styles';
import StyledPopperContainer from '../shared/Container';

View File

@@ -1,4 +1,4 @@
import { ModalUnstyledOwnProps } from '@mui/base/ModalUnstyled';
import type { ModalUnstyledOwnProps } from '@mui/base/ModalUnstyled';
import Fade from '@mui/material/Fade';
import { StyledBackdrop, StyledModal } from './styles';

View File

@@ -1,8 +1,9 @@
import { CloseIcon } from '@blocksuite/icons';
import { HTMLAttributes } from 'react';
import type { HTMLAttributes } from 'react';
import { styled } from '../../styles';
import { IconButton, IconButtonProps } from '../button/IconButton';
import type { IconButtonProps } from '../button/IconButton';
import { IconButton } from '../button/IconButton';
export type ModalCloseButtonProps = {
top?: number;
right?: number;

View File

@@ -1,4 +1,4 @@
import { CSSProperties } from 'react';
import type { CSSProperties } from 'react';
import { styled } from '../../styles';

View File

@@ -1,5 +1,5 @@
import ModalUnstyled from '@mui/base/ModalUnstyled';
import { CSSProperties } from 'react';
import type { CSSProperties } from 'react';
import { styled } from '../../styles';
import { Wrapper } from '../layout';

View File

@@ -1,7 +1,8 @@
import { CSSProperties, forwardRef } from 'react';
import type { CSSProperties } from 'react';
import { forwardRef } from 'react';
import { styled } from '../../styles';
import { PopperArrowProps } from './interface';
import type { PopperArrowProps } from './interface';
export const PopperArrow = forwardRef<HTMLElement, PopperArrowProps>(
function PopperArrow({ placement }, ref) {

View File

@@ -11,7 +11,7 @@ import {
} from 'react';
import { styled } from '../../styles';
import { PopperProps, VirtualElement } from './interface';
import type { PopperProps, VirtualElement } from './interface';
import { PopperArrow } from './PopoverArrow';
export const Popper = ({
children,

View File

@@ -1,4 +1,4 @@
import { PopperPlacementType } from '@mui/material';
import type { PopperPlacementType } from '@mui/material';
import { styled } from '../../styles';

View File

@@ -1,4 +1,5 @@
import { Children, HTMLAttributes, PropsWithChildren, ReactNode } from 'react';
import type { HTMLAttributes, PropsWithChildren, ReactNode } from 'react';
import { Children } from 'react';
import { StyledTable } from './styles';
const childrenHasEllipsis = (children: ReactNode | ReactNode[]): boolean => {

View File

@@ -1,4 +1,4 @@
import { HTMLAttributes, PropsWithChildren } from 'react';
import type { HTMLAttributes, PropsWithChildren } from 'react';
import { StyledTableBody } from './styles';
export const TableBody = ({

View File

@@ -1,4 +1,4 @@
import { TableCellProps } from './interface';
import type { TableCellProps } from './interface';
import { StyledTableCell } from './styles';
export const TableCell = ({ children, ...props }: TableCellProps) => {
return <StyledTableCell {...props}>{children}</StyledTableCell>;

View File

@@ -1,4 +1,4 @@
import { HTMLAttributes, PropsWithChildren } from 'react';
import type { HTMLAttributes, PropsWithChildren } from 'react';
import { StyledTableHead } from './styles';

View File

@@ -1,4 +1,4 @@
import { HTMLAttributes, PropsWithChildren } from 'react';
import type { HTMLAttributes, PropsWithChildren } from 'react';
import { StyledTableRow } from './styles';
export const TableRow = ({

View File

@@ -1,4 +1,4 @@
import { CSSProperties, HTMLAttributes, PropsWithChildren } from 'react';
import type { CSSProperties, HTMLAttributes, PropsWithChildren } from 'react';
export type TableCellProps = {
align?: 'left' | 'right' | 'center';

View File

@@ -1,5 +1,5 @@
import { styled, textEllipsis } from '../../styles';
import { TableCellProps } from './interface';
import type { TableCellProps } from './interface';
export const StyledTable = styled('table')<{ tableLayout: 'auto' | 'fixed' }>(
({ theme, tableLayout }) => {

View File

@@ -1,5 +1,6 @@
// Copyright: https://github.com/toeverything/blocksuite/commit/8032ef3ab97aefce01664b36502fc392c5db8b78#diff-bf5b41be21936f9165a8400c7f20e24d3dbc49644ba57b9258e0943f0dc1c464
import { css, html, TemplateResult } from 'lit';
import type { TemplateResult } from 'lit';
import { css, html } from 'lit';
export const sleep = (ms = 0) =>
new Promise(resolve => setTimeout(resolve, ms));