Skip to content

Commit

Permalink
smaller fixes and linting tweaks
Browse files Browse the repository at this point in the history
  • Loading branch information
emma-sg committed Jan 3, 2024
1 parent 4c0fb23 commit 9236377
Show file tree
Hide file tree
Showing 7 changed files with 9 additions and 14 deletions.
1 change: 1 addition & 0 deletions src/electron/electron-rec-preload.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import { ensureDefaultColl } from "../utils";

import { loader, getDB } from "replaywebpage/src/electron-preload";

// eslint-disable-next-line @typescript-eslint/no-var-requires
const { ipcRenderer, contextBridge } = require("electron");

let downloadCallback;
Expand Down
5 changes: 1 addition & 4 deletions src/electron/electron-recorder.ts
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ class ElectronRecorder extends Recorder {

const base64Str = data.toString("base64");

const responseHeaders = [];
const responseHeaders: { name: string; value: string }[] = [];

const origin = headers.get("origin");

Expand All @@ -199,15 +199,12 @@ class ElectronRecorder extends Recorder {

if (origin) {
responseHeaders.push({
// @ts-expect-error - TS2322 - Type 'string' is not assignable to type 'never'.
name: "Access-Control-Allow-Origin",
// @ts-expect-error - TS2322 - Type 'string' is not assignable to type 'never'.
value: origin,
});
}

if (mimeType) {
// @ts-expect-error - TS2322 - Type 'string' is not assignable to type 'never'. | TS2322 - Type 'any' is not assignable to type 'never'.
responseHeaders.push({ name: "Content-Type", value: mimeType });
}

Expand Down
1 change: 1 addition & 0 deletions src/electron/rec-preload.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
/*eslint-env node */

// eslint-disable-next-line @typescript-eslint/no-var-requires
const { ipcRenderer, contextBridge } = require("electron");

ipcRenderer.on("stats", (event, stats) => {
Expand Down
4 changes: 2 additions & 2 deletions src/recorder.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1372,7 +1372,7 @@ class Recorder {
}

_getContentType(headers) {
for (let header of headers) {
for (const header of headers) {
if (header.name.toLowerCase() === "content-type") {
return header.value.split(";")[0];
}
Expand Down Expand Up @@ -1804,7 +1804,7 @@ class Recorder {

if (reqresp.hasPostData && !reqresp.postData) {
try {
let postRes = await this.send(
const postRes = await this.send(
"Network.getRequestPostData",
// @ts-expect-error - TS2345 - Argument of type '{ requestId: any; }' is not assignable to parameter of type 'null | undefined'.
{ requestId: reqresp.requestId },
Expand Down
6 changes: 2 additions & 4 deletions src/ui/app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ import {
} from "auto-js-ipfs";
import { getLocalOption, setLocalOption } from "../localstorage";

// eslint-disable-next-line no-undef
const VERSION = __AWP_VERSION__;

const DEFAULT_GATEWAY_URL = "https://w3s.link/ipfs/";
Expand Down Expand Up @@ -265,7 +264,7 @@ class ArchiveWebApp extends ReplayWebApp {
}

console.log("attempt to disable CSP to ensure replay works");
let tabId = await new Promise((resolve) => {
const tabId = await new Promise((resolve) => {
chrome.tabs.getCurrent((msg) => resolve(msg.id));
});

Expand Down Expand Up @@ -976,7 +975,7 @@ class ArchiveWebApp extends ReplayWebApp {
<summary>Legalese:</summary>
<p style="font-size: 0.8rem">DISCLAIMER OF SOFTWARE WARRANTY. WEBRECORDER SOFTWARE PROVIDES THIS SOFTWARE TO YOU "AS AVAILABLE"
AND WITHOUT WARRANTY OF ANY KIND, EXPRESS, IMPLIED OR OTHERWISE,
INCLUDING WITHOUT LIMITATION ANY WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.
INCLUDING WITHOUT LIMITATION ANY WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.</p>
</details>
<div class="has-text-centered">
Expand Down Expand Up @@ -1450,7 +1449,6 @@ class ArchiveWebApp extends ReplayWebApp {
}

if (!ipfsOpts.daemonUrl && ipfsOpts.autoDetect) {
// eslint-disable-next-line no-undef
const autoipfs = await createAutoIpfs({
web3StorageToken: __WEB3_STORAGE_TOKEN__,
});
Expand Down
3 changes: 1 addition & 2 deletions src/ui/coll-info.ts
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,7 @@ class WrRecCollInfo extends CollInfo {
href="${apiPrefix}/c/${
// @ts-expect-error - TS2339 - Property 'coll' does not exist on type 'WrRecCollInfo'.
this.coll.id
}/dl?format=wacz&pages=all"
}/dl?format=wacz&amp;pages=all"
class="button is-small"
title="Download"
>
Expand Down Expand Up @@ -387,7 +387,6 @@ class WrRecCollInfo extends CollInfo {
: html`
<div class="is-flex is-flex-direction-column">
<button
// @ts-expect-error - TS2339 - Property 'shareWait' does not exist on type 'WrRecCollInfo'.
class="button is-small ${
// @ts-expect-error - TS2339 - Property 'shareWait' does not exist on type 'WrRecCollInfo'.
this.shareWait ? "is-loading" : ""
Expand Down
3 changes: 1 addition & 2 deletions src/ui/upload.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ import fasCheck from "@fortawesome/fontawesome-free/svgs/solid/check-circle.svg"
import fasExternal from "@fortawesome/fontawesome-free/svgs/solid/external-link-alt.svg";
import fasX from "@fortawesome/fontawesome-free/svgs/solid/times-circle.svg";

// eslint-disable-next-line no-undef
const VERSION = __AWP_VERSION__;

class BtrixUploader extends LitElement {
Expand Down Expand Up @@ -71,7 +70,7 @@ class BtrixUploader extends LitElement {
// @ts-expect-error - TS2339 - Property 'pollingUploadState' does not exist on type 'BtrixUploader'.
this.pollingUploadState = true;

let loop = true;
const loop = true;

while (loop) {
// @ts-expect-error - TS2339 - Property 'coll' does not exist on type 'BtrixUploader'.
Expand Down

0 comments on commit 9236377

Please sign in to comment.