From 8facb19bd57930e72304d2d1cc4df06e939a0351 Mon Sep 17 00:00:00 2001 From: yasharpm Date: Thu, 15 Aug 2024 14:18:23 +0000 Subject: [PATCH] Fixed lint issues --- src/interfaces/configObserver.ts | 2 +- src/remotestorage.ts | 4 ++-- src/solid.ts | 22 +++++++++++++++------- src/solidStorage.ts | 8 ++++---- 4 files changed, 22 insertions(+), 14 deletions(-) diff --git a/src/interfaces/configObserver.ts b/src/interfaces/configObserver.ts index e3e66f04b..fcc8deeb4 100644 --- a/src/interfaces/configObserver.ts +++ b/src/interfaces/configObserver.ts @@ -1,3 +1,3 @@ -export default interface ConfigObserver { +export interface ConfigObserver { onConfigChanged(config: string): void; } \ No newline at end of file diff --git a/src/remotestorage.ts b/src/remotestorage.ts index 52135893e..a641495f3 100644 --- a/src/remotestorage.ts +++ b/src/remotestorage.ts @@ -199,8 +199,8 @@ class RemoteStorage { case 'pod-not-selected': if ((this.remote instanceof Solid) && this.remote.getPodURLs().length > 0 - && this.remote.getPodURL() == null) { - setTimeout(handler, 0); + && this.remote.getPodURL() === null) { + setTimeout(handler, 0); } break; } diff --git a/src/solid.ts b/src/solid.ts index 40581f7a0..2482f1285 100644 --- a/src/solid.ts +++ b/src/solid.ts @@ -15,7 +15,7 @@ import { localStorageAvailable } from './util'; import {Remote, RemoteBase, RemoteResponse, RemoteSettings} from "./remote"; -import ConfigObserver from "./interfaces/configObserver"; +import { ConfigObserver } from "./interfaces/configObserver"; import ConfigStorage from "./solidStorage"; import Blob from "blob"; @@ -65,10 +65,18 @@ function unHookGetItemURL (rs): void { */ function requestBodyToBlob(body: XMLHttpRequestBodyInit): Blob { if (typeof(body) === 'object') { - if (body instanceof Blob) return body; - if (body instanceof DataView) return new Blob([ body ], { type : "application/octet-stream" }); - if (body instanceof ArrayBuffer) return new Blob([ new DataView(body) ]); - if (ArrayBuffer.isView(body)) return new Blob([ body ], { type : "application/octet-stream" }); + if (body instanceof Blob) { + return body; + } + if (body instanceof DataView) { + return new Blob([ body ], { type : "application/octet-stream" }); + } + if (body instanceof ArrayBuffer) { + return new Blob([ new DataView(body) ]); + } + if (ArrayBuffer.isView(body)) { + return new Blob([ body ], { type : "application/octet-stream" }); + } if (body instanceof FormData) { return new Blob([ new URLSearchParams([JSON.parse(JSON.stringify(body.entries()))]).toString() ], { type : 'application/x-www-form-urlencoded' }); @@ -347,7 +355,7 @@ class Solid extends RemoteBase implements Remote, ConfigObserver { map[itemName] = { 'Content-Length': 1, // TODO FIX THESE 'Last-Modified': 1, // date.toUTCString() - } + }; } return map; @@ -424,7 +432,7 @@ class Solid extends RemoteBase implements Remote, ConfigObserver { }).catch(error => { return Promise.reject("PUT failed with status " + error.statusCode + " (" + error.message + ")"); }); - } + }; return getFile(fileURL, { fetch: fetch}).then(file => { if (options && (options.ifNoneMatch === '*')) { diff --git a/src/solidStorage.ts b/src/solidStorage.ts index 875599a44..934140f5d 100644 --- a/src/solidStorage.ts +++ b/src/solidStorage.ts @@ -1,7 +1,7 @@ import { - IStorage, - } from "@inrupt/solid-client-authn-browser"; -import ConfigObserver from "./interfaces/configObserver"; + IStorage, +} from "@inrupt/solid-client-authn-browser"; +import { ConfigObserver } from "./interfaces/configObserver"; class BrowserStorage implements IStorage { get storage(): typeof window.localStorage { @@ -27,7 +27,7 @@ export default class ConfigStorage implements IStorage { private observer: ConfigObserver; constructor(observer: ConfigObserver) { - this.observer = observer; + this.observer = observer; } private isConfigKey(key: string): boolean {