mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-09-22 19:53:48 +08:00
style: enable react/react-in-jsx-scope lint rule (#1107)
This commit is contained in:
@@ -35,7 +35,6 @@ module.exports = {
|
|||||||
'no-empty': 'off',
|
'no-empty': 'off',
|
||||||
'no-func-assign': 'off',
|
'no-func-assign': 'off',
|
||||||
'no-cond-assign': 'off',
|
'no-cond-assign': 'off',
|
||||||
'react/react-in-jsx-scope': 'off',
|
|
||||||
'@typescript-eslint/no-non-null-assertion': 'off',
|
'@typescript-eslint/no-non-null-assertion': 'off',
|
||||||
'@typescript-eslint/no-explicit-any': 'off',
|
'@typescript-eslint/no-explicit-any': 'off',
|
||||||
'@typescript-eslint/no-empty-function': 'off',
|
'@typescript-eslint/no-empty-function': 'off',
|
||||||
|
|||||||
@@ -5,11 +5,11 @@ import { useTranslation } from '@affine/i18n';
|
|||||||
import { CloseIcon } from '@blocksuite/icons';
|
import { CloseIcon } from '@blocksuite/icons';
|
||||||
import router from 'next/router';
|
import router from 'next/router';
|
||||||
import { useCallback, useState } from 'react';
|
import { useCallback, useState } from 'react';
|
||||||
|
import React from 'react';
|
||||||
|
|
||||||
import { useGlobalState } from '@/store/app';
|
import { useGlobalState } from '@/store/app';
|
||||||
|
|
||||||
import { Content, ContentTitle, Header, StyleButton, StyleTips } from './style';
|
import { Content, ContentTitle, Header, StyleButton, StyleTips } from './style';
|
||||||
|
|
||||||
interface EnableWorkspaceModalProps {
|
interface EnableWorkspaceModalProps {
|
||||||
open: boolean;
|
open: boolean;
|
||||||
onClose: () => void;
|
onClose: () => void;
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ import {
|
|||||||
LocalWorkspaceIcon as DefaultLocalWorkspaceIcon,
|
LocalWorkspaceIcon as DefaultLocalWorkspaceIcon,
|
||||||
PublishIcon as DefaultPublishIcon,
|
PublishIcon as DefaultPublishIcon,
|
||||||
} from '@blocksuite/icons';
|
} from '@blocksuite/icons';
|
||||||
|
import React from 'react';
|
||||||
// Here are some icons with special color or size
|
// Here are some icons with special color or size
|
||||||
|
|
||||||
export const JoinedWorkspaceIcon = () => {
|
export const JoinedWorkspaceIcon = () => {
|
||||||
|
|||||||
@@ -53,39 +53,6 @@
|
|||||||
"typescript": "^4.9.5",
|
"typescript": "^4.9.5",
|
||||||
"vitest": "^0.28.5"
|
"vitest": "^0.28.5"
|
||||||
},
|
},
|
||||||
"eslintConfig": {
|
|
||||||
"root": true,
|
|
||||||
"extends": [
|
|
||||||
"eslint:recommended",
|
|
||||||
"plugin:@typescript-eslint/recommended",
|
|
||||||
"plugin:prettier/recommended"
|
|
||||||
],
|
|
||||||
"parser": "@typescript-eslint/parser",
|
|
||||||
"parserOptions": {
|
|
||||||
"project": [
|
|
||||||
"./tsconfig.json"
|
|
||||||
]
|
|
||||||
},
|
|
||||||
"plugins": [
|
|
||||||
"@typescript-eslint"
|
|
||||||
],
|
|
||||||
"rules": {
|
|
||||||
"prettier/prettier": "warn"
|
|
||||||
},
|
|
||||||
"reportUnusedDisableDirectives": true,
|
|
||||||
"ignorePatterns": [
|
|
||||||
"package/**/dist/*",
|
|
||||||
"package/**/.babelrc.js",
|
|
||||||
"package/**/sync.js",
|
|
||||||
"src/**/*.test.ts",
|
|
||||||
"**/webpack.config.js",
|
|
||||||
"**/scripts/*.js",
|
|
||||||
"**/node_modules/**",
|
|
||||||
".github/**",
|
|
||||||
"**/__tests__/**",
|
|
||||||
"**/tests/**"
|
|
||||||
]
|
|
||||||
},
|
|
||||||
"pnpm": {
|
"pnpm": {
|
||||||
"patchedDependencies": {
|
"patchedDependencies": {
|
||||||
"@tauri-apps/api@1.2.0": "patches/@tauri-apps__api@1.2.0.patch",
|
"@tauri-apps/api@1.2.0": "patches/@tauri-apps__api@1.2.0.patch",
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import { Editor, EditorProps } from '@blocksuite/react/editor';
|
import { Editor, EditorProps } from '@blocksuite/react/editor';
|
||||||
|
import React from 'react';
|
||||||
export type BlockSuiteEditorProps = EditorProps;
|
export type BlockSuiteEditorProps = EditorProps;
|
||||||
export const BlockSuiteEditor = (props: BlockSuiteEditorProps) => {
|
export const BlockSuiteEditor = (props: BlockSuiteEditorProps) => {
|
||||||
return <Editor {...props} />;
|
return <Editor {...props} />;
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
import { ThemeProvider as EmotionThemeProvider } from '@emotion/react';
|
import { ThemeProvider as EmotionThemeProvider } from '@emotion/react';
|
||||||
import emotionStyled from '@emotion/styled';
|
import emotionStyled from '@emotion/styled';
|
||||||
import type { PropsWithChildren } from 'react';
|
import type { PropsWithChildren } from 'react';
|
||||||
|
import React from 'react';
|
||||||
|
|
||||||
import { AffineTheme } from './types';
|
import { AffineTheme } from './types';
|
||||||
export { css, keyframes } from '@emotion/react';
|
export { css, keyframes } from '@emotion/react';
|
||||||
|
|||||||
@@ -1,10 +1,10 @@
|
|||||||
import { Children, cloneElement, forwardRef } from 'react';
|
import { Children, cloneElement, forwardRef } from 'react';
|
||||||
|
import React from 'react';
|
||||||
|
|
||||||
import { ButtonProps } from './interface';
|
import { ButtonProps } from './interface';
|
||||||
import { Loading } from './Loading';
|
import { Loading } from './Loading';
|
||||||
import { StyledButton } from './styles';
|
import { StyledButton } from './styles';
|
||||||
import { getSize } from './utils';
|
import { getSize } from './utils';
|
||||||
|
|
||||||
export const Button = forwardRef<HTMLButtonElement, ButtonProps>(
|
export const Button = forwardRef<HTMLButtonElement, ButtonProps>(
|
||||||
(
|
(
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -6,9 +6,9 @@ import {
|
|||||||
HTMLAttributes,
|
HTMLAttributes,
|
||||||
ReactElement,
|
ReactElement,
|
||||||
} from 'react';
|
} from 'react';
|
||||||
|
import React from 'react';
|
||||||
|
|
||||||
import { StyledIconButton } from './styles';
|
import { StyledIconButton } from './styles';
|
||||||
|
|
||||||
const SIZE_SMALL = 'small' as const;
|
const SIZE_SMALL = 'small' as const;
|
||||||
const SIZE_MIDDLE = 'middle' as const;
|
const SIZE_MIDDLE = 'middle' as const;
|
||||||
const SIZE_NORMAL = 'normal' as const;
|
const SIZE_NORMAL = 'normal' as const;
|
||||||
|
|||||||
@@ -1,7 +1,8 @@
|
|||||||
|
import React from 'react';
|
||||||
|
|
||||||
import { styled } from '../../styles';
|
import { styled } from '../../styles';
|
||||||
import { ButtonProps } from './interface';
|
import { ButtonProps } from './interface';
|
||||||
import { getButtonColors } from './utils';
|
import { getButtonColors } from './utils';
|
||||||
|
|
||||||
export const LoadingContainer = styled('div')<Pick<ButtonProps, 'type'>>(
|
export const LoadingContainer = styled('div')<Pick<ButtonProps, 'type'>>(
|
||||||
({ theme, type = 'default' }) => {
|
({ theme, type = 'default' }) => {
|
||||||
const { color } = getButtonColors(theme, type, false);
|
const { color } = getButtonColors(theme, type, false);
|
||||||
|
|||||||
@@ -1,9 +1,9 @@
|
|||||||
import { Children, cloneElement, forwardRef } from 'react';
|
import { Children, cloneElement, forwardRef } from 'react';
|
||||||
|
import React from 'react';
|
||||||
|
|
||||||
import { ButtonProps } from './interface';
|
import { ButtonProps } from './interface';
|
||||||
import { StyledTextButton } from './styles';
|
import { StyledTextButton } from './styles';
|
||||||
import { getSize } from './utils';
|
import { getSize } from './utils';
|
||||||
|
|
||||||
export const TextButton = forwardRef<HTMLButtonElement, ButtonProps>(
|
export const TextButton = forwardRef<HTMLButtonElement, ButtonProps>(
|
||||||
(
|
(
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
import { useTranslation } from '@affine/i18n';
|
import { useTranslation } from '@affine/i18n';
|
||||||
import { useState } from 'react';
|
import { useState } from 'react';
|
||||||
|
import React from 'react';
|
||||||
|
|
||||||
import { Button } from '../button';
|
import { Button } from '../button';
|
||||||
import { Modal, ModalCloseButton, ModalProps } from '../modal';
|
import { Modal, ModalCloseButton, ModalProps } from '../modal';
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
import { CSSProperties } from 'react';
|
import { CSSProperties } from 'react';
|
||||||
|
import React from 'react';
|
||||||
|
|
||||||
import { EmptySVG } from './EmptySVG';
|
import { EmptySVG } from './EmptySVG';
|
||||||
import { StyledEmptyContainer } from './style';
|
import { StyledEmptyContainer } from './style';
|
||||||
|
|
||||||
export type EmptyContentProps = {
|
export type EmptyContentProps = {
|
||||||
imageStyle?: CSSProperties;
|
imageStyle?: CSSProperties;
|
||||||
description?: string;
|
description?: string;
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
import SvgIcon, { SvgIconProps } from '@mui/material/SvgIcon';
|
import SvgIcon, { SvgIconProps } from '@mui/material/SvgIcon';
|
||||||
|
import React from 'react';
|
||||||
|
|
||||||
export const EmptySVG = (props: SvgIconProps) => {
|
export const EmptySVG = (props: SvgIconProps) => {
|
||||||
return (
|
return (
|
||||||
|
|||||||
@@ -6,9 +6,9 @@ import {
|
|||||||
useEffect,
|
useEffect,
|
||||||
useState,
|
useState,
|
||||||
} from 'react';
|
} from 'react';
|
||||||
|
import React from 'react';
|
||||||
|
|
||||||
import { StyledInput } from './style';
|
import { StyledInput } from './style';
|
||||||
|
|
||||||
type inputProps = {
|
type inputProps = {
|
||||||
value?: string;
|
value?: string;
|
||||||
placeholder?: string;
|
placeholder?: string;
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
import { TooltipProps } from '@mui/material';
|
import { TooltipProps } from '@mui/material';
|
||||||
|
import React from 'react';
|
||||||
|
|
||||||
import { Popper, type PopperProps } from '../popper';
|
import { Popper, type PopperProps } from '../popper';
|
||||||
import { StyledMenuWrapper } from './styles';
|
import { StyledMenuWrapper } from './styles';
|
||||||
|
|
||||||
export const Menu = (props: PopperProps & Omit<TooltipProps, 'title'>) => {
|
export const Menu = (props: PopperProps & Omit<TooltipProps, 'title'>) => {
|
||||||
const { content, placement = 'bottom-start', children } = props;
|
const { content, placement = 'bottom-start', children } = props;
|
||||||
return content ? (
|
return content ? (
|
||||||
|
|||||||
@@ -5,9 +5,9 @@ import {
|
|||||||
PropsWithChildren,
|
PropsWithChildren,
|
||||||
ReactElement,
|
ReactElement,
|
||||||
} from 'react';
|
} from 'react';
|
||||||
|
import React from 'react';
|
||||||
|
|
||||||
import { StyledArrow, StyledMenuItem } from './styles';
|
import { StyledArrow, StyledMenuItem } from './styles';
|
||||||
|
|
||||||
export type IconMenuProps = PropsWithChildren<{
|
export type IconMenuProps = PropsWithChildren<{
|
||||||
isDir?: boolean;
|
isDir?: boolean;
|
||||||
icon?: ReactElement;
|
icon?: ReactElement;
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
import { ModalUnstyledOwnProps } from '@mui/base/ModalUnstyled';
|
import { ModalUnstyledOwnProps } from '@mui/base/ModalUnstyled';
|
||||||
import Fade from '@mui/material/Fade';
|
import Fade from '@mui/material/Fade';
|
||||||
|
import React from 'react';
|
||||||
|
|
||||||
import { StyledBackdrop, StyledModal } from './styles';
|
import { StyledBackdrop, StyledModal } from './styles';
|
||||||
|
|
||||||
const Backdrop = ({
|
const Backdrop = ({
|
||||||
open,
|
open,
|
||||||
...other
|
...other
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
import { CloseIcon } from '@blocksuite/icons';
|
import { CloseIcon } from '@blocksuite/icons';
|
||||||
import { HTMLAttributes } from 'react';
|
import { HTMLAttributes } from 'react';
|
||||||
|
import React from 'react';
|
||||||
|
|
||||||
import { styled } from '../../styles';
|
import { styled } from '../../styles';
|
||||||
import { IconButton, IconButtonProps } from '../button/IconButton';
|
import { IconButton, IconButtonProps } from '../button/IconButton';
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
import { forwardRef } from 'react';
|
import { forwardRef } from 'react';
|
||||||
|
import React from 'react';
|
||||||
|
|
||||||
import { styled } from '../../styles';
|
import { styled } from '../../styles';
|
||||||
import { PopperArrowProps } from './interface';
|
import { PopperArrowProps } from './interface';
|
||||||
|
|||||||
@@ -9,6 +9,7 @@ import {
|
|||||||
useRef,
|
useRef,
|
||||||
useState,
|
useState,
|
||||||
} from 'react';
|
} from 'react';
|
||||||
|
import React from 'react';
|
||||||
|
|
||||||
import { styled } from '../../styles';
|
import { styled } from '../../styles';
|
||||||
import { PopperProps, VirtualElement } from './interface';
|
import { PopperProps, VirtualElement } from './interface';
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
import { Children, HTMLAttributes, PropsWithChildren, ReactNode } from 'react';
|
import { Children, HTMLAttributes, PropsWithChildren, ReactNode } from 'react';
|
||||||
|
import React from 'react';
|
||||||
|
|
||||||
import { StyledTable } from './styles';
|
import { StyledTable } from './styles';
|
||||||
|
|
||||||
const childrenHasEllipsis = (children: ReactNode | ReactNode[]): boolean => {
|
const childrenHasEllipsis = (children: ReactNode | ReactNode[]): boolean => {
|
||||||
return Children.toArray(children).some(child => {
|
return Children.toArray(children).some(child => {
|
||||||
if (typeof child === 'object' && 'props' in child) {
|
if (typeof child === 'object' && 'props' in child) {
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
import { HTMLAttributes, PropsWithChildren } from 'react';
|
import { HTMLAttributes, PropsWithChildren } from 'react';
|
||||||
|
import React from 'react';
|
||||||
|
|
||||||
import { StyledTableBody } from './styles';
|
import { StyledTableBody } from './styles';
|
||||||
|
|
||||||
export const TableBody = ({
|
export const TableBody = ({
|
||||||
children,
|
children,
|
||||||
...props
|
...props
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
import { HTMLAttributes, PropsWithChildren } from 'react';
|
import { HTMLAttributes, PropsWithChildren } from 'react';
|
||||||
|
import React from 'react';
|
||||||
|
|
||||||
import { TableCellProps } from './interface';
|
import { TableCellProps } from './interface';
|
||||||
import { StyledTableCell } from './styles';
|
import { StyledTableCell } from './styles';
|
||||||
|
|
||||||
export const TableCell = ({
|
export const TableCell = ({
|
||||||
children,
|
children,
|
||||||
...props
|
...props
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
import { HTMLAttributes, PropsWithChildren } from 'react';
|
import { HTMLAttributes, PropsWithChildren } from 'react';
|
||||||
|
import React from 'react';
|
||||||
|
|
||||||
import { StyledTableHead } from './styles';
|
import { StyledTableHead } from './styles';
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
import { HTMLAttributes, PropsWithChildren } from 'react';
|
import { HTMLAttributes, PropsWithChildren } from 'react';
|
||||||
|
import React from 'react';
|
||||||
|
|
||||||
import { StyledTableRow } from './styles';
|
import { StyledTableRow } from './styles';
|
||||||
|
|
||||||
export const TableRow = ({
|
export const TableRow = ({
|
||||||
children,
|
children,
|
||||||
...props
|
...props
|
||||||
|
|||||||
@@ -1,9 +1,9 @@
|
|||||||
import type { TooltipProps } from '@mui/material';
|
import type { TooltipProps } from '@mui/material';
|
||||||
|
import React from 'react';
|
||||||
|
|
||||||
import { styled } from '../../styles';
|
import { styled } from '../../styles';
|
||||||
import { Popper, type PopperProps } from '../popper';
|
import { Popper, type PopperProps } from '../popper';
|
||||||
import StyledPopperContainer from '../shared/Container';
|
import StyledPopperContainer from '../shared/Container';
|
||||||
|
|
||||||
const StyledTooltip = styled(StyledPopperContainer)(({ theme }) => {
|
const StyledTooltip = styled(StyledPopperContainer)(({ theme }) => {
|
||||||
return {
|
return {
|
||||||
maxWidth: '320px',
|
maxWidth: '320px',
|
||||||
|
|||||||
@@ -1,3 +1,5 @@
|
|||||||
|
import React from 'react';
|
||||||
|
|
||||||
// eslint-disable-next-line @typescript-eslint/no-restricted-imports
|
// eslint-disable-next-line @typescript-eslint/no-restricted-imports
|
||||||
import { Logger } from '../src';
|
import { Logger } from '../src';
|
||||||
|
|
||||||
|
|||||||
@@ -9,6 +9,13 @@ const pkgPath = path.join(__dirname, '../apps/web/package.json');
|
|||||||
const record = fs.readFileSync(pkgPath, 'utf8');
|
const record = fs.readFileSync(pkgPath, 'utf8');
|
||||||
const temp = JSON.parse(record);
|
const temp = JSON.parse(record);
|
||||||
loadPage();
|
loadPage();
|
||||||
|
|
||||||
|
declare global {
|
||||||
|
interface Window {
|
||||||
|
__editoVersion: unknown;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
test.describe('web console', () => {
|
test.describe('web console', () => {
|
||||||
test('editor version', async ({ page }) => {
|
test('editor version', async ({ page }) => {
|
||||||
const pkgEditorVersion = temp.dependencies['@blocksuite/editor'];
|
const pkgEditorVersion = temp.dependencies['@blocksuite/editor'];
|
||||||
|
|||||||
Reference in New Issue
Block a user