From 6097b6e27e20874e92b013f069b7519dc831c675 Mon Sep 17 00:00:00 2001 From: wearrrrr Date: Thu, 10 Oct 2024 19:40:18 -0500 Subject: [PATCH 1/3] disable no-empty, sometimes we do want empty blocks --- .eslintrc.json | 1 + 1 file changed, 1 insertion(+) diff --git a/.eslintrc.json b/.eslintrc.json index 2bd8865..23c2d68 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -16,6 +16,7 @@ "prefer-const": "warn", "no-unreachable": "warn", "no-undef": "off", + "no-empty": "off", "@typescript-eslint/no-explicit-any": "off", "@typescript-eslint/ban-ts-comment": "off", "@typescript-eslint/ban-types": "off", From c75f24386600b53e6c863d9a9faaba4b243e93a1 Mon Sep 17 00:00:00 2001 From: wearrrrr Date: Thu, 10 Oct 2024 19:42:02 -0500 Subject: [PATCH 2/3] get rid of errors and warnings in error.ts --- src/client/shared/error.ts | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/client/shared/error.ts b/src/client/shared/error.ts index 9494272..7d6263c 100644 --- a/src/client/shared/error.ts +++ b/src/client/shared/error.ts @@ -2,7 +2,7 @@ import { config, decodeUrl } from "../../shared"; import { ScramjetClient } from "../client"; export const enabled = () => self.$scramjet.config.flags.cleanerrors; -export default function (client: ScramjetClient, self: Self) { +export default function (client: ScramjetClient, _self: Self) { // v8 only. all we need to do is clean the scramjet urls from stack traces const closure = (error, stack) => { let newstack = error.stack; @@ -12,9 +12,9 @@ export default function (client: ScramjetClient, self: Self) { if (url.endsWith(config.client)) { // strip stack frames including scramjet handlers from the trace - let lines = newstack.split("\n"); - let i = lines.find((l) => l.includes(url)); - lines.splice(i, 1); + const lines = newstack.split("\n"); + const line = lines.find((l) => l.includes(url)); + lines.splice(line, 1); newstack = lines.join("\n"); continue; } @@ -27,11 +27,11 @@ export default function (client: ScramjetClient, self: Self) { return newstack; }; client.Trap("Error.prepareStackTrace", { - get(ctx) { + get(_ctx) { // this is a funny js quirk. the getter is ran every time you type something in console return closure; }, - set(value) { + set(_value) { // just ignore it if a site tries setting their own. not much we can really do }, }); From f6928206f4841deaa751125565f63eae0617200e Mon Sep 17 00:00:00 2001 From: wearrrrr Date: Thu, 10 Oct 2024 19:45:45 -0500 Subject: [PATCH 3/3] fix a couple more lint warnings --- src/client/dom/element.ts | 4 ++-- src/client/dom/fontface.ts | 4 ++-- src/shared/rewriters/html.ts | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/client/dom/element.ts b/src/client/dom/element.ts index 6aec14c..2e6e359 100644 --- a/src/client/dom/element.ts +++ b/src/client/dom/element.ts @@ -12,9 +12,9 @@ import { import type { URLMeta } from "../../shared/rewriters/url"; export default function (client: ScramjetClient, self: typeof window) { - const nativeGetAttribute = self.Element.prototype.getAttribute; + const _nativeGetAttribute = self.Element.prototype.getAttribute; const nativeSetAttribute = self.Element.prototype.setAttribute; - const nativeHasAttribute = self.Element.prototype.hasAttribute; + const _nativeHasAttribute = self.Element.prototype.hasAttribute; const attrObject = { nonce: [self.HTMLElement], diff --git a/src/client/dom/fontface.ts b/src/client/dom/fontface.ts index 7e19b85..faef8c7 100644 --- a/src/client/dom/fontface.ts +++ b/src/client/dom/fontface.ts @@ -1,7 +1,7 @@ import { ScramjetClient } from "../client"; -import { decodeUrl, rewriteCss } from "../../shared"; +import { rewriteCss } from "../../shared"; -export default function (client: ScramjetClient, self: typeof window) { +export default function (client: ScramjetClient, _self: Self) { client.Proxy("FontFace", { construct(ctx) { ctx.args[1] = rewriteCss(ctx.args[1], client.meta); diff --git a/src/shared/rewriters/html.ts b/src/shared/rewriters/html.ts index b176411..010aa62 100644 --- a/src/shared/rewriters/html.ts +++ b/src/shared/rewriters/html.ts @@ -270,7 +270,7 @@ export function rewriteSrcset(srcset: string, meta: URLMeta) { return rewrittenUrls.join(""); } -function base64ToBytes(base64) { +function _base64ToBytes(base64) { const binString = atob(base64); return Uint8Array.from(binString, (m) => m.codePointAt(0));