Linting
This commit is contained in:
parent
8eae770621
commit
8b7be48522
13 changed files with 37 additions and 28 deletions
|
|
@ -70,7 +70,7 @@ export class SyncService {
|
|||
response: Response,
|
||||
operation: string
|
||||
): Promise<void> {
|
||||
if (response.ok) return;
|
||||
if (response.ok) {return;}
|
||||
const message = `Failed to ${operation}: ${await SyncService.errorFromResponse(response)}`;
|
||||
// 429 is the only 4xx the server uses for *transient* contention
|
||||
// (`WriteBusyError` → HTTP 429). Every other 4xx means the request
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@ function truncateFileNameToByteLimit(
|
|||
maxBytes: number
|
||||
): string {
|
||||
const encoder = new TextEncoder();
|
||||
if (encoder.encode(fileName).byteLength <= maxBytes) return fileName;
|
||||
if (encoder.encode(fileName).byteLength <= maxBytes) {return fileName;}
|
||||
|
||||
const dotIndex = fileName.lastIndexOf(".");
|
||||
// Dotfile (starts with "." and nothing else) → no extension to preserve.
|
||||
|
|
@ -35,7 +35,7 @@ function truncateFileNameToByteLimit(
|
|||
let usedBytes = 0;
|
||||
for (const { segment } of segmenter.segment(stem)) {
|
||||
const segmentBytes = encoder.encode(segment).byteLength;
|
||||
if (usedBytes + segmentBytes > stemBudget) break;
|
||||
if (usedBytes + segmentBytes > stemBudget) {break;}
|
||||
truncatedStem += segment;
|
||||
usedBytes += segmentBytes;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -90,9 +90,9 @@ export class ExpectedFsEvents {
|
|||
key: RelativePath
|
||||
): boolean {
|
||||
const count = map.get(key) ?? 0;
|
||||
if (count === 0) return false;
|
||||
if (count === 1) map.delete(key);
|
||||
else map.set(key, count - 1);
|
||||
if (count === 0) {return false;}
|
||||
if (count === 1) {map.delete(key);}
|
||||
else {map.set(key, count - 1);}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -72,7 +72,7 @@ export async function scheduleOfflineChanges(
|
|||
}
|
||||
|
||||
for (const path of locallyPossibleCreatedFiles) {
|
||||
if (renamedPaths.has(path)) continue;
|
||||
if (renamedPaths.has(path)) {continue;}
|
||||
|
||||
logger.info(
|
||||
`File ${path} was created while offline, scheduling sync to create it`
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@ import {
|
|||
import { MinCovered } from "../utils/data-structures/min-covered";
|
||||
|
||||
export class SyncEventQueue {
|
||||
private _lastSeenUpdateId: MinCovered;
|
||||
private readonly _lastSeenUpdateId: MinCovered;
|
||||
|
||||
// Latest state of the filesystem as we know it, excluding
|
||||
// unconfirmed creates but including pending deletes.
|
||||
|
|
@ -441,7 +441,7 @@ export class SyncEventQueue {
|
|||
newPath: RelativePath
|
||||
): void {
|
||||
const createEvent = this.findLatestCreateForPath(oldPath);
|
||||
if (createEvent === undefined) return;
|
||||
if (createEvent === undefined) {return;}
|
||||
|
||||
const { promise } = createEvent.resolvers;
|
||||
createEvent.path = newPath;
|
||||
|
|
|
|||
|
|
@ -217,8 +217,8 @@ export class Syncer {
|
|||
}
|
||||
|
||||
private ensureDraining(): void {
|
||||
if (this.drainPromise !== undefined) return;
|
||||
if (this.isScanning) return;
|
||||
if (this.drainPromise !== undefined) {return;}
|
||||
if (this.isScanning) {return;}
|
||||
this.drainPromise = this.drain().finally(() => {
|
||||
this.drainPromise = undefined;
|
||||
});
|
||||
|
|
@ -329,7 +329,7 @@ export class Syncer {
|
|||
relativePath = event.path;
|
||||
break;
|
||||
case SyncEventType.RemoteChange:
|
||||
if (event.remoteVersion.isDeleted) return false;
|
||||
if (event.remoteVersion.isDeleted) {return false;}
|
||||
sizeInBytes = event.remoteVersion.contentSize;
|
||||
({ relativePath } = event.remoteVersion);
|
||||
break;
|
||||
|
|
@ -339,7 +339,7 @@ export class Syncer {
|
|||
sizeInBytes,
|
||||
relativePath
|
||||
);
|
||||
if (oversizedEntry === undefined) return false;
|
||||
if (oversizedEntry === undefined) {return false;}
|
||||
|
||||
this.history.addHistoryEntry(oversizedEntry);
|
||||
|
||||
|
|
|
|||
|
|
@ -43,7 +43,7 @@ export class EventListeners<TListener extends (...args: any[]) => any> {
|
|||
const snapshot = this.listeners.slice();
|
||||
for (const listener of snapshot) {
|
||||
// allow removing listeners during the trigger loop
|
||||
if (!this.listeners.includes(listener)) continue;
|
||||
if (!this.listeners.includes(listener)) {continue;}
|
||||
listener(...args);
|
||||
}
|
||||
}
|
||||
|
|
@ -59,7 +59,7 @@ export class EventListeners<TListener extends (...args: any[]) => any> {
|
|||
const snapshot = this.listeners.slice();
|
||||
const promises: Promise<unknown>[] = [];
|
||||
for (const listener of snapshot) {
|
||||
if (!this.listeners.includes(listener)) continue;
|
||||
if (!this.listeners.includes(listener)) {continue;}
|
||||
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
|
||||
const result = listener(...args);
|
||||
if (result instanceof Promise) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue