no more eslint errors, just warnings

This commit is contained in:
wearrrrr 2024-10-17 01:10:05 -05:00
parent e5a0843b5f
commit 51ce240bf5
11 changed files with 29 additions and 22 deletions

View file

@ -47,6 +47,7 @@ export default [
"no-undef": "off", "no-undef": "off",
"no-empty": "off", "no-empty": "off",
"no-debugger": "off", "no-debugger": "off",
"no-shadow": "off",
"@typescript-eslint/no-explicit-any": "off", "@typescript-eslint/no-explicit-any": "off",
"@typescript-eslint/ban-ts-comment": "off", "@typescript-eslint/ban-ts-comment": "off",
"@typescript-eslint/ban-types": "off", "@typescript-eslint/ban-types": "off",

View file

@ -26,6 +26,7 @@ export default function (client: ScramjetClient, self: typeof window) {
if (thisArg === proxy) { if (thisArg === proxy) {
return Reflect.apply(target, map, argArray); return Reflect.apply(target, map, argArray);
} }
return Reflect.apply(target, thisArg, argArray); return Reflect.apply(target, thisArg, argArray);
}, },
}); });
@ -34,7 +35,7 @@ export default function (client: ScramjetClient, self: typeof window) {
if (!this.has(target, prop)) return undefined; if (!this.has(target, prop)) return undefined;
if (value instanceof Attr) { if (value instanceof Attr) {
let attr = value; const attr = value;
return new Proxy(attr, { return new Proxy(attr, {
get(target, prop) { get(target, prop) {
@ -69,15 +70,18 @@ export default function (client: ScramjetClient, self: typeof window) {
}, },
ownKeys(target) { ownKeys(target) {
const keys = Reflect.ownKeys(target); const keys = Reflect.ownKeys(target);
return keys.filter((key) => this.has(target, key)); return keys.filter((key) => this.has(target, key));
}, },
has(target, prop) { has(target, prop) {
if (typeof prop === "symbol") return Reflect.has(target, prop); if (typeof prop === "symbol") return Reflect.has(target, prop);
if (prop.startsWith("data-scramjet-")) return false; if (prop.startsWith("data-scramjet-")) return false;
if (map[prop]?.name?.startsWith("data-scramjet-")) return false; if (map[prop]?.name?.startsWith("data-scramjet-")) return false;
return Reflect.has(target, prop); return Reflect.has(target, prop);
}, },
}); });
return proxy; return proxy;
}, },
}); });

View file

@ -60,7 +60,8 @@ export function createGlobalProxy(
set(target, prop, value) { set(target, prop, value) {
if (prop === "location") { if (prop === "location") {
client.url = value; client.url = value;
return;
return;
} }
return Reflect.set(target, prop, value); return Reflect.set(target, prop, value);

View file

@ -8,7 +8,7 @@ export function argdbg(arg, recurse = []) {
switch (typeof arg) { switch (typeof arg) {
case "string": case "string":
if (arg.includes("localhost:1337/scramjet/") && arg.includes("m3u8")) if (arg.includes("localhost:1337/scramjet/") && arg.includes("m3u8"))
// eslint-disable-next-line no-debugger
debugger; debugger;
break; break;
case "object": case "object":

View file

@ -8,7 +8,7 @@ export default function (client: ScramjetClient, self: typeof globalThis) {
// the empty object is the "pollutant" which can reconstruct the real realm // the empty object is the "pollutant" which can reconstruct the real realm
// i explain more in postmessage.ts // i explain more in postmessage.ts
Object.defineProperty(self.Object.prototype, config.globals.setrealmfn, { Object.defineProperty(self.Object.prototype, config.globals.setrealmfn, {
value(pollution: {}) { value(pollution: object) {
// this is bad!! sites could detect this // this is bad!! sites could detect this
Object.defineProperty(this, POLLUTANT, { Object.defineProperty(this, POLLUTANT, {
value: pollution, value: pollution,

View file

@ -2,8 +2,8 @@ import { iswindow, isworker } from "..";
import { SCRAMJETCLIENT } from "../../symbols"; import { SCRAMJETCLIENT } from "../../symbols";
import { ScramjetClient } from "../client"; import { ScramjetClient } from "../client";
import { config } from "../../shared"; import { config } from "../../shared";
import { argdbg } from "./err"; // import { argdbg } from "./err";
import { indirectEval } from "./eval"; // import { indirectEval } from "./eval";
export function createWrapFn(client: ScramjetClient, self: typeof globalThis) { export function createWrapFn(client: ScramjetClient, self: typeof globalThis) {
return function (identifier: any, args: any) { return function (identifier: any, args: any) {

View file

@ -1,4 +1,4 @@
import { ScramjetConfig, ScramjetFlags } from "./types"; import { ScramjetFlags } from "./types";
if (!("$scramjet" in self)) { if (!("$scramjet" in self)) {
// @ts-expect-error ts stuff // @ts-expect-error ts stuff
@ -27,7 +27,7 @@ export function loadCodecs() {
} }
export function flagEnabled(flag: keyof ScramjetFlags, url: URL): boolean { export function flagEnabled(flag: keyof ScramjetFlags, url: URL): boolean {
let value = $scramjet.config.defaultFlags[flag]; const value = $scramjet.config.defaultFlags[flag];
for (const regex in $scramjet.config.siteFlags) { for (const regex in $scramjet.config.siteFlags) {
const partialflags = $scramjet.config.siteFlags[regex]; const partialflags = $scramjet.config.siteFlags[regex];
if (new RegExp(regex).test(url.href) && flag in partialflags) { if (new RegExp(regex).test(url.href) && flag in partialflags) {

View file

@ -24,7 +24,8 @@ export function rewriteJs(js: string | ArrayBuffer, meta: URLMeta) {
const text = typeof js === "string" ? js : new TextDecoder().decode(js); const text = typeof js === "string" ? js : new TextDecoder().decode(js);
console.log("naiive"); console.log("naiive");
return rewriteJsNaiive(text);
return rewriteJsNaiive(text);
} }
// const before = performance.now(); // const before = performance.now();

View file

@ -10,7 +10,7 @@ export function rewriteWorkers(
) { ) {
let str = ""; let str = "";
let script = (script) => { const script = (script) => {
if (type === "module") { if (type === "module") {
str += `import "${$scramjet.config.files[script]}"\n`; str += `import "${$scramjet.config.files[script]}"\n`;
} else { } else {

View file

@ -1,4 +1,4 @@
import { defineConfig, devices } from '@playwright/test'; import { defineConfig, devices } from "@playwright/test";
/** /**
* Read environment variables from file. * Read environment variables from file.
@ -12,7 +12,7 @@ import { defineConfig, devices } from '@playwright/test';
* See https://playwright.dev/docs/test-configuration. * See https://playwright.dev/docs/test-configuration.
*/ */
export default defineConfig({ export default defineConfig({
testDir: './tests', testDir: "./tests",
/* Run tests in files in parallel */ /* Run tests in files in parallel */
fullyParallel: true, fullyParallel: true,
/* Fail the build on CI if you accidentally left test.only in the source code. */ /* Fail the build on CI if you accidentally left test.only in the source code. */
@ -22,21 +22,21 @@ export default defineConfig({
/* Opt out of parallel tests on CI. */ /* Opt out of parallel tests on CI. */
workers: process.env.CI ? 1 : undefined, workers: process.env.CI ? 1 : undefined,
/* Reporter to use. See https://playwright.dev/docs/test-reporters */ /* Reporter to use. See https://playwright.dev/docs/test-reporters */
reporter: 'html', reporter: "html",
/* Shared settings for all the projects below. See https://playwright.dev/docs/api/class-testoptions. */ /* Shared settings for all the projects below. See https://playwright.dev/docs/api/class-testoptions. */
use: { use: {
/* Base URL to use in actions like `await page.goto('/')`. */ /* Base URL to use in actions like `await page.goto('/')`. */
// baseURL: 'http://127.0.0.1:3000', // baseURL: 'http://127.0.0.1:3000',
/* Collect trace when retrying the failed test. See https://playwright.dev/docs/trace-viewer */ /* Collect trace when retrying the failed test. See https://playwright.dev/docs/trace-viewer */
trace: 'on-first-retry', trace: "on-first-retry",
}, },
/* Configure projects for major browsers */ /* Configure projects for major browsers */
projects: [ projects: [
{ {
name: 'chromium', name: "chromium",
use: { ...devices['Desktop Chrome'] }, use: { ...devices["Desktop Chrome"] },
}, },
// { // {
@ -47,8 +47,8 @@ export default defineConfig({
/* Run your local dev server before starting the tests */ /* Run your local dev server before starting the tests */
webServer: { webServer: {
command: 'cd .. && pnpm run dev', command: "cd .. && pnpm run dev",
url: 'http://127.0.0.1:1337', url: "http://127.0.0.1:1337",
reuseExistingServer: !process.env.CI, reuseExistingServer: !process.env.CI,
}, },
}); });

View file

@ -1,12 +1,12 @@
import { test, expect, type Page } from '@playwright/test'; import { test, expect } from "@playwright/test";
test.beforeEach(async ({ page }) => { test.beforeEach(async ({ page }) => {
await page.goto('http://localhost:1337'); await page.goto("http://localhost:1337");
}); });
test.describe("Page loaded", () => { test.describe("Page loaded", () => {
test("should display the title", async ({ page }) => { test("should display the title", async ({ page }) => {
const title = await page.locator('h1').textContent(); const title = await page.locator("h1").textContent();
expect(title).toBe('Percury Unblocker'); expect(title).toBe("Percury Unblocker");
}); });
}) })