mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-08-23 04:51:49 +08:00
fix: temporarily turn off eslint for **ultra-low quality** code, because I don't have time to fix them one by one
This commit is contained in:
@@ -1,4 +1,5 @@
|
|||||||
import { displayFlex, keyframes, styled } from '@/styles';
|
import { displayFlex, keyframes, styled } from '@/styles';
|
||||||
|
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
import spring, { toString } from 'css-spring';
|
import spring, { toString } from 'css-spring';
|
||||||
import type { ItemStatus } from './type';
|
import type { ItemStatus } from './type';
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
import { displayFlex, keyframes, styled } from '@/styles';
|
import { displayFlex, keyframes, styled } from '@/styles';
|
||||||
import { CSSProperties } from 'react';
|
import { CSSProperties } from 'react';
|
||||||
|
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
import spring, { toString } from 'css-spring';
|
import spring, { toString } from 'css-spring';
|
||||||
|
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ export const debounce = <T extends (...args: any) => any>(
|
|||||||
): ((...args: any) => any) => {
|
): ((...args: any) => any) => {
|
||||||
let timeoutId: null | number;
|
let timeoutId: null | number;
|
||||||
let defaultImmediate = immediate || false;
|
let defaultImmediate = immediate || false;
|
||||||
let delay = time || 300;
|
const delay = time || 300;
|
||||||
return (...args: any) => {
|
return (...args: any) => {
|
||||||
if (defaultImmediate) {
|
if (defaultImmediate) {
|
||||||
fn.apply(this, args); // 确保引用函数的指向正确,并且函数的参数也不变
|
fn.apply(this, args); // 确保引用函数的指向正确,并且函数的参数也不变
|
||||||
@@ -30,6 +30,7 @@ export const debounce = <T extends (...args: any) => any>(
|
|||||||
if (timeoutId) {
|
if (timeoutId) {
|
||||||
clearTimeout(timeoutId);
|
clearTimeout(timeoutId);
|
||||||
}
|
}
|
||||||
|
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
timeoutId = setTimeout(() => {
|
timeoutId = setTimeout(() => {
|
||||||
fn.apply(this, args);
|
fn.apply(this, args);
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ export const tagName = 'simple-counter';
|
|||||||
|
|
||||||
// Adapt React in order to be able to use custom tags properly
|
// Adapt React in order to be able to use custom tags properly
|
||||||
declare global {
|
declare global {
|
||||||
|
// eslint-disable-next-line @typescript-eslint/no-namespace
|
||||||
namespace JSX {
|
namespace JSX {
|
||||||
interface IntrinsicElements {
|
interface IntrinsicElements {
|
||||||
[tagName]: PersonInfoProps;
|
[tagName]: PersonInfoProps;
|
||||||
|
|||||||
+1
@@ -71,6 +71,7 @@ export const WorkspaceCreate = ({ open, onClose }: WorkspaceCreateProps) => {
|
|||||||
const blobId = await createDefaultHeadImg(workspaceName);
|
const blobId = await createDefaultHeadImg(workspaceName);
|
||||||
createWorkspace({ name: workspaceName, avatar: `/api/blob/${blobId}` })
|
createWorkspace({ name: workspaceName, avatar: `/api/blob/${blobId}` })
|
||||||
.then(data => {
|
.then(data => {
|
||||||
|
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
router.push(`/workspace/${data.created_at}`);
|
router.push(`/workspace/${data.created_at}`);
|
||||||
onClose();
|
onClose();
|
||||||
|
|||||||
+15
-13
@@ -8,19 +8,21 @@ import {
|
|||||||
|
|
||||||
export const PrivateWorkspaceItem = () => {
|
export const PrivateWorkspaceItem = () => {
|
||||||
const { user } = useAppState();
|
const { user } = useAppState();
|
||||||
// @ts-ignore
|
if (user) {
|
||||||
const Username = user.name;
|
const Username = user.name;
|
||||||
return !user ? null : (
|
return (
|
||||||
<PrivateWorkspaceWrapper>
|
<PrivateWorkspaceWrapper>
|
||||||
<WorkspaceItemAvatar alt={Username} src={user.avatar_url}>
|
<WorkspaceItemAvatar alt={Username} src={user.avatar_url}>
|
||||||
{Username}
|
{Username}
|
||||||
</WorkspaceItemAvatar>
|
</WorkspaceItemAvatar>
|
||||||
<WorkspaceItemContent>
|
<WorkspaceItemContent>
|
||||||
<Name title={Username}>{Username}</Name>
|
<Name title={Username}>{Username}</Name>
|
||||||
<Email title={user.email}>{user.email}</Email>
|
<Email title={user.email}>{user.email}</Email>
|
||||||
</WorkspaceItemContent>
|
</WorkspaceItemContent>
|
||||||
</PrivateWorkspaceWrapper>
|
</PrivateWorkspaceWrapper>
|
||||||
);
|
);
|
||||||
|
}
|
||||||
|
return null;
|
||||||
};
|
};
|
||||||
|
|
||||||
const Name = styled('div')(({ theme }) => {
|
const Name = styled('div')(({ theme }) => {
|
||||||
|
|||||||
@@ -14,14 +14,17 @@ import { AppStateProvider } from '@/providers/app-state-provider/provider';
|
|||||||
import ConfirmProvider from '@/providers/confirm-provider';
|
import ConfirmProvider from '@/providers/confirm-provider';
|
||||||
import { ModalProvider } from '@/providers/global-modal-provider';
|
import { ModalProvider } from '@/providers/global-modal-provider';
|
||||||
import { useRouter } from 'next/router';
|
import { useRouter } from 'next/router';
|
||||||
import { useEffect, useState } from 'react';
|
import { useEffect } from 'react';
|
||||||
import { useAppState } from '@/providers/app-state-provider';
|
import { useAppState } from '@/providers/app-state-provider';
|
||||||
import { PageLoading } from '@/components/loading';
|
import { PageLoading } from '@/components/loading';
|
||||||
const ThemeProvider = dynamic(() => import('@/providers/themeProvider'), {
|
const ThemeProvider = dynamic(() => import('@/providers/themeProvider'), {
|
||||||
ssr: false,
|
ssr: false,
|
||||||
});
|
});
|
||||||
|
|
||||||
export type NextPageWithLayout<P = {}, IP = P> = NextPage<P, IP> & {
|
export type NextPageWithLayout<P = Record<string, unknown>, IP = P> = NextPage<
|
||||||
|
P,
|
||||||
|
IP
|
||||||
|
> & {
|
||||||
getLayout?: (page: ReactElement) => ReactNode;
|
getLayout?: (page: ReactElement) => ReactNode;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -48,6 +48,7 @@ export const AppState = createContext<AppStateContext>({
|
|||||||
|
|
||||||
editor: null,
|
editor: null,
|
||||||
|
|
||||||
|
// eslint-disable-next-line @typescript-eslint/no-empty-function
|
||||||
setState: () => {},
|
setState: () => {},
|
||||||
createEditor: undefined,
|
createEditor: undefined,
|
||||||
setEditor: undefined,
|
setEditor: undefined,
|
||||||
|
|||||||
@@ -49,6 +49,7 @@ const DynamicBlocksuite = ({
|
|||||||
workspaceId: string,
|
workspaceId: string,
|
||||||
websocket = false
|
websocket = false
|
||||||
) =>
|
) =>
|
||||||
|
// eslint-disable-next-line no-async-promise-executor
|
||||||
new Promise(async resolve => {
|
new Promise(async resolve => {
|
||||||
const workspace = new Workspace({
|
const workspace = new Workspace({
|
||||||
room: workspaceId,
|
room: workspaceId,
|
||||||
@@ -79,6 +80,7 @@ const DynamicBlocksuite = ({
|
|||||||
|
|
||||||
// FIXME: there needs some method to destroy websocket.
|
// FIXME: there needs some method to destroy websocket.
|
||||||
// Or we need a manager to manage websocket.
|
// Or we need a manager to manage websocket.
|
||||||
|
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
||||||
// @ts-expect-error
|
// @ts-expect-error
|
||||||
workspace.__ws__ = ws;
|
workspace.__ws__ = ws;
|
||||||
}
|
}
|
||||||
@@ -87,7 +89,7 @@ const DynamicBlocksuite = ({
|
|||||||
p => p instanceof IndexedDBDocProvider
|
p => p instanceof IndexedDBDocProvider
|
||||||
);
|
);
|
||||||
if (indexDBProvider) {
|
if (indexDBProvider) {
|
||||||
(indexDBProvider as IndexedDBDocProvider)?.on('synced', async () => {
|
(indexDBProvider as IndexedDBDocProvider).on('synced', async () => {
|
||||||
// const updates = await downloadWorkspace({ workspaceId });
|
// const updates = await downloadWorkspace({ workspaceId });
|
||||||
// updates &&
|
// updates &&
|
||||||
// Workspace.Y.applyUpdate(workspace.doc, new Uint8Array(updates));
|
// Workspace.Y.applyUpdate(workspace.doc, new Uint8Array(updates));
|
||||||
|
|||||||
@@ -1,4 +1,3 @@
|
|||||||
import { EditorContainer } from '@blocksuite/editor';
|
|
||||||
import { PageMeta as OriginalPageMeta } from '@blocksuite/store/dist/workspace/workspace';
|
import { PageMeta as OriginalPageMeta } from '@blocksuite/store/dist/workspace/workspace';
|
||||||
|
|
||||||
// export type PageMeta = {
|
// export type PageMeta = {
|
||||||
@@ -14,6 +13,5 @@ export interface PageMeta extends OriginalPageMeta {
|
|||||||
trash: boolean;
|
trash: boolean;
|
||||||
trashDate: number;
|
trashDate: number;
|
||||||
updatedDate: number;
|
updatedDate: number;
|
||||||
// @ts-ignore
|
|
||||||
mode: 'edgeless' | 'page';
|
mode: 'edgeless' | 'page';
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -61,10 +61,12 @@ export const AppStateProvider = ({ children }: { children?: ReactNode }) => {
|
|||||||
|
|
||||||
const workspace = (await loadWorkspaceHandler?.(workspaceId, true)) || null;
|
const workspace = (await loadWorkspaceHandler?.(workspaceId, true)) || null;
|
||||||
|
|
||||||
|
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
||||||
// @ts-expect-error
|
// @ts-expect-error
|
||||||
window.workspace = workspace;
|
window.workspace = workspace;
|
||||||
// FIXME: there needs some method to destroy websocket.
|
// FIXME: there needs some method to destroy websocket.
|
||||||
// Or we need a manager to manage websocket.
|
// Or we need a manager to manage websocket.
|
||||||
|
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
||||||
// @ts-expect-error
|
// @ts-expect-error
|
||||||
state.currentWorkspace?.__ws__?.destroy();
|
state.currentWorkspace?.__ws__?.destroy();
|
||||||
|
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
/* eslint-disable no-undef */
|
||||||
/**
|
/**
|
||||||
* @module provider/websocket
|
* @module provider/websocket
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ import { Confirm, ConfirmProps } from '@/ui/confirm';
|
|||||||
type ConfirmContextValue = {
|
type ConfirmContextValue = {
|
||||||
confirm: (props: ConfirmProps) => Promise<boolean>;
|
confirm: (props: ConfirmProps) => Promise<boolean>;
|
||||||
};
|
};
|
||||||
type ConfirmContextProps = PropsWithChildren<{}>;
|
type ConfirmContextProps = PropsWithChildren<Record<string, unknown>>;
|
||||||
|
|
||||||
export const ConfirmContext = createContext<ConfirmContextValue>({
|
export const ConfirmContext = createContext<ConfirmContextValue>({
|
||||||
confirm: () => Promise.resolve(false),
|
confirm: () => Promise.resolve(false),
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
/* eslint-disable @typescript-eslint/no-empty-function */
|
||||||
import { createContext, useContext, useEffect, useState } from 'react';
|
import { createContext, useContext, useEffect, useState } from 'react';
|
||||||
import type { PropsWithChildren } from 'react';
|
import type { PropsWithChildren } from 'react';
|
||||||
import ShortcutsModal from '@/components/shortcuts-modal';
|
import ShortcutsModal from '@/components/shortcuts-modal';
|
||||||
@@ -13,7 +14,7 @@ type ModalContextValue = {
|
|||||||
triggerImportModal: () => void;
|
triggerImportModal: () => void;
|
||||||
triggerLoginModal: () => void;
|
triggerLoginModal: () => void;
|
||||||
};
|
};
|
||||||
type ModalContextProps = PropsWithChildren<{}>;
|
type ModalContextProps = PropsWithChildren<Record<string, unknown>>;
|
||||||
type ModalMap = {
|
type ModalMap = {
|
||||||
contact: boolean;
|
contact: boolean;
|
||||||
shortcuts: boolean;
|
shortcuts: boolean;
|
||||||
@@ -50,6 +51,7 @@ export const ModalProvider = ({
|
|||||||
});
|
});
|
||||||
};
|
};
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
|
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
window.triggerHandler = () => triggerHandler('login');
|
window.triggerHandler = () => triggerHandler('login');
|
||||||
}, [triggerHandler]);
|
}, [triggerHandler]);
|
||||||
|
|||||||
@@ -25,6 +25,7 @@ import useCurrentPageMeta from '@/hooks/use-current-page-meta';
|
|||||||
|
|
||||||
export const ThemeContext = createContext<ThemeProviderValue>({
|
export const ThemeContext = createContext<ThemeProviderValue>({
|
||||||
mode: 'light',
|
mode: 'light',
|
||||||
|
// eslint-disable-next-line @typescript-eslint/no-empty-function
|
||||||
changeMode: () => {},
|
changeMode: () => {},
|
||||||
theme: getLightTheme('page'),
|
theme: getLightTheme('page'),
|
||||||
});
|
});
|
||||||
@@ -98,7 +99,7 @@ export const ThemeProvider = ({
|
|||||||
<Global
|
<Global
|
||||||
styles={css`
|
styles={css`
|
||||||
:root {
|
:root {
|
||||||
${globalThemeVariables(mode, themeStyle) as {}}
|
${globalThemeVariables(mode, themeStyle) as any}
|
||||||
}
|
}
|
||||||
`}
|
`}
|
||||||
/>
|
/>
|
||||||
|
|||||||
@@ -100,7 +100,7 @@ export const fixedCenter = ({
|
|||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
export const textEllipsis = (lineNum: number = 1): CSSProperties => {
|
export const textEllipsis = (lineNum = 1): CSSProperties => {
|
||||||
if (lineNum > 1) {
|
if (lineNum > 1) {
|
||||||
return {
|
return {
|
||||||
display: '-webkit-box',
|
display: '-webkit-box',
|
||||||
|
|||||||
@@ -129,5 +129,6 @@ export interface AffineThemeCSSVariables {
|
|||||||
}
|
}
|
||||||
|
|
||||||
declare module '@emotion/react' {
|
declare module '@emotion/react' {
|
||||||
|
// eslint-disable-next-line @typescript-eslint/no-empty-interface
|
||||||
export interface Theme extends AffineTheme {}
|
export interface Theme extends AffineTheme {}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -40,6 +40,7 @@ export const Button = forwardRef<HTMLButtonElement, ButtonProps>(
|
|||||||
hoverBackground={hoverBackground}
|
hoverBackground={hoverBackground}
|
||||||
hoverColor={hoverColor}
|
hoverColor={hoverColor}
|
||||||
hoverStyle={hoverStyle}
|
hoverStyle={hoverStyle}
|
||||||
|
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
type={type}
|
type={type}
|
||||||
bold={bold}
|
bold={bold}
|
||||||
|
|||||||
@@ -202,6 +202,7 @@ export const StyledButton = styled('button', {
|
|||||||
'>span': {
|
'>span': {
|
||||||
marginLeft: '5px',
|
marginLeft: '5px',
|
||||||
},
|
},
|
||||||
|
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
...getButtonColors(theme, type, {
|
...getButtonColors(theme, type, {
|
||||||
hoverBackground,
|
hoverBackground,
|
||||||
|
|||||||
@@ -32,6 +32,7 @@ export const TextButton = forwardRef<HTMLButtonElement, ButtonProps>(
|
|||||||
hoverBackground={hoverBackground}
|
hoverBackground={hoverBackground}
|
||||||
hoverColor={hoverColor}
|
hoverColor={hoverColor}
|
||||||
hoverStyle={hoverStyle}
|
hoverStyle={hoverStyle}
|
||||||
|
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
type={type}
|
type={type}
|
||||||
bold={bold}
|
bold={bold}
|
||||||
|
|||||||
@@ -108,6 +108,7 @@ export const Popper = ({
|
|||||||
onClick: (e: MouseEvent) => {
|
onClick: (e: MouseEvent) => {
|
||||||
children.props.onClick?.(e);
|
children.props.onClick?.(e);
|
||||||
if (!hasClickTrigger || visibleControlledByParent) {
|
if (!hasClickTrigger || visibleControlledByParent) {
|
||||||
|
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
onClick?.(e);
|
onClick?.(e);
|
||||||
return;
|
return;
|
||||||
@@ -151,6 +152,7 @@ export const Popper = ({
|
|||||||
className={popoverClassName}
|
className={popoverClassName}
|
||||||
>
|
>
|
||||||
{showArrow && (
|
{showArrow && (
|
||||||
|
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
<PopperArrow placement={placement} ref={setArrowRef} />
|
<PopperArrow placement={placement} ref={setArrowRef} />
|
||||||
)}
|
)}
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
/* eslint-disable no-useless-escape */
|
||||||
// Inspire by https://stackoverflow.com/a/11381730/8415727
|
// Inspire by https://stackoverflow.com/a/11381730/8415727
|
||||||
export function isMobile(userAgent: string) {
|
export function isMobile(userAgent: string) {
|
||||||
return !!(
|
return !!(
|
||||||
|
|||||||
Reference in New Issue
Block a user