fix format again
This commit is contained in:
parent
a081d09212
commit
e66b0c71c4
16
biome.json
16
biome.json
@ -32,11 +32,23 @@
|
|||||||
"rules": {
|
"rules": {
|
||||||
"recommended": true,
|
"recommended": true,
|
||||||
"suspicious": {
|
"suspicious": {
|
||||||
"noExplicitAny": "off"
|
"noExplicitAny": "off",
|
||||||
|
"noPrototypeBuiltins": "off",
|
||||||
|
"noControlCharactersInRegex": "off"
|
||||||
},
|
},
|
||||||
"style": {
|
"style": {
|
||||||
"noUselessElse": "off",
|
"noUselessElse": "off",
|
||||||
"useNodejsImportProtocol": "off"
|
"useNodejsImportProtocol": "off",
|
||||||
|
"noUnusedTemplateLiteral": "off",
|
||||||
|
"useTemplate": "off",
|
||||||
|
"noNonNullAssertion": "off"
|
||||||
|
},
|
||||||
|
"performance": {
|
||||||
|
"noDelete": "off"
|
||||||
|
},
|
||||||
|
"complexity": {
|
||||||
|
"noForEach": "off",
|
||||||
|
"useLiteralKeys": "off"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -134,7 +134,7 @@ export const fixEntityListCasesInplace = (entities: { key?: string }[]) => {
|
|||||||
caseMapping[newKey.toLocaleLowerCase()] = newKey;
|
caseMapping[newKey.toLocaleLowerCase()] = newKey;
|
||||||
e.key = newKey;
|
e.key = newKey;
|
||||||
// console.log(JSON.stringify(caseMapping,null,2));
|
// console.log(JSON.stringify(caseMapping,null,2));
|
||||||
continue;
|
// continue;
|
||||||
} else {
|
} else {
|
||||||
throw Error(`${parentFolder} doesn't have cases record??`);
|
throw Error(`${parentFolder} doesn't have cases record??`);
|
||||||
}
|
}
|
||||||
@ -145,7 +145,7 @@ export const fixEntityListCasesInplace = (entities: { key?: string }[]) => {
|
|||||||
.slice(-1)
|
.slice(-1)
|
||||||
.join("/")}`;
|
.join("/")}`;
|
||||||
e.key = newKey;
|
e.key = newKey;
|
||||||
continue;
|
// continue;
|
||||||
} else {
|
} else {
|
||||||
throw Error(`${parentFolder} doesn't have cases record??`);
|
throw Error(`${parentFolder} doesn't have cases record??`);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -17,37 +17,31 @@ export function getClient(
|
|||||||
switch (settings.serviceType) {
|
switch (settings.serviceType) {
|
||||||
case "s3":
|
case "s3":
|
||||||
return new FakeFsS3(settings.s3);
|
return new FakeFsS3(settings.s3);
|
||||||
break;
|
|
||||||
case "webdav":
|
case "webdav":
|
||||||
return new FakeFsWebdav(
|
return new FakeFsWebdav(
|
||||||
settings.webdav,
|
settings.webdav,
|
||||||
vaultName,
|
vaultName,
|
||||||
saveUpdatedConfigFunc
|
saveUpdatedConfigFunc
|
||||||
);
|
);
|
||||||
break;
|
|
||||||
case "dropbox":
|
case "dropbox":
|
||||||
return new FakeFsDropbox(
|
return new FakeFsDropbox(
|
||||||
settings.dropbox,
|
settings.dropbox,
|
||||||
vaultName,
|
vaultName,
|
||||||
saveUpdatedConfigFunc
|
saveUpdatedConfigFunc
|
||||||
);
|
);
|
||||||
break;
|
|
||||||
case "onedrive":
|
case "onedrive":
|
||||||
return new FakeFsOnedrive(
|
return new FakeFsOnedrive(
|
||||||
settings.onedrive,
|
settings.onedrive,
|
||||||
vaultName,
|
vaultName,
|
||||||
saveUpdatedConfigFunc
|
saveUpdatedConfigFunc
|
||||||
);
|
);
|
||||||
break;
|
|
||||||
case "webdis":
|
case "webdis":
|
||||||
return new FakeFsWebdis(
|
return new FakeFsWebdis(
|
||||||
settings.webdis,
|
settings.webdis,
|
||||||
vaultName,
|
vaultName,
|
||||||
saveUpdatedConfigFunc
|
saveUpdatedConfigFunc
|
||||||
);
|
);
|
||||||
break;
|
|
||||||
default:
|
default:
|
||||||
throw Error(`cannot init client for serviceType=${settings.serviceType}`);
|
throw Error(`cannot init client for serviceType=${settings.serviceType}`);
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -83,7 +83,7 @@ export class FakeFsLocal extends FakeFs {
|
|||||||
if (r.keyRaw.startsWith(DEFAULT_DEBUG_FOLDER)) {
|
if (r.keyRaw.startsWith(DEFAULT_DEBUG_FOLDER)) {
|
||||||
// skip listing the debug folder,
|
// skip listing the debug folder,
|
||||||
// which should always not involved in sync
|
// which should always not involved in sync
|
||||||
continue;
|
// continue;
|
||||||
} else {
|
} else {
|
||||||
local.push(r);
|
local.push(r);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -567,6 +567,7 @@ export class FakeFsOnedrive extends FakeFs {
|
|||||||
// TODO:
|
// TODO:
|
||||||
// 20220401: On Android, requestUrl has issue that text becomes base64.
|
// 20220401: On Android, requestUrl has issue that text becomes base64.
|
||||||
// Use fetch everywhere instead!
|
// Use fetch everywhere instead!
|
||||||
|
// biome-ignore lint/correctness/noConstantCondition: hard code
|
||||||
if (false /*VALID_REQURL*/) {
|
if (false /*VALID_REQURL*/) {
|
||||||
const res = await requestUrl({
|
const res = await requestUrl({
|
||||||
url: theUrl,
|
url: theUrl,
|
||||||
@ -617,6 +618,7 @@ export class FakeFsOnedrive extends FakeFs {
|
|||||||
// TODO:
|
// TODO:
|
||||||
// 20220401: On Android, requestUrl has issue that text becomes base64.
|
// 20220401: On Android, requestUrl has issue that text becomes base64.
|
||||||
// Use fetch everywhere instead!
|
// Use fetch everywhere instead!
|
||||||
|
// biome-ignore lint/correctness/noConstantCondition: hard code
|
||||||
if (false /*VALID_REQURL*/) {
|
if (false /*VALID_REQURL*/) {
|
||||||
const res = await requestUrl({
|
const res = await requestUrl({
|
||||||
url: theUrl,
|
url: theUrl,
|
||||||
|
|||||||
@ -22,6 +22,7 @@ import {
|
|||||||
import { requestTimeout } from "@smithy/fetch-http-handler/dist-es/request-timeout";
|
import { requestTimeout } from "@smithy/fetch-http-handler/dist-es/request-timeout";
|
||||||
import { type HttpRequest, HttpResponse } from "@smithy/protocol-http";
|
import { type HttpRequest, HttpResponse } from "@smithy/protocol-http";
|
||||||
import { buildQueryString } from "@smithy/querystring-builder";
|
import { buildQueryString } from "@smithy/querystring-builder";
|
||||||
|
// biome-ignore lint/suspicious/noShadowRestrictedNames: <explanation>
|
||||||
import AggregateError from "aggregate-error";
|
import AggregateError from "aggregate-error";
|
||||||
import * as mime from "mime-types";
|
import * as mime from "mime-types";
|
||||||
import { Platform, type RequestUrlParam, requestUrl } from "obsidian";
|
import { Platform, type RequestUrlParam, requestUrl } from "obsidian";
|
||||||
|
|||||||
@ -53,6 +53,7 @@ import {
|
|||||||
import { RemotelySaveSettingTab } from "./settings";
|
import { RemotelySaveSettingTab } from "./settings";
|
||||||
import { SyncAlgoV3Modal } from "./syncAlgoV3Notice";
|
import { SyncAlgoV3Modal } from "./syncAlgoV3Notice";
|
||||||
|
|
||||||
|
// biome-ignore lint/suspicious/noShadowRestrictedNames: <explanation>
|
||||||
import AggregateError from "aggregate-error";
|
import AggregateError from "aggregate-error";
|
||||||
import throttle from "lodash/throttle";
|
import throttle from "lodash/throttle";
|
||||||
import { exportVaultSyncPlansToFiles } from "./debugMode";
|
import { exportVaultSyncPlansToFiles } from "./debugMode";
|
||||||
@ -300,7 +301,6 @@ export default class RemotelySavePlugin extends Plugin {
|
|||||||
|
|
||||||
default:
|
default:
|
||||||
throw Error(`unknown step=${step} for showing notice`);
|
throw Error(`unknown step=${step} for showing notice`);
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
16
src/misc.ts
16
src/misc.ts
@ -115,7 +115,7 @@ export const base64ToArrayBuffer = (b64text: string) => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
export const copyArrayBuffer = (src: ArrayBuffer) => {
|
export const copyArrayBuffer = (src: ArrayBuffer) => {
|
||||||
var dst = new ArrayBuffer(src.byteLength);
|
const dst = new ArrayBuffer(src.byteLength);
|
||||||
new Uint8Array(dst).set(new Uint8Array(src));
|
new Uint8Array(dst).set(new Uint8Array(src));
|
||||||
return dst;
|
return dst;
|
||||||
};
|
};
|
||||||
@ -254,9 +254,9 @@ export const getRandomIntInclusive = (min: number, max: number) => {
|
|||||||
const randomBuffer = new Uint32Array(1);
|
const randomBuffer = new Uint32Array(1);
|
||||||
window.crypto.getRandomValues(randomBuffer);
|
window.crypto.getRandomValues(randomBuffer);
|
||||||
const randomNumber = randomBuffer[0] / (0xffffffff + 1);
|
const randomNumber = randomBuffer[0] / (0xffffffff + 1);
|
||||||
min = Math.ceil(min);
|
const min2 = Math.ceil(min);
|
||||||
max = Math.floor(max);
|
const max2 = Math.floor(max);
|
||||||
return Math.floor(randomNumber * (max - min + 1)) + min;
|
return Math.floor(randomNumber * (max2 - min2 + 1)) + min2;
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -389,9 +389,8 @@ export const toText = (x: any) => {
|
|||||||
|
|
||||||
if (
|
if (
|
||||||
x instanceof Error ||
|
x instanceof Error ||
|
||||||
(x &&
|
(x?.stack &&
|
||||||
x.stack &&
|
x?.message &&
|
||||||
x.message &&
|
|
||||||
typeof x.stack === "string" &&
|
typeof x.stack === "string" &&
|
||||||
typeof x.message === "string")
|
typeof x.message === "string")
|
||||||
) {
|
) {
|
||||||
@ -587,6 +586,7 @@ export const changeMobileStatusBar = (
|
|||||||
if (oldAppContainerObserver !== undefined) {
|
if (oldAppContainerObserver !== undefined) {
|
||||||
console.debug(`disconnect oldAppContainerObserver`);
|
console.debug(`disconnect oldAppContainerObserver`);
|
||||||
oldAppContainerObserver.disconnect();
|
oldAppContainerObserver.disconnect();
|
||||||
|
// biome-ignore lint/style/noParameterAssign: we want gc
|
||||||
oldAppContainerObserver = undefined;
|
oldAppContainerObserver = undefined;
|
||||||
}
|
}
|
||||||
statusbar.style.removeProperty("display");
|
statusbar.style.removeProperty("display");
|
||||||
@ -623,7 +623,6 @@ export const fixEntityListCasesInplace = (entities: { keyRaw: string }[]) => {
|
|||||||
caseMapping[newKeyRaw.toLocaleLowerCase()] = newKeyRaw;
|
caseMapping[newKeyRaw.toLocaleLowerCase()] = newKeyRaw;
|
||||||
e.keyRaw = newKeyRaw;
|
e.keyRaw = newKeyRaw;
|
||||||
// console.log(JSON.stringify(caseMapping,null,2));
|
// console.log(JSON.stringify(caseMapping,null,2));
|
||||||
continue;
|
|
||||||
} else {
|
} else {
|
||||||
throw Error(`${parentFolder} doesn't have cases record??`);
|
throw Error(`${parentFolder} doesn't have cases record??`);
|
||||||
}
|
}
|
||||||
@ -634,7 +633,6 @@ export const fixEntityListCasesInplace = (entities: { keyRaw: string }[]) => {
|
|||||||
.slice(-1)
|
.slice(-1)
|
||||||
.join("/")}`;
|
.join("/")}`;
|
||||||
e.keyRaw = newKeyRaw;
|
e.keyRaw = newKeyRaw;
|
||||||
continue;
|
|
||||||
} else {
|
} else {
|
||||||
throw Error(`${parentFolder} doesn't have cases record??`);
|
throw Error(`${parentFolder} doesn't have cases record??`);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,3 +1,4 @@
|
|||||||
|
// biome-ignore lint/suspicious/noShadowRestrictedNames: <explanation>
|
||||||
import AggregateError from "aggregate-error";
|
import AggregateError from "aggregate-error";
|
||||||
import PQueue from "p-queue";
|
import PQueue from "p-queue";
|
||||||
import XRegExp from "xregexp";
|
import XRegExp from "xregexp";
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user