mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-02-13 12:55:00 +00:00
chore: upgrade to eslint9 (#9163)
This commit is contained in:
@@ -3,8 +3,8 @@ import './ask-ai-panel';
|
||||
import { type EditorHost } from '@blocksuite/affine/block-std';
|
||||
import {
|
||||
type AIItemGroupConfig,
|
||||
EdgelessRootService,
|
||||
createLitPortal,
|
||||
EdgelessRootService,
|
||||
HoverController,
|
||||
} from '@blocksuite/affine/blocks';
|
||||
import { WithDisposable } from '@blocksuite/affine/global/utils';
|
||||
|
||||
@@ -7,6 +7,7 @@ import {
|
||||
} from '@blocksuite/affine/blocks';
|
||||
import { WithDisposable } from '@blocksuite/affine/global/utils';
|
||||
import type { BlockModel } from '@blocksuite/affine/store';
|
||||
import { captureException } from '@sentry/react';
|
||||
import {
|
||||
css,
|
||||
html,
|
||||
@@ -466,39 +467,47 @@ export class ChatCards extends WithDisposable(LitElement) {
|
||||
}
|
||||
}
|
||||
|
||||
protected override async willUpdate(changedProperties: PropertyValues) {
|
||||
if (changedProperties.has('temporaryParams') && this.temporaryParams) {
|
||||
const params = this.temporaryParams;
|
||||
await this._appendCardWithParams(params);
|
||||
this.temporaryParams = null;
|
||||
}
|
||||
|
||||
if (changedProperties.has('host')) {
|
||||
if (this._currentDocId === this.host.doc.id) return;
|
||||
this._currentDocId = this.host.doc.id;
|
||||
this.cards = [];
|
||||
|
||||
const { text, images } = await this._extractAll();
|
||||
const hasText = text.length > 0;
|
||||
const hasImages = images.length > 0;
|
||||
|
||||
// Currently only supports checking on first load
|
||||
if (hasText || hasImages) {
|
||||
const card: CardBlock = {
|
||||
id: Date.now(),
|
||||
type: CardType.Doc,
|
||||
};
|
||||
if (hasText) {
|
||||
card.text = text;
|
||||
}
|
||||
if (hasImages) {
|
||||
card.images = images;
|
||||
protected override willUpdate(changedProperties: PropertyValues) {
|
||||
Promise.resolve()
|
||||
.then(async () => {
|
||||
if (changedProperties.has('temporaryParams') && this.temporaryParams) {
|
||||
const params = this.temporaryParams;
|
||||
await this._appendCardWithParams(params);
|
||||
this.temporaryParams = null;
|
||||
}
|
||||
|
||||
this.cards.push(card);
|
||||
this.requestUpdate();
|
||||
}
|
||||
}
|
||||
if (changedProperties.has('host')) {
|
||||
if (this._currentDocId === this.host.doc.id) return;
|
||||
this._currentDocId = this.host.doc.id;
|
||||
this.cards = [];
|
||||
|
||||
const { text, images } = await this._extractAll();
|
||||
const hasText = text.length > 0;
|
||||
const hasImages = images.length > 0;
|
||||
|
||||
// Currently only supports checking on first load
|
||||
if (hasText || hasImages) {
|
||||
const card: CardBlock = {
|
||||
id: Date.now(),
|
||||
type: CardType.Doc,
|
||||
};
|
||||
if (hasText) {
|
||||
card.text = text;
|
||||
}
|
||||
if (hasImages) {
|
||||
card.images = images;
|
||||
}
|
||||
|
||||
this.cards.push(card);
|
||||
this.requestUpdate();
|
||||
}
|
||||
}
|
||||
})
|
||||
.catch(err => {
|
||||
captureException(err, {
|
||||
level: 'fatal',
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
override connectedCallback() {
|
||||
|
||||
@@ -276,11 +276,14 @@ export class ChatPanelMessages extends WithDisposable(ShadowlessElement) {
|
||||
: nothing} `;
|
||||
}
|
||||
|
||||
override async connectedCallback() {
|
||||
override connectedCallback() {
|
||||
super.connectedCallback();
|
||||
|
||||
const res = await AIProvider.userInfo;
|
||||
this.avatarUrl = res?.avatarUrl ?? '';
|
||||
Promise.resolve(AIProvider.userInfo)
|
||||
.then(res => {
|
||||
this.avatarUrl = res?.avatarUrl ?? '';
|
||||
})
|
||||
.catch(console.error);
|
||||
this.disposables.add(
|
||||
AIProvider.slots.userInfo.on(userInfo => {
|
||||
const { status, error } = this.chatContextValue;
|
||||
|
||||
@@ -1,14 +1,14 @@
|
||||
import {
|
||||
AFFINE_AI_PANEL_WIDGET,
|
||||
type AffineAIPanelWidget,
|
||||
type AffineSlashMenuActionItem,
|
||||
type AffineSlashMenuContext,
|
||||
type AffineSlashMenuItem,
|
||||
AffineSlashMenuWidget,
|
||||
type AffineSlashSubMenu,
|
||||
type AIItemConfig,
|
||||
DocModeProvider,
|
||||
AFFINE_AI_PANEL_WIDGET,
|
||||
AffineSlashMenuWidget,
|
||||
AIStarIcon,
|
||||
DocModeProvider,
|
||||
MoreHorizontalIcon,
|
||||
} from '@blocksuite/affine/blocks';
|
||||
import { assertExists } from '@blocksuite/affine/global/utils';
|
||||
|
||||
@@ -5,8 +5,8 @@ import {
|
||||
ConnectorMode,
|
||||
DocModeProvider,
|
||||
type EdgelessRootService,
|
||||
TelemetryProvider,
|
||||
NotificationProvider,
|
||||
TelemetryProvider,
|
||||
} from '@blocksuite/affine/blocks';
|
||||
import {
|
||||
type AIChatBlockModel,
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
import type { EditorHost } from '@blocksuite/affine/block-std';
|
||||
import {
|
||||
BlocksUtils,
|
||||
type CopilotTool,
|
||||
EdgelessRootService,
|
||||
type FrameBlockModel,
|
||||
ImageBlockModel,
|
||||
type SurfaceBlockComponent,
|
||||
BlocksUtils,
|
||||
EdgelessRootService,
|
||||
} from '@blocksuite/affine/blocks';
|
||||
import { assertExists } from '@blocksuite/affine/global/utils';
|
||||
import {
|
||||
|
||||
@@ -10,8 +10,8 @@ import {
|
||||
import { GlobalDialogService } from '@affine/core/modules/dialogs';
|
||||
import {
|
||||
type CreateCheckoutSessionInput,
|
||||
SubscriptionRecurring,
|
||||
SubscriptionPlan,
|
||||
SubscriptionRecurring,
|
||||
SubscriptionStatus,
|
||||
SubscriptionVariant,
|
||||
} from '@affine/graphql';
|
||||
|
||||
@@ -107,10 +107,10 @@ export const CloudWorkspaceMembersPanel = ({
|
||||
return success;
|
||||
}, [permissionService.permission, workspaceShareSettingService.sharePreview]);
|
||||
|
||||
const onInviteBatchConfirm = useCallback<
|
||||
InviteTeamMemberModalProps['onConfirm']
|
||||
>(
|
||||
async ({ emails }) => {
|
||||
const onInviteBatchConfirm = useAsyncCallback(
|
||||
async ({
|
||||
emails,
|
||||
}: Parameters<InviteTeamMemberModalProps['onConfirm']>[0]) => {
|
||||
setIsMutating(true);
|
||||
const success = await permissionService.permission.inviteMembers(
|
||||
emails,
|
||||
|
||||
@@ -360,7 +360,6 @@ const ExplorerFolderNodeFolder = ({
|
||||
}, [additionalOperations, folderOperations]);
|
||||
|
||||
const childrenOperations = useCallback(
|
||||
// eslint-disable-next-line @typescript-eslint/ban-types
|
||||
(type: string, node: FolderNode) => {
|
||||
if (type === 'doc' || type === 'collection' || type === 'tag') {
|
||||
return [
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
import {
|
||||
SubscriptionPlan,
|
||||
type SubscriptionQuery,
|
||||
SubscriptionRecurring,
|
||||
SubscriptionVariant,
|
||||
SubscriptionPlan,
|
||||
} from '@affine/graphql';
|
||||
import {
|
||||
backoffRetry,
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
/* eslint-disable @typescript-eslint/ban-types */
|
||||
import type { DocMode } from '@blocksuite/affine/blocks';
|
||||
import type { WorkspaceMetadata } from '@toeverything/infra';
|
||||
|
||||
|
||||
@@ -712,7 +712,6 @@ const ExplorerFolderNodeFolder = ({
|
||||
}, [additionalOperations, folderOperations]);
|
||||
|
||||
const childrenOperations = useCallback(
|
||||
// eslint-disable-next-line @typescript-eslint/ban-types
|
||||
(type: string, node: FolderNode) => {
|
||||
if (type === 'doc' || type === 'collection' || type === 'tag') {
|
||||
return [
|
||||
|
||||
@@ -14,7 +14,6 @@ export class FolderNode extends Entity<{
|
||||
|
||||
info$ = LiveData.from<{
|
||||
data: string;
|
||||
// eslint-disable-next-line @typescript-eslint/ban-types
|
||||
type: (string & {}) | 'folder' | 'doc' | 'tag' | 'collection';
|
||||
index: string;
|
||||
id: string;
|
||||
|
||||
@@ -10,8 +10,10 @@ import {
|
||||
type BlobStorage,
|
||||
catchErrorInto,
|
||||
type DocStorage,
|
||||
effect,
|
||||
exhaustMapSwitchUntilChanged,
|
||||
fromPromise,
|
||||
getAFFiNEWorkspaceSchema,
|
||||
type GlobalState,
|
||||
LiveData,
|
||||
ObjectPool,
|
||||
@@ -24,8 +26,6 @@ import {
|
||||
type WorkspaceFlavoursProvider,
|
||||
type WorkspaceMetadata,
|
||||
type WorkspaceProfileInfo,
|
||||
effect,
|
||||
getAFFiNEWorkspaceSchema,
|
||||
} from '@toeverything/infra';
|
||||
import { isEqual } from 'lodash-es';
|
||||
import { nanoid } from 'nanoid';
|
||||
|
||||
@@ -176,7 +176,6 @@ function createKey() {
|
||||
|
||||
function warning(cond: any, message: string) {
|
||||
if (!cond) {
|
||||
// eslint-disable-next-line no-console
|
||||
if (typeof console !== 'undefined') console.warn(message);
|
||||
|
||||
try {
|
||||
@@ -186,7 +185,6 @@ function warning(cond: any, message: string) {
|
||||
// find the source for a warning that appears in the console by
|
||||
// enabling "pause on exceptions" in your JavaScript debugger.
|
||||
throw new Error(message);
|
||||
// eslint-disable-next-line no-empty
|
||||
} catch {}
|
||||
}
|
||||
}
|
||||
@@ -201,7 +199,7 @@ type Events<F> = {
|
||||
call: (arg: any) => void;
|
||||
};
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/ban-types
|
||||
// eslint-disable-next-line @typescript-eslint/no-unsafe-function-type
|
||||
function createEvents<F extends Function>(): Events<F> {
|
||||
let handlers: F[] = [];
|
||||
|
||||
|
||||
Reference in New Issue
Block a user