From f1cd0477474d62c19f407fa3e3d4ec39314d0cef Mon Sep 17 00:00:00 2001 From: HoJeong Go <seia@outlook.kr> Date: Tue, 3 Dec 2024 13:07:25 +0900 Subject: [PATCH 1/2] chore: fix linter exceptions --- packages/adblocker-playwright/src/index.ts | 5 ++--- packages/adblocker-puppeteer/src/index.ts | 5 ++--- packages/adblocker/tools/stress-test-engine-update.ts | 3 +-- 3 files changed, 5 insertions(+), 8 deletions(-) diff --git a/packages/adblocker-playwright/src/index.ts b/packages/adblocker-playwright/src/index.ts index 53c415299f..c8232c29df 100644 --- a/packages/adblocker-playwright/src/index.ts +++ b/packages/adblocker-playwright/src/index.ts @@ -242,7 +242,7 @@ export class PlaywrightBlocker extends FiltersEngine { // `enableMutationObserver` is disabled in config, which means that we // should not actively monitor the DOM for changes. let numberOfIterations = 0; - do { + for (;;) { if (frame.isDetached()) { break; } @@ -269,8 +269,7 @@ export class PlaywrightBlocker extends FiltersEngine { } await sleep(500); - // eslint-disable-next-line no-constant-condition - } while (true); + } }; public onRequest = async (route: pw.Route): Promise<void> => { diff --git a/packages/adblocker-puppeteer/src/index.ts b/packages/adblocker-puppeteer/src/index.ts index f6d1679fbf..1dfe6aab52 100644 --- a/packages/adblocker-puppeteer/src/index.ts +++ b/packages/adblocker-puppeteer/src/index.ts @@ -252,7 +252,7 @@ export class PuppeteerBlocker extends FiltersEngine { // `enableMutationObserver` is disabled in config, which means that we // should not actively monitor the DOM for changes. let numberOfIterations = 0; - do { + for (;;) { if (frame.isDetached()) { break; } @@ -279,8 +279,7 @@ export class PuppeteerBlocker extends FiltersEngine { } await sleep(500); - // eslint-disable-next-line no-constant-condition - } while (true); + } }; public setRequestInterceptionPriority = (defaultPriority = 0) => diff --git a/packages/adblocker/tools/stress-test-engine-update.ts b/packages/adblocker/tools/stress-test-engine-update.ts index 7149deb2a0..6e0518b505 100644 --- a/packages/adblocker/tools/stress-test-engine-update.ts +++ b/packages/adblocker/tools/stress-test-engine-update.ts @@ -148,7 +148,7 @@ function filtersDiff( return differences; } -async function getMeta(url: string): Promise<any> { +async function getMeta(url: string): Promise<{ name: string; revisions: string[] }> { const meta = (await axios.get(url)).data; if (typeof meta === 'string') { const buffer = Buffer.from( @@ -273,7 +273,6 @@ async function collectTestCases(list: string): Promise<TestCase[]> { const revisions: Set<string> = new Set(); // Append current revision (the most recent one) - // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access const previousRevisions = [...meta.revisions]; console.log('revisions', previousRevisions); From 8e7e306856dc4e89471a7d26b3cbbf1cc28c052d Mon Sep 17 00:00:00 2001 From: HoJeong Go <seia@outlook.kr> Date: Thu, 5 Dec 2024 19:29:14 +0900 Subject: [PATCH 2/2] chore: revert `for(;;)` patterns --- packages/adblocker-playwright/src/index.ts | 5 +++-- packages/adblocker-puppeteer/src/index.ts | 5 +++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/packages/adblocker-playwright/src/index.ts b/packages/adblocker-playwright/src/index.ts index c8232c29df..53c415299f 100644 --- a/packages/adblocker-playwright/src/index.ts +++ b/packages/adblocker-playwright/src/index.ts @@ -242,7 +242,7 @@ export class PlaywrightBlocker extends FiltersEngine { // `enableMutationObserver` is disabled in config, which means that we // should not actively monitor the DOM for changes. let numberOfIterations = 0; - for (;;) { + do { if (frame.isDetached()) { break; } @@ -269,7 +269,8 @@ export class PlaywrightBlocker extends FiltersEngine { } await sleep(500); - } + // eslint-disable-next-line no-constant-condition + } while (true); }; public onRequest = async (route: pw.Route): Promise<void> => { diff --git a/packages/adblocker-puppeteer/src/index.ts b/packages/adblocker-puppeteer/src/index.ts index 1dfe6aab52..f6d1679fbf 100644 --- a/packages/adblocker-puppeteer/src/index.ts +++ b/packages/adblocker-puppeteer/src/index.ts @@ -252,7 +252,7 @@ export class PuppeteerBlocker extends FiltersEngine { // `enableMutationObserver` is disabled in config, which means that we // should not actively monitor the DOM for changes. let numberOfIterations = 0; - for (;;) { + do { if (frame.isDetached()) { break; } @@ -279,7 +279,8 @@ export class PuppeteerBlocker extends FiltersEngine { } await sleep(500); - } + // eslint-disable-next-line no-constant-condition + } while (true); }; public setRequestInterceptionPriority = (defaultPriority = 0) =>