chore: fix eslint in blocksuite (#9232)

This commit is contained in:
Saul-Mirone
2024-12-20 16:48:10 +00:00
parent bfcc53dc1f
commit 3a82da0e5b
269 changed files with 935 additions and 842 deletions
@@ -84,18 +84,18 @@ export class AffineAIPanelWidget extends WidgetComponent {
private _answer: string | null = null;
private _cancelCallback = () => {
private readonly _cancelCallback = () => {
this.focus();
};
private _clearDiscardModal = () => {
private readonly _clearDiscardModal = () => {
if (this._discardModalAbort) {
this._discardModalAbort.abort();
this._discardModalAbort = null;
}
};
private _clickOutside = () => {
private readonly _clickOutside = () => {
switch (this.state) {
case 'hidden':
return;
@@ -112,21 +112,21 @@ export class AffineAIPanelWidget extends WidgetComponent {
}
};
private _discardCallback = () => {
private readonly _discardCallback = () => {
this.hide();
this.config?.discardCallback?.();
};
private _discardModalAbort: AbortController | null = null;
private _inputFinish = (text: string) => {
private readonly _inputFinish = (text: string) => {
this._inputText = text;
this.generate();
};
private _inputText: string | null = null;
private _onDocumentClick = (e: MouseEvent) => {
private readonly _onDocumentClick = (e: MouseEvent) => {
if (
this.state !== 'hidden' &&
e.target !== this &&
@@ -139,7 +139,7 @@ export class AffineAIPanelWidget extends WidgetComponent {
return false;
};
private _onKeyDown = (event: KeyboardEvent) => {
private readonly _onKeyDown = (event: KeyboardEvent) => {
event.stopPropagation();
const { state } = this;
if (state !== 'generating' && state !== 'input') {
@@ -157,7 +157,7 @@ export class AffineAIPanelWidget extends WidgetComponent {
}
};
private _resetAbortController = () => {
private readonly _resetAbortController = () => {
if (this.state === 'generating') {
this._abortController.abort();
}
@@ -127,7 +127,7 @@ export class AIPanelError extends WithDisposable(LitElement) {
}
`;
private _getResponseGroup = () => {
private readonly _getResponseGroup = () => {
let responseGroup: AIItemGroupConfig[] = [];
const errorType = this.config.error?.type;
if (errorType && errorType !== AIErrorType.GeneralNetworkError) {
@@ -84,7 +84,7 @@ export class AIPanelInput extends WithDisposable(LitElement) {
}
`;
private _onInput = () => {
private readonly _onInput = () => {
this.textarea.style.height = 'auto';
this.textarea.style.height = this.textarea.scrollHeight + 'px';
@@ -99,14 +99,14 @@ export class AIPanelInput extends WithDisposable(LitElement) {
}
};
private _onKeyDown = (e: KeyboardEvent) => {
private readonly _onKeyDown = (e: KeyboardEvent) => {
if (e.key === 'Enter' && !e.shiftKey && !e.isComposing) {
e.preventDefault();
this._sendToAI();
}
};
private _sendToAI = () => {
private readonly _sendToAI = () => {
const value = this.textarea.value.trim();
if (value.length === 0) return;