mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-07-17 01:56:27 +08:00
chore: fix eslint in blocksuite (#9232)
This commit is contained in:
@@ -35,7 +35,7 @@ import { Viewport } from './viewport.js';
|
||||
export class GfxController extends LifeCycleWatcher {
|
||||
static override key = gfxControllerKey;
|
||||
|
||||
private _disposables: DisposableGroup = new DisposableGroup();
|
||||
private readonly _disposables: DisposableGroup = new DisposableGroup();
|
||||
|
||||
private _surface: SurfaceBlockModel | null = null;
|
||||
|
||||
|
||||
@@ -66,16 +66,22 @@ const typeFilters = {
|
||||
type FilterFunc = (model: GfxModel | GfxLocalElementModel) => boolean;
|
||||
|
||||
export class GridManager {
|
||||
private _elementToGrids = new Map<
|
||||
private readonly _elementToGrids = new Map<
|
||||
GfxModel | GfxLocalElementModel,
|
||||
Set<Set<GfxModel | GfxLocalElementModel>>
|
||||
>();
|
||||
|
||||
private _externalElementToGrids = new Map<GfxModel, Set<Set<GfxModel>>>();
|
||||
private readonly _externalElementToGrids = new Map<
|
||||
GfxModel,
|
||||
Set<Set<GfxModel>>
|
||||
>();
|
||||
|
||||
private _externalGrids = new Map<string, Set<GfxModel>>();
|
||||
private readonly _externalGrids = new Map<string, Set<GfxModel>>();
|
||||
|
||||
private _grids = new Map<string, Set<GfxModel | GfxLocalElementModel>>();
|
||||
private readonly _grids = new Map<
|
||||
string,
|
||||
Set<GfxModel | GfxLocalElementModel>
|
||||
>();
|
||||
|
||||
get isEmpty() {
|
||||
return this._grids.size === 0;
|
||||
|
||||
@@ -4,7 +4,7 @@ import { Signal } from '@preact/signals-core';
|
||||
import type { BlockStdScope } from '../scope/block-std-scope.js';
|
||||
|
||||
export class KeyboardController {
|
||||
private _disposable = new DisposableGroup();
|
||||
private readonly _disposable = new DisposableGroup();
|
||||
|
||||
shiftKey$ = new Signal<boolean>(false);
|
||||
|
||||
|
||||
@@ -71,7 +71,7 @@ export type Layer = BlockLayer | CanvasLayer;
|
||||
export class LayerManager {
|
||||
static INITIAL_INDEX = 'a0';
|
||||
|
||||
private _disposable = new DisposableGroup();
|
||||
private readonly _disposable = new DisposableGroup();
|
||||
|
||||
blocks: GfxBlockElementModel[] = [];
|
||||
|
||||
@@ -100,7 +100,7 @@ export class LayerManager {
|
||||
};
|
||||
|
||||
constructor(
|
||||
private _doc: Doc,
|
||||
private readonly _doc: Doc,
|
||||
private _surface: SurfaceBlockModel | null,
|
||||
options: {
|
||||
watch: boolean;
|
||||
|
||||
@@ -388,7 +388,7 @@ export abstract class GfxGroupLikeElementModel<
|
||||
{
|
||||
private _childIds: string[] = [];
|
||||
|
||||
private _mutex = createMutex();
|
||||
private readonly _mutex = createMutex();
|
||||
|
||||
abstract children: Y.Map<any>;
|
||||
|
||||
|
||||
@@ -39,7 +39,7 @@ export function prop<V, T extends GfxLocalElementModel>() {
|
||||
}
|
||||
|
||||
export abstract class GfxLocalElementModel implements GfxCompatibleInterface {
|
||||
private _mutex: mutex.mutex = mutex.createMutex();
|
||||
private readonly _mutex: mutex.mutex = mutex.createMutex();
|
||||
|
||||
protected _local = new Map<string | symbol, unknown>();
|
||||
|
||||
|
||||
@@ -83,15 +83,15 @@ export const eventTarget = Symbol('eventTarget');
|
||||
export class ToolController extends GfxExtension {
|
||||
static override key = 'ToolController';
|
||||
|
||||
private _builtInHookSlot = new Slot<BuiltInSlotContext>();
|
||||
private readonly _builtInHookSlot = new Slot<BuiltInSlotContext>();
|
||||
|
||||
private _disposableGroup = new DisposableGroup();
|
||||
private readonly _disposableGroup = new DisposableGroup();
|
||||
|
||||
private _toolOption$ = new Signal<GfxToolsFullOptionValue>(
|
||||
private readonly _toolOption$ = new Signal<GfxToolsFullOptionValue>(
|
||||
{} as GfxToolsFullOptionValue
|
||||
);
|
||||
|
||||
private _tools = new Map<string, BaseTool>();
|
||||
private readonly _tools = new Map<string, BaseTool>();
|
||||
|
||||
readonly currentToolName$ = new Signal<keyof GfxToolsMap>();
|
||||
|
||||
|
||||
@@ -15,11 +15,11 @@ import {
|
||||
export class ViewManager extends GfxExtension {
|
||||
static override key = 'viewManager';
|
||||
|
||||
private _disposable = new DisposableGroup();
|
||||
private readonly _disposable = new DisposableGroup();
|
||||
|
||||
private _viewCtorMap = new Map<string, typeof GfxElementModelView>();
|
||||
private readonly _viewCtorMap = new Map<string, typeof GfxElementModelView>();
|
||||
|
||||
private _viewMap = new Map<string, GfxElementModelView>();
|
||||
private readonly _viewMap = new Map<string, GfxElementModelView>();
|
||||
|
||||
constructor(gfx: GfxController) {
|
||||
super(gfx);
|
||||
|
||||
@@ -40,7 +40,10 @@ export class GfxElementModelView<
|
||||
{
|
||||
static type: string;
|
||||
|
||||
private _handlers = new Map<keyof EventsHandlerMap, ((evt: any) => void)[]>();
|
||||
private readonly _handlers = new Map<
|
||||
keyof EventsHandlerMap,
|
||||
((evt: any) => void)[]
|
||||
>();
|
||||
|
||||
private _isConnected = true;
|
||||
|
||||
|
||||
@@ -46,7 +46,7 @@ export class GfxViewportElement extends WithDisposable(ShadowlessElement) {
|
||||
}
|
||||
`;
|
||||
|
||||
private _hideOutsideBlock = requestThrottledConnectedFrame(() => {
|
||||
private readonly _hideOutsideBlock = requestThrottledConnectedFrame(() => {
|
||||
if (this.getModelsInViewport && this.host) {
|
||||
const host = this.host;
|
||||
const modelsInViewport = this.getModelsInViewport();
|
||||
@@ -77,12 +77,12 @@ export class GfxViewportElement extends WithDisposable(ShadowlessElement) {
|
||||
|
||||
private _lastVisibleModels?: Set<GfxBlockElementModel>;
|
||||
|
||||
private _pendingChildrenUpdates: {
|
||||
private readonly _pendingChildrenUpdates: {
|
||||
id: string;
|
||||
resolve: () => void;
|
||||
}[] = [];
|
||||
|
||||
private _refreshViewport = requestThrottledConnectedFrame(() => {
|
||||
private readonly _refreshViewport = requestThrottledConnectedFrame(() => {
|
||||
this._hideOutsideBlock();
|
||||
}, this);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user