Ver código fonte

fix eslint integration

Gildas 11 meses atrás
pai
commit
65d7fea37c
39 arquivos alterados com 1021 adições e 74 exclusões
  1. 0 43
      .eslintrc.js
  2. 31 0
      eslint.config.mjs
  3. 0 0
      lib/single-file-extension-background.js
  4. 9 2
      lib/single-file-extension-editor.js
  5. 898 2
      package-lock.json
  6. 3 2
      package.json
  7. 0 2
      rollup.config.dev.js
  8. 0 2
      rollup.config.js
  9. 1 0
      src/core/bg/autosave-util.js
  10. 1 0
      src/core/bg/autosave.js
  11. 2 0
      src/core/bg/bookmarks.js
  12. 3 0
      src/core/bg/business.js
  13. 2 1
      src/core/bg/config.js
  14. 1 0
      src/core/bg/downloads.js
  15. 2 0
      src/core/bg/requests.js
  16. 1 0
      src/core/bg/tabs.js
  17. 1 0
      src/core/common/download.js
  18. 1 1
      src/core/content/content-bootstrap.js
  19. 1 1
      src/core/content/content.js
  20. 0 2
      src/index.js
  21. 2 0
      src/lib/gdrive/gdrive.js
  22. 7 1
      src/lib/single-file/browser-polyfill/chrome-browser-polyfill.js
  23. 2 0
      src/lib/single-file/core/bg/scripts.js
  24. 0 2
      src/lib/single-file/core/content/content-hooks-frames-extension-injection.js
  25. 1 1
      src/lib/single-file/core/content/content-hooks-frames-inline-injection.js
  26. 1 0
      src/lib/single-file/fetch/content/content-fetch.js
  27. 1 0
      src/lib/single-file/lazy/bg/lazy-timeout.js
  28. 0 2
      src/lib/web-stream/index.js
  29. 1 0
      src/ui/bg/index.js
  30. 1 0
      src/ui/bg/ui-button.js
  31. 2 1
      src/ui/bg/ui-editor.js
  32. 3 0
      src/ui/bg/ui-menus.js
  33. 3 1
      src/ui/bg/ui-options-editor.js
  34. 25 4
      src/ui/bg/ui-options.js
  35. 1 1
      src/ui/bg/ui-viewer.js
  36. 2 1
      src/ui/common/common-content-ui.js
  37. 1 0
      src/ui/content/content-ui-editor-init-web.js
  38. 4 1
      src/ui/content/content-ui-editor-web.js
  39. 7 1
      src/ui/content/content-ui.js

+ 0 - 43
.eslintrc.js

@@ -1,43 +0,0 @@
-/* global module */
-
-module.exports = {
-	"env": {
-		"es6": true,
-		"node": false,
-		"browser": false
-	},
-	"globals": {
-		"console": true
-	},
-	"extends": "eslint:recommended",
-	"parserOptions": {
-		"ecmaVersion": 2018,
-		"sourceType": "module"
-	},
-	"ignorePatterns": [
-		"/lib/"
-	],
-	"rules": {
-		"indent": [
-			"error",
-			"tab", {
-				"SwitchCase": 1
-			}
-		],
-		"linebreak-style": [
-			"error",
-			"unix"
-		],
-		"quotes": [
-			"error",
-			"double"
-		],
-		"semi": [
-			"error",
-			"always"
-		],
-		"no-console": [
-			"warn"
-		]
-	}
-};

+ 31 - 0
eslint.config.mjs

@@ -0,0 +1,31 @@
+import js from "@eslint/js";
+
+export default [
+	js.configs.recommended,
+	{
+		languageOptions: {
+			ecmaVersion: 2025,
+			sourceType: "module",
+			globals: {
+				console: "readonly",
+			}
+		},
+		rules: {
+			"linebreak-style": [
+				"error",
+				"unix"
+			],
+			"quotes": [
+				"error",
+				"double"
+			],
+			"semi": [
+				"error",
+				"always"
+			],
+			"no-console": [
+				"warn"
+			]
+		}
+	}
+];

Diferenças do arquivo suprimidas por serem muito extensas
+ 0 - 0
lib/single-file-extension-background.js


+ 9 - 2
lib/single-file-extension-editor.js

@@ -24,7 +24,7 @@
 	 *   Source.
 	 */
 
-	/* global document, globalThis, getComputedStyle, FileReader, Image, OffscreenCanvas, createImageBitmap */
+	/* global document, getComputedStyle, FileReader, Image, OffscreenCanvas, createImageBitmap */
 
 	const singlefile$1 = globalThis.singlefile;
 
@@ -173,6 +173,7 @@
 				};
 				document.documentElement.appendChild(barElement);
 			}
+			// eslint-disable-next-line no-unused-vars
 		} catch (error) {
 			// iignored
 		}
@@ -837,7 +838,7 @@
 	 *   Source.
 	 */
 
-	/* global browser, document, globalThis, prompt, getComputedStyle, addEventListener, removeEventListener, requestAnimationFrame, setTimeout, getSelection, Node */
+	/* global browser, document, prompt, getComputedStyle, addEventListener, removeEventListener, requestAnimationFrame, setTimeout, getSelection, Node */
 
 	const singlefile = globalThis.singlefile;
 
@@ -856,6 +857,7 @@
 		LOG_PANEL_FRAME_CONTENTS_MESSAGE = browser.i18n.getMessage("logPanelFrameContents");
 		LOG_PANEL_EMBEDDED_IMAGE_MESSAGE = browser.i18n.getMessage("logPanelEmbeddedImage");
 		LOG_PANEL_STEP_MESSAGE = browser.i18n.getMessage("logPanelStep");
+		// eslint-disable-next-line no-unused-vars
 	} catch (error) {
 		// ignored
 	}
@@ -921,6 +923,7 @@
 				logsContentElement.classList.add(LOGS_CLASSNAME);
 				shadowRoot.appendChild(logsContentElement);
 			}
+			// eslint-disable-next-line no-unused-vars
 		} catch (error) {
 			// ignored
 		}
@@ -964,6 +967,7 @@
 		SHARE_PAGE_BUTTON_MESSAGE = browser.i18n.getMessage("topPanelSharePageButton");
 		SHARE_SELECTION_BUTTON_MESSAGE = browser.i18n.getMessage("topPanelShareSelectionButton");
 		ERROR_TITLE_MESSAGE = browser.i18n.getMessage("topPanelError");
+		// eslint-disable-next-line no-unused-vars
 	} catch (error) {
 		// ignored
 	}
@@ -2214,6 +2218,7 @@ pre code {
 				try {
 					const worker = new Worker(zipOptions.workerScripts.inflate[0]);
 					worker.terminate();
+					// eslint-disable-next-line no-unused-vars
 				} catch (error) {
 					delete zipOptions.workerScripts;
 				}
@@ -3284,6 +3289,7 @@ pre code {
 							const contentDocument = (new DOMParser()).parseFromString(element.innerHTML, "text/html");
 							Array.from(contentDocument.head.childNodes).forEach(node => shadowRoot.appendChild(node));
 							Array.from(contentDocument.body.childNodes).forEach(node => shadowRoot.appendChild(node));
+							// eslint-disable-next-line no-unused-vars
 						} catch (error) {
 							// ignored
 						}
@@ -3428,6 +3434,7 @@ pre code {
 			} else if (chrome && chrome.dom && chrome.dom.openOrClosedShadowRoot) {
 				try {
 					return chrome.dom.openOrClosedShadowRoot(element);
+					// eslint-disable-next-line no-unused-vars
 				} catch (error) {
 					return element.shadowRoot;
 				}

Diferenças do arquivo suprimidas por serem muito extensas
+ 898 - 2
package-lock.json


+ 3 - 2
package.json

@@ -10,12 +10,13 @@
 	},
 	"type": "module",
 	"dependencies": {
+		"eslint": "^9.20.1",
 		"single-file-core": "1.5.45"
 	},
 	"devDependencies": {
-		"rollup": "4.22.4",
 		"@rollup/plugin-node-resolve": "15.2.3",
-		"@rollup/plugin-terser": "0.4.4"
+		"@rollup/plugin-terser": "0.4.4",
+		"rollup": "4.22.4"
 	},
 	"overrides": {
 		"terser": "^5.15.0"

+ 0 - 2
rollup.config.dev.js

@@ -1,5 +1,3 @@
-/* global require */
-
 import resolve from "@rollup/plugin-node-resolve";
 import terser from "@rollup/plugin-terser";
 

+ 0 - 2
rollup.config.js

@@ -1,5 +1,3 @@
-/* global require */
-
 import resolve from "@rollup/plugin-node-resolve";
 import terser from "@rollup/plugin-terser";
 

+ 1 - 0
src/core/bg/autosave-util.js

@@ -47,6 +47,7 @@ async function refreshAutoSaveTabs() {
 		const [options, autoSaveEnabled] = await Promise.all([config.getOptions(tab.url, true), autoSaveIsEnabled(tab)]);
 		try {
 			await browser.tabs.sendMessage(tab.id, { method: "content.init", autoSaveEnabled, options });
+			// eslint-disable-next-line no-unused-vars
 		} catch (error) {
 			// ignored
 		}

+ 1 - 0
src/core/bg/autosave.js

@@ -242,6 +242,7 @@ async function saveContent(message, tab) {
 						try {
 							await browser.tabs.get(tabId);
 							createTabProperties.index = index + 1;
+							// eslint-disable-next-line no-unused-vars
 						} catch (error) {
 							createTabProperties.index = index;
 						}

+ 2 - 0
src/core/bg/bookmarks.js

@@ -52,6 +52,7 @@ async function enable() {
 	try {
 		browser.bookmarks.onCreated.removeListener(onCreated);
 		browser.bookmarks.onMoved.removeListener(onMoved);
+		// eslint-disable-next-line no-unused-vars
 	} catch (error) {
 		// ignored
 	}
@@ -81,6 +82,7 @@ async function disable() {
 async function update(id, changes) {
 	try {
 		await browser.bookmarks.update(id, changes);
+		// eslint-disable-next-line no-unused-vars
 	} catch (error) {
 		// ignored
 	}

+ 3 - 0
src/core/bg/business.js

@@ -68,6 +68,7 @@ async function saveSelectedLinks(tab) {
 	let scriptsInjected;
 	try {
 		scriptsInjected = await injectScript(tab.id, tabOptions);
+		// eslint-disable-next-line no-unused-vars
 	} catch (error) {
 		// ignored
 	}
@@ -149,6 +150,7 @@ async function saveTabs(tabs, options = {}) {
 				let scriptsInjected;
 				try {
 					scriptsInjected = await injectScript(tabId, tabOptions);
+					// eslint-disable-next-line no-unused-vars
 				} catch (error) {
 					// ignored
 				}
@@ -227,6 +229,7 @@ async function runTask(taskInfo) {
 			ui.onStart(taskInfo.tab.id, INJECT_SCRIPTS_STEP);
 			try {
 				scriptsInjected = await injectScript(taskInfo.tab.id, taskInfo.options);
+				// eslint-disable-next-line no-unused-vars
 			} catch (error) {
 				// ignored
 			}

+ 2 - 1
src/core/bg/config.js

@@ -318,7 +318,8 @@ function updateFilenameTemplate(template) {
 			template = template.replaceAll(`{${variable}}`, `%if-empty<{${variable}}|${value}>`);
 		});
 		return template;
-	} catch (_error) {
+		// eslint-disable-next-line no-unused-vars
+	} catch (error) {
 		// ignored
 	}
 }

+ 1 - 0
src/core/bg/downloads.js

@@ -132,6 +132,7 @@ async function downloadTabPage(message, tab) {
 				message.content = await (await fetch(message.blobURL)).text();
 				await downloadContent([message.content], tab, tab.incognito, message);
 			}
+			// eslint-disable-next-line no-unused-vars
 		} catch (error) {
 			return { error: true };
 		}

+ 2 - 0
src/core/bg/requests.js

@@ -68,6 +68,7 @@ function enableReferrerOnError() {
 	if (!referrerOnErrorEnabled) {
 		try {
 			browser.webRequest.onBeforeSendHeaders.addListener(injectRefererHeader, { urls: ["<all_urls>"] }, ["blocking", "requestHeaders", "extraHeaders"]);
+			// eslint-disable-next-line no-unused-vars
 		} catch (error) {
 			browser.webRequest.onBeforeSendHeaders.addListener(injectRefererHeader, { urls: ["<all_urls>"] }, ["blocking", "requestHeaders"]);
 		}
@@ -78,6 +79,7 @@ function enableReferrerOnError() {
 function disableReferrerOnError() {
 	try {
 		browser.webRequest.onBeforeSendHeaders.removeListener(injectRefererHeader);
+		// eslint-disable-next-line no-unused-vars
 	} catch (error) {
 		// ignored
 	}

+ 1 - 0
src/core/bg/tabs.js

@@ -72,6 +72,7 @@ async function onTabUpdated(tabId, changeInfo) {
 			try {
 				await browser.tabs.sendMessage(tabId, { method: "content.maybeInit" });
 			}
+			// eslint-disable-next-line no-unused-vars
 			catch (error) {
 				// ignored
 			}

+ 1 - 0
src/core/common/download.js

@@ -36,6 +36,7 @@ try {
 	SHARE_PAGE_BUTTON_MESSAGE = browser.i18n.getMessage("topPanelSharePageButton");
 	SHARE_SELECTION_BUTTON_MESSAGE = browser.i18n.getMessage("topPanelShareSelectionButton");
 	ERROR_TITLE_MESSAGE = browser.i18n.getMessage("topPanelError");
+	// eslint-disable-next-line no-unused-vars
 } catch (error) {
 	// ignored
 }

+ 1 - 1
src/core/content/content-bootstrap.js

@@ -21,7 +21,7 @@
  *   Source.
  */
 
-/* global browser, globalThis, document, location, setTimeout, XMLHttpRequest, Node, DOMParser, Blob, URL, Image, OffscreenCanvas */
+/* global browser, document, location, setTimeout, XMLHttpRequest, Node, DOMParser, Blob, URL, Image, OffscreenCanvas, CustomEvent */
 
 const MAX_CONTENT_SIZE = 32 * (1024 * 1024);
 

+ 1 - 1
src/core/content/content.js

@@ -21,7 +21,7 @@
  *   Source.
  */
 
-/* global browser, document, globalThis, location, setTimeout, URL, setInterval, clearInterval */
+/* global browser, document, location, setTimeout, URL, setInterval, clearInterval */
 
 import * as download from "./../common/download.js";
 import { fetch, frameFetch } from "./../../lib/single-file/fetch/content/content-fetch.js";

+ 0 - 2
src/index.js

@@ -21,8 +21,6 @@
  *   Source.
  */
 
-/* global globalThis */
-
 import * as scripts from "./lib/single-file/core/bg/scripts.js";
 import { fetch, frameFetch } from "./lib/single-file/fetch/content/content-fetch.js";
 

+ 2 - 0
src/lib/gdrive/gdrive.js

@@ -97,6 +97,7 @@ class GDrive {
 				}
 				this.accessToken = await browser.identity.getAuthToken({ interactive: false });
 				return { revokableAccessToken: this.accessToken };
+				// eslint-disable-next-line no-unused-vars
 			} catch (error) {
 				delete this.accessToken;
 			}
@@ -107,6 +108,7 @@ class GDrive {
 			if (browser.identity && browser.identity.removeCachedAuthToken) {
 				try {
 					await browser.identity.removeCachedAuthToken({ token: accessToken });
+					// eslint-disable-next-line no-unused-vars
 				} catch (error) {
 					// ignored
 				}

+ 7 - 1
src/lib/single-file/browser-polyfill/chrome-browser-polyfill.js

@@ -21,7 +21,7 @@
  *   Source.
  */
 
-/* global globalThis, window */
+/* global window */
 
 if (typeof globalThis == "undefined") {
 	window.globalThis = window;
@@ -49,6 +49,7 @@ if (typeof globalThis == "undefined") {
 									resolve();
 								}
 							});
+							// eslint-disable-next-line no-unused-vars
 						} catch (error) {
 							FEATURE_TESTS["browserAction.setBadgeText"] = { callbackNotSupported: true };
 						}
@@ -72,6 +73,7 @@ if (typeof globalThis == "undefined") {
 									resolve();
 								}
 							});
+							// eslint-disable-next-line no-unused-vars
 						} catch (error) {
 							FEATURE_TESTS["browserAction.setBadgeBackgroundColor"] = { callbackNotSupported: true };
 						}
@@ -95,6 +97,7 @@ if (typeof globalThis == "undefined") {
 									resolve();
 								}
 							});
+							// eslint-disable-next-line no-unused-vars
 						} catch (error) {
 							FEATURE_TESTS["browserAction.setTitle"] = { callbackNotSupported: true };
 						}
@@ -118,6 +121,7 @@ if (typeof globalThis == "undefined") {
 									resolve();
 								}
 							});
+							// eslint-disable-next-line no-unused-vars
 						} catch (error) {
 							FEATURE_TESTS["browserAction.setIcon"] = { callbackNotSupported: true };
 						}
@@ -307,6 +311,7 @@ if (typeof globalThis == "undefined") {
 									if (response !== undefined) {
 										try {
 											sendResponse(response);
+											// eslint-disable-next-line no-unused-vars
 										} catch (error) {
 											// ignored
 										}
@@ -326,6 +331,7 @@ if (typeof globalThis == "undefined") {
 									if (response !== undefined) {
 										try {
 											sendResponse(response);
+											// eslint-disable-next-line no-unused-vars
 										} catch (error) {
 											// ignored
 										}

+ 2 - 0
src/lib/single-file/core/bg/scripts.js

@@ -48,6 +48,7 @@ async function inject(tabId, options) {
 	if (!options.removeFrames) {
 		try {
 			await browser.tabs.executeScript(tabId, { code: frameScript, allFrames: true, matchAboutBlank: true, runAt: "document_start" });
+			// eslint-disable-next-line no-unused-vars
 		} catch (error) {
 			// ignored
 		}
@@ -55,6 +56,7 @@ async function inject(tabId, options) {
 	try {
 		await browser.tabs.executeScript(tabId, { code: contentScript, allFrames: false, runAt: "document_idle" });
 		scriptsInjected = true;
+		// eslint-disable-next-line no-unused-vars
 	} catch (error) {
 		// ignored
 	}

+ 0 - 2
src/lib/single-file/core/content/content-hooks-frames-extension-injection.js

@@ -21,8 +21,6 @@
  *   Source.
  */
 
-/* global globalThis */
-
 const browser = globalThis.browser;
 const document = globalThis.document;
 const Document = globalThis.Document;

+ 1 - 1
src/lib/single-file/core/content/content-hooks-frames-inline-injection.js

@@ -21,7 +21,7 @@
  *   Source.
  */
 
-/* global globalThis, window */
+/* global window */
 
 const document = globalThis.document;
 const Document = globalThis.Document;

+ 1 - 0
src/lib/single-file/fetch/content/content-fetch.js

@@ -159,6 +159,7 @@ async function fetchResource(url, options = {}, useHostFetch = true) {
 			}
 		}
 		return response;
+		// eslint-disable-next-line no-unused-vars
 	} catch (error) {
 		requestId++;
 		const promise = new Promise((resolve, reject) => pendingResponses.set(requestId, { resolve, reject }));

+ 1 - 0
src/lib/single-file/lazy/bg/lazy-timeout.js

@@ -48,6 +48,7 @@ browser.runtime.onMessage.addListener((message, sender) => {
 					deleteTimeout(frameTimeouts, message.type);
 				}
 				await browser.tabs.sendMessage(sender.tab.id, { method: "singlefile.lazyTimeout.onTimeout", type: message.type });
+				// eslint-disable-next-line no-unused-vars
 			} catch (error) {
 				// ignored
 			}

+ 0 - 2
src/lib/web-stream/index.js

@@ -21,8 +21,6 @@
  *   Source.
  */
 
-/* global globalThis */
-
 if (typeof globalThis.TransformStream === "undefined") {
 	globalThis.TransformStream = class TransformStream { };
 }

+ 1 - 0
src/ui/bg/index.js

@@ -75,6 +75,7 @@ async function onError(tabId, message, link) {
 		if (message) {
 			await browser.tabs.sendMessage(tabId, { method: "content.error", error: message.toString(), link });
 		}
+		// eslint-disable-next-line no-unused-vars
 	} catch (error) {
 		// ignored
 	}

+ 1 - 0
src/ui/bg/ui-button.js

@@ -247,6 +247,7 @@ async function refresh(tabId, state) {
 				await refreshAsync(tabId, newState);
 			}
 		}
+		// eslint-disable-next-line no-unused-vars
 	} catch (error) {
 		// ignored
 	}

+ 2 - 1
src/ui/bg/ui-editor.js

@@ -21,7 +21,7 @@
  *   Source.
  */
 
-/* global browser, document, matchMedia, addEventListener, navigator, prompt, URL, MouseEvent, Blob, setInterval, DOMParser */
+/* global browser, document, matchMedia, addEventListener, navigator, prompt, URL, MouseEvent, Blob, setInterval, DOMParser, fetch */
 
 import * as download from "../../core/common/download.js";
 import { onError } from "./../common/common-content-ui.js";
@@ -699,6 +699,7 @@ function deserializeShadowRoots(node) {
 				const contentDocument = (new DOMParser()).parseFromString(element.innerHTML, "text/html");
 				Array.from(contentDocument.head.childNodes).forEach(node => shadowRoot.appendChild(node));
 				Array.from(contentDocument.body.childNodes).forEach(node => shadowRoot.appendChild(node));
+				// eslint-disable-next-line no-unused-vars
 			} catch (error) {
 				// ignored
 			}

+ 3 - 0
src/ui/bg/ui-menus.js

@@ -136,6 +136,7 @@ async function createMenus(tab) {
 					title: "title"
 				});
 				defaultContextsDisabled.push("tab");
+				// eslint-disable-next-line no-unused-vars
 			} catch (error) {
 				options.tabMenuEnabled = false;
 			}
@@ -534,6 +535,7 @@ async function refreshExternalComponents(tab) {
 	await button.refreshTab(tab);
 	try {
 		await browser.runtime.sendMessage({ method: "options.refresh", profileName: allTabsData.profileName });
+		// eslint-disable-next-line no-unused-vars
 	} catch (error) {
 		// ignored
 	}
@@ -595,6 +597,7 @@ async function updateAllVisibleValues(visible) {
 		try {
 			MENU_TOP_VISIBLE_ENTRIES.forEach(id => promises.push(menus.update(id, { visible })));
 			await Promise.all(promises);
+			// eslint-disable-next-line no-unused-vars
 		} catch (error) {
 			// ignored
 		}

+ 3 - 1
src/ui/bg/ui-options-editor.js

@@ -21,7 +21,7 @@
  *   Source.
  */
 
-/* global browser, window, document, localStorage, FileReader, location, fetch, TextDecoder, DOMParser, HTMLElement, MouseEvent */
+/* global browser, document, alert */
 
 const titleLabel = document.getElementById("titleLabel");
 
@@ -38,6 +38,7 @@ saveButton.addEventListener("click", async () => {
     let config;
     try {
         config = JSON.parse(optionsInput.value);
+        // eslint-disable-next-line no-unused-vars
     } catch (error) {
         alert(invalidJSONMessage);
     }
@@ -61,6 +62,7 @@ async function refreshExternalComponents(config) {
             await browser.runtime.sendMessage({ method: "options.refresh", profileName });
             await browser.runtime.sendMessage({ method: "options.refreshPanel", profileName });
         }
+        // eslint-disable-next-line no-unused-vars
     } catch (error) {
         // ignored
     }

+ 25 - 4
src/ui/bg/ui-options.js

@@ -21,7 +21,7 @@
  *   Source.
  */
 
-/* global browser, window, document, localStorage, FileReader, location, fetch, TextDecoder, DOMParser, HTMLElement, MouseEvent */
+/* global browser, window, document, localStorage, FileReader, location, fetch, TextDecoder, DOMParser, HTMLElement, MouseEvent, btoa */
 
 const HELP_ICON_URL = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAAUCAYAAACNiR0NAAABIUlEQVQ4y+2TsarCMBSGvxTBRdqiUZAWOrhJB9EXcPKFfCvfQYfulUKHDqXg4CYUJSioYO4mSDX3ttzt3n87fMlHTpIjlsulxpDZbEYYhgghSNOUOI5Ny2mZYBAELBYLer0eAJ7ncTweKYri4x7LJJRS0u12n7XrukgpjSc0CpVSXK/XZ32/31FKNW85z3PW6zXT6RSAJEnIsqy5UGvNZrNhu90CcDqd+C6tT6J+v//2Th+PB2VZ1hN2Oh3G4zGTyQTbtl/YbrdjtVpxu91+Ljyfz0RRhG3bzOfzF+Y4TvNXvlwuaK2pE4tfzr/wzwsty0IIURlL0998KxRCMBqN8H2/wlzXJQxD2u12vVkeDoeUZUkURRU+GAw4HA7s9/sK+wK6CWHasQ/S/wAAAABJRU5ErkJggg==";
 const HELP_PAGE_PATH_PREFIX = "/src/ui/pages/help";
@@ -107,6 +107,7 @@ const insertEmbeddedImageLabel = document.getElementById("insertEmbeddedImageLab
 const insertEmbeddedCustomImageLabel = document.getElementById("insertEmbeddedCustomImageLabel");
 const insertEmbeddedScreenshotImageLabel = document.getElementById("insertEmbeddedScreenshotImageLabel");
 const compressCSSLabel = document.getElementById("compressCSSLabel");
+const groupDuplicateStylesheetsLabel = document.getElementById("groupDuplicateStylesheetsLabel");
 const moveStylesInHeadLabel = document.getElementById("moveStylesInHeadLabel");
 const loadDeferredImagesLabel = document.getElementById("loadDeferredImagesLabel");
 const loadDeferredImagesMaxIdleTimeLabel = document.getElementById("loadDeferredImagesMaxIdleTimeLabel");
@@ -393,6 +394,7 @@ createURLElement.onsubmit = async event => {
 	event.preventDefault();
 	try {
 		await browser.runtime.sendMessage({ method: "config.addRule", url: ruleUrlInput.value, profileName: ruleProfileInput.value, autoSaveProfileName: ruleAutoSaveProfileInput.value });
+		// eslint-disable-next-line no-unused-vars
 	} catch (error) {
 		// ignored
 	}
@@ -453,6 +455,7 @@ addProfileButton.addEventListener("click", async event => {
 	if (profileName) {
 		try {
 			await browser.runtime.sendMessage({ method: "config.createProfile", profileName, fromProfileName: profileNamesInput.value });
+			// eslint-disable-next-line no-unused-vars
 		} catch (error) {
 			// ignored
 		}
@@ -468,6 +471,7 @@ deleteProfileButton.addEventListener("click", async event => {
 	if (await confirm(browser.i18n.getMessage("profileDeleteConfirm"), event.clientY + 50)) {
 		try {
 			await browser.runtime.sendMessage({ method: "config.deleteProfile", profileName: profileNamesInput.value });
+			// eslint-disable-next-line no-unused-vars
 		} catch (error) {
 			// ignored
 		}
@@ -481,6 +485,7 @@ renameProfileButton.addEventListener("click", async event => {
 	if (profileName) {
 		try {
 			await browser.runtime.sendMessage({ method: "config.renameProfile", profileName: profileNamesInput.value, newProfileName: profileName });
+			// eslint-disable-next-line no-unused-vars
 		} catch (error) {
 			// ignored
 		}
@@ -1132,6 +1137,7 @@ function getProfileText(profileName) {
 async function update() {
 	try {
 		await pendingSave;
+		// eslint-disable-next-line no-unused-vars
 	} catch (error) {
 		// ignored
 	}
@@ -1258,6 +1264,7 @@ async function update() {
 	});
 	try {
 		await pendingSave;
+		// eslint-disable-next-line no-unused-vars
 	} catch (error) {
 		// ignored
 	}
@@ -1271,6 +1278,7 @@ async function refreshExternalComponents() {
 		} else {
 			await browser.runtime.sendMessage({ method: "options.refreshPanel", profileName: profileNamesInput.value });
 		}
+		// eslint-disable-next-line no-unused-vars
 	} catch (error) {
 		// ignored
 	}
@@ -1289,6 +1297,7 @@ async function saveCreatedBookmarks() {
 			} else {
 				await disableOption();
 			}
+			// eslint-disable-next-line no-unused-vars
 		} catch (error) {
 			saveCreatedBookmarksInput.checked = false;
 			await disableOption();
@@ -1296,6 +1305,7 @@ async function saveCreatedBookmarks() {
 	} else {
 		try {
 			await browser.permissions.remove({ permissions: ["bookmarks"] });
+			// eslint-disable-next-line no-unused-vars
 		} catch (error) {
 			// ignored
 		}
@@ -1318,6 +1328,7 @@ async function onClickSaveToClipboard() {
 				saveToClipboardInput.checked = true;
 				await browser.runtime.sendMessage({ method: "downloads.disableGDrive" });
 			}
+			// eslint-disable-next-line no-unused-vars
 		} catch (error) {
 			saveToClipboardInput.checked = false;
 		}
@@ -1338,6 +1349,7 @@ async function onClickSaveToGDrive() {
 			} else {
 				saveToGDriveInput.checked = true;
 			}
+			// eslint-disable-next-line no-unused-vars
 		} catch (error) {
 			saveToGDriveInput.checked = false;
 			await browser.runtime.sendMessage({ method: "downloads.disableGDrive" });
@@ -1356,6 +1368,7 @@ async function disableDestinationPermissions(permissions, disableGDrive = true,
 	}
 	try {
 		await browser.permissions.remove({ permissions });
+		// eslint-disable-next-line no-unused-vars
 	} catch (error) {
 		//ignored
 	}
@@ -1374,6 +1387,7 @@ async function passReferrerOnError() {
 			} else {
 				await disableOption();
 			}
+			// eslint-disable-next-line no-unused-vars
 		} catch (error) {
 			await disableOption();
 		}
@@ -1403,6 +1417,7 @@ async function enableExternalSave(input) {
 			} else {
 				await refreshOption();
 			}
+			// eslint-disable-next-line no-unused-vars
 		} catch (error) {
 			input.checked = true;
 			await refreshOption();
@@ -1551,18 +1566,21 @@ async function getHelpPageURL() {
 		const url = browser.runtime.getURL(HELP_PAGE_PATH_PREFIX + "_" + language + ".html");
 		await (await fetch(url)).arrayBuffer();
 		return url;
-	} catch (_error) {
+		// eslint-disable-next-line no-unused-vars
+	} catch (error) {
 		try {
 			const url = browser.runtime.getURL(HELP_PAGE_PATH_PREFIX + "_" + language.split("_")[0] + ".html");
 			await (await fetch(url)).arrayBuffer();
 			return url;
-		} catch (_error) {
+			// eslint-disable-next-line no-unused-vars
+		} catch (error) {
 			try {
 				const url = browser.runtime.getURL(HELP_PAGE_PATH_PREFIX + "_" + language.split("_")[1] + ".html");
 				await (await fetch(url)).arrayBuffer();
 				return url;
 			}
-			catch (_error) {
+			// eslint-disable-next-line no-unused-vars
+			catch (error) {
 				return browser.runtime.getURL(HELP_PAGE_PATH_DEFAULT);
 			}
 		}
@@ -1572,6 +1590,7 @@ async function getHelpPageURL() {
 function getLocalStorageItem(key) {
 	try {
 		return localStorage.getItem(key);
+		// eslint-disable-next-line no-unused-vars
 	} catch (error) {
 		// ignored
 	}
@@ -1580,6 +1599,7 @@ function getLocalStorageItem(key) {
 function setLocalStorageItem(key, value) {
 	try {
 		return localStorage.setItem(key, value);
+		// eslint-disable-next-line no-unused-vars
 	} catch (error) {
 		// ignored
 	}
@@ -1588,6 +1608,7 @@ function setLocalStorageItem(key, value) {
 function removeLocalStorageItem(key) {
 	try {
 		return localStorage.removeItem(key);
+		// eslint-disable-next-line no-unused-vars
 	} catch (error) {
 		// ignored
 	}

+ 1 - 1
src/ui/bg/ui-viewer.js

@@ -21,7 +21,7 @@
  *   Source.
  */
 
-/* global document, globalThis, location, singlefile, fetch, URLSearchParams, prompt */
+/* global document, location, singlefile, fetch, URLSearchParams, prompt */
 
 import * as zip from "../../../lib/single-file-zip.js";
 

+ 2 - 1
src/ui/common/common-content-ui.js

@@ -21,7 +21,7 @@
  *   Source.
  */
 
-/* global document, globalThis, getComputedStyle, FileReader, Image, OffscreenCanvas, createImageBitmap */
+/* global document, getComputedStyle, FileReader, Image, OffscreenCanvas, createImageBitmap */
 
 const singlefile = globalThis.singlefile;
 
@@ -257,6 +257,7 @@ function displayBar(tagName, message, { link, buttonLabel, buttonOnclick } = {})
 			};
 			document.documentElement.appendChild(barElement);
 		}
+		// eslint-disable-next-line no-unused-vars
 	} catch (error) {
 		// iignored
 	}

+ 1 - 0
src/ui/content/content-ui-editor-init-web.js

@@ -15,6 +15,7 @@
 					});
 					shadowRoot.innerHTML = element.innerHTML;
 					element.remove();
+					// eslint-disable-next-line no-unused-vars
 				} catch (error) {
 					// ignored
 				}

+ 4 - 1
src/ui/content/content-ui-editor-web.js

@@ -21,7 +21,7 @@
  *   Source.
  */
 
-/* global globalThis, window, document, fetch, DOMParser, getComputedStyle, setTimeout, clearTimeout, NodeFilter, Readability, isProbablyReaderable, matchMedia, TextDecoder, Node, URL, prompt, MutationObserver, FileReader, Worker, navigator */
+/* global window, document, fetch, DOMParser, getComputedStyle, setTimeout, clearTimeout, NodeFilter, Readability, isProbablyReaderable, matchMedia, TextDecoder, Node, URL, prompt, MutationObserver, FileReader, Worker, navigator */
 
 import { setLabels } from "./../../ui/common/common-content-ui.js";
 import { downloadPageForeground } from "../../core/common/download.js";
@@ -1194,6 +1194,7 @@ pre code {
 			try {
 				const worker = new Worker(zipOptions.workerScripts.inflate[0]);
 				worker.terminate();
+				// eslint-disable-next-line no-unused-vars
 			} catch (error) {
 				delete zipOptions.workerScripts;
 			}
@@ -2264,6 +2265,7 @@ pre code {
 						const contentDocument = (new DOMParser()).parseFromString(element.innerHTML, "text/html");
 						Array.from(contentDocument.head.childNodes).forEach(node => shadowRoot.appendChild(node));
 						Array.from(contentDocument.body.childNodes).forEach(node => shadowRoot.appendChild(node));
+						// eslint-disable-next-line no-unused-vars
 					} catch (error) {
 						// ignored
 					}
@@ -2408,6 +2410,7 @@ pre code {
 		} else if (chrome && chrome.dom && chrome.dom.openOrClosedShadowRoot) {
 			try {
 				return chrome.dom.openOrClosedShadowRoot(element);
+				// eslint-disable-next-line no-unused-vars
 			} catch (error) {
 				return element.shadowRoot;
 			}

+ 7 - 1
src/ui/content/content-ui.js

@@ -21,7 +21,7 @@
  *   Source.
  */
 
-/* global browser, document, globalThis, prompt, getComputedStyle, addEventListener, removeEventListener, requestAnimationFrame, setTimeout, getSelection, Node */
+/* global browser, document, prompt, getComputedStyle, addEventListener, removeEventListener, requestAnimationFrame, setTimeout, getSelection, Node */
 
 const singlefile = globalThis.singlefile;
 
@@ -47,6 +47,7 @@ try {
 	LOG_PANEL_FRAME_CONTENTS_MESSAGE = browser.i18n.getMessage("logPanelFrameContents");
 	LOG_PANEL_EMBEDDED_IMAGE_MESSAGE = browser.i18n.getMessage("logPanelEmbeddedImage");
 	LOG_PANEL_STEP_MESSAGE = browser.i18n.getMessage("logPanelStep");
+	// eslint-disable-next-line no-unused-vars
 } catch (error) {
 	// ignored
 }
@@ -489,6 +490,7 @@ function createMaskElement() {
 			maskElement.offsetWidth;
 		}
 		return maskElement;
+		// eslint-disable-next-line no-unused-vars
 	} catch (error) {
 		// ignored
 	}
@@ -505,6 +507,7 @@ function createProgressBarElement(maskElement) {
 			progressBarContentElement.classList.add(PROGRESSBAR_CONTENT_CLASSNAME);
 			progressBarContent.appendChild(progressBarContentElement);
 		}
+		// eslint-disable-next-line no-unused-vars
 	} catch (error) {
 		// ignored
 	}
@@ -564,6 +567,7 @@ function createLogsWindowElement() {
 			logsContentElement.classList.add(LOGS_CLASSNAME);
 			shadowRoot.appendChild(logsContentElement);
 		}
+		// eslint-disable-next-line no-unused-vars
 	} catch (error) {
 		// ignored
 	}
@@ -589,6 +593,7 @@ function updateLog(id, textContent, textStatus, options) {
 			}
 			updateLogLine(lineElement, textContent, textStatus);
 		}
+		// eslint-disable-next-line no-unused-vars
 	} catch (error) {
 		// ignored
 	}
@@ -622,6 +627,7 @@ function updateProgressBar(index, maxIndex) {
 				}
 			}
 		}
+		// eslint-disable-next-line no-unused-vars
 	} catch (error) {
 		// ignored
 	}

Alguns arquivos não foram mostrados porque muitos arquivos mudaram nesse diff