fix: add prefer-readonly rule (#5122)

This commit is contained in:
LongYinan
2023-11-29 04:44:25 +00:00
parent e9ea67bd38
commit 7a7cbc45d7
21 changed files with 39 additions and 36 deletions

View File

@@ -5,8 +5,8 @@ const logger = new DebugLogger('affine:blob-engine');
export class BlobEngine {
constructor(
private local: BlobStorage,
private remotes: BlobStorage[]
private readonly local: BlobStorage,
private readonly remotes: BlobStorage[]
) {}
get storages() {

View File

@@ -15,12 +15,12 @@ interface SyncUpdateSender {
* - retryable, allow retry when previous sync request failed but with retry flag been set to true
*/
export class BatchSyncSender {
private buffered: Uint8Array[] = [];
private readonly buffered: Uint8Array[] = [];
private job: Promise<void> | null = null;
private started = true;
constructor(
private guid: string,
private readonly guid: string,
private readonly rawSender: SyncUpdateSender
) {}

View File

@@ -63,9 +63,9 @@ export class SyncEngine {
private abort = new AbortController();
constructor(
private rootDoc: Doc,
private local: Storage,
private remotes: Storage[]
private readonly rootDoc: Doc,
private readonly local: Storage,
private readonly remotes: Storage[]
) {
this._status = {
step: SyncEngineStep.Stopped,

View File

@@ -69,8 +69,8 @@ export class SyncPeer {
logger = new DebugLogger('affine:sync-peer:' + this.name);
constructor(
private rootDoc: Doc,
private storage: Storage
private readonly rootDoc: Doc,
private readonly storage: Storage
) {
this.logger.debug('peer start');
@@ -150,7 +150,7 @@ export class SyncPeer {
}
}
private state: {
private readonly state: {
connectedDocs: Map<string, Doc>;
pushUpdatesQueue: AsyncQueue<{
docId: string;