fix format again

This commit is contained in:
fyears 2024-05-08 22:04:21 +08:00
parent a081d09212
commit e66b0c71c4
9 changed files with 29 additions and 21 deletions

View File

@ -32,11 +32,23 @@
"rules": {
"recommended": true,
"suspicious": {
"noExplicitAny": "off"
"noExplicitAny": "off",
"noPrototypeBuiltins": "off",
"noControlCharactersInRegex": "off"
},
"style": {
"noUselessElse": "off",
"useNodejsImportProtocol": "off"
"useNodejsImportProtocol": "off",
"noUnusedTemplateLiteral": "off",
"useTemplate": "off",
"noNonNullAssertion": "off"
},
"performance": {
"noDelete": "off"
},
"complexity": {
"noForEach": "off",
"useLiteralKeys": "off"
}
}
}

View File

@ -134,7 +134,7 @@ export const fixEntityListCasesInplace = (entities: { key?: string }[]) => {
caseMapping[newKey.toLocaleLowerCase()] = newKey;
e.key = newKey;
// console.log(JSON.stringify(caseMapping,null,2));
continue;
// continue;
} else {
throw Error(`${parentFolder} doesn't have cases record??`);
}
@ -145,7 +145,7 @@ export const fixEntityListCasesInplace = (entities: { key?: string }[]) => {
.slice(-1)
.join("/")}`;
e.key = newKey;
continue;
// continue;
} else {
throw Error(`${parentFolder} doesn't have cases record??`);
}

View File

@ -17,37 +17,31 @@ export function getClient(
switch (settings.serviceType) {
case "s3":
return new FakeFsS3(settings.s3);
break;
case "webdav":
return new FakeFsWebdav(
settings.webdav,
vaultName,
saveUpdatedConfigFunc
);
break;
case "dropbox":
return new FakeFsDropbox(
settings.dropbox,
vaultName,
saveUpdatedConfigFunc
);
break;
case "onedrive":
return new FakeFsOnedrive(
settings.onedrive,
vaultName,
saveUpdatedConfigFunc
);
break;
case "webdis":
return new FakeFsWebdis(
settings.webdis,
vaultName,
saveUpdatedConfigFunc
);
break;
default:
throw Error(`cannot init client for serviceType=${settings.serviceType}`);
break;
}
}

View File

@ -83,7 +83,7 @@ export class FakeFsLocal extends FakeFs {
if (r.keyRaw.startsWith(DEFAULT_DEBUG_FOLDER)) {
// skip listing the debug folder,
// which should always not involved in sync
continue;
// continue;
} else {
local.push(r);
}

View File

@ -567,6 +567,7 @@ export class FakeFsOnedrive extends FakeFs {
// TODO:
// 20220401: On Android, requestUrl has issue that text becomes base64.
// Use fetch everywhere instead!
// biome-ignore lint/correctness/noConstantCondition: hard code
if (false /*VALID_REQURL*/) {
const res = await requestUrl({
url: theUrl,
@ -617,6 +618,7 @@ export class FakeFsOnedrive extends FakeFs {
// TODO:
// 20220401: On Android, requestUrl has issue that text becomes base64.
// Use fetch everywhere instead!
// biome-ignore lint/correctness/noConstantCondition: hard code
if (false /*VALID_REQURL*/) {
const res = await requestUrl({
url: theUrl,

View File

@ -22,6 +22,7 @@ import {
import { requestTimeout } from "@smithy/fetch-http-handler/dist-es/request-timeout";
import { type HttpRequest, HttpResponse } from "@smithy/protocol-http";
import { buildQueryString } from "@smithy/querystring-builder";
// biome-ignore lint/suspicious/noShadowRestrictedNames: <explanation>
import AggregateError from "aggregate-error";
import * as mime from "mime-types";
import { Platform, type RequestUrlParam, requestUrl } from "obsidian";

View File

@ -53,6 +53,7 @@ import {
import { RemotelySaveSettingTab } from "./settings";
import { SyncAlgoV3Modal } from "./syncAlgoV3Notice";
// biome-ignore lint/suspicious/noShadowRestrictedNames: <explanation>
import AggregateError from "aggregate-error";
import throttle from "lodash/throttle";
import { exportVaultSyncPlansToFiles } from "./debugMode";
@ -300,7 +301,6 @@ export default class RemotelySavePlugin extends Plugin {
default:
throw Error(`unknown step=${step} for showing notice`);
break;
}
};

View File

@ -115,7 +115,7 @@ export const base64ToArrayBuffer = (b64text: string) => {
};
export const copyArrayBuffer = (src: ArrayBuffer) => {
var dst = new ArrayBuffer(src.byteLength);
const dst = new ArrayBuffer(src.byteLength);
new Uint8Array(dst).set(new Uint8Array(src));
return dst;
};
@ -254,9 +254,9 @@ export const getRandomIntInclusive = (min: number, max: number) => {
const randomBuffer = new Uint32Array(1);
window.crypto.getRandomValues(randomBuffer);
const randomNumber = randomBuffer[0] / (0xffffffff + 1);
min = Math.ceil(min);
max = Math.floor(max);
return Math.floor(randomNumber * (max - min + 1)) + min;
const min2 = Math.ceil(min);
const max2 = Math.floor(max);
return Math.floor(randomNumber * (max2 - min2 + 1)) + min2;
};
/**
@ -389,9 +389,8 @@ export const toText = (x: any) => {
if (
x instanceof Error ||
(x &&
x.stack &&
x.message &&
(x?.stack &&
x?.message &&
typeof x.stack === "string" &&
typeof x.message === "string")
) {
@ -587,6 +586,7 @@ export const changeMobileStatusBar = (
if (oldAppContainerObserver !== undefined) {
console.debug(`disconnect oldAppContainerObserver`);
oldAppContainerObserver.disconnect();
// biome-ignore lint/style/noParameterAssign: we want gc
oldAppContainerObserver = undefined;
}
statusbar.style.removeProperty("display");
@ -623,7 +623,6 @@ export const fixEntityListCasesInplace = (entities: { keyRaw: string }[]) => {
caseMapping[newKeyRaw.toLocaleLowerCase()] = newKeyRaw;
e.keyRaw = newKeyRaw;
// console.log(JSON.stringify(caseMapping,null,2));
continue;
} else {
throw Error(`${parentFolder} doesn't have cases record??`);
}
@ -634,7 +633,6 @@ export const fixEntityListCasesInplace = (entities: { keyRaw: string }[]) => {
.slice(-1)
.join("/")}`;
e.keyRaw = newKeyRaw;
continue;
} else {
throw Error(`${parentFolder} doesn't have cases record??`);
}

View File

@ -1,3 +1,4 @@
// biome-ignore lint/suspicious/noShadowRestrictedNames: <explanation>
import AggregateError from "aggregate-error";
import PQueue from "p-queue";
import XRegExp from "xregexp";