chore: upgrade to eslint9 (#9163)

This commit is contained in:
Brooooooklyn
2024-12-14 10:29:04 +00:00
parent f49bef4915
commit aaaea8918f
37 changed files with 681 additions and 736 deletions

View File

@@ -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';

View File

@@ -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() {

View File

@@ -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;

View File

@@ -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';

View File

@@ -5,8 +5,8 @@ import {
ConnectorMode,
DocModeProvider,
type EdgelessRootService,
TelemetryProvider,
NotificationProvider,
TelemetryProvider,
} from '@blocksuite/affine/blocks';
import {
type AIChatBlockModel,

View File

@@ -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 {