ESLint parity with the Browsertrix repo (#288)
This copies the rules from the Browsertrix repo, and uses [`suppress-eslint-errors`](https://www.npmjs.com/package/suppress-eslint-errors) to suppose the violations. I'll take a pass at cleaning this up at some point in the future, and let's do our best to address these in the future as we come across them :) This'll help ensure new code being added to this repo is held to the same standard as code in Browsertrix's frontend.
This commit is contained in:
@@ -103,6 +103,8 @@ class Embed extends LitElement {
|
||||
await this.swmanager.register();
|
||||
this.inited = true;
|
||||
} catch (e) {
|
||||
// TODO: Fix this the next time the file is edited.
|
||||
// eslint-disable-next-line @typescript-eslint/no-unsafe-argument
|
||||
this.errorMessage = this.swmanager.renderErrorReport(this.logo);
|
||||
}
|
||||
}
|
||||
@@ -123,6 +125,8 @@ class Embed extends LitElement {
|
||||
return;
|
||||
}
|
||||
|
||||
// TODO: Fix this the next time the file is edited.
|
||||
// eslint-disable-next-line @typescript-eslint/no-unsafe-argument
|
||||
const currHash = new URLSearchParams(event.data);
|
||||
const url = new URL(window.location.href);
|
||||
url.hash = "#" + currHash.toString();
|
||||
@@ -136,6 +140,8 @@ class Embed extends LitElement {
|
||||
"The noSandbox flag is deprecated. ReplayWeb.page does not add a sandbox by default. To enable sandboxing, use 'sandbox' flag instead. This may result in PDFs not loading and pages opening in new windows, but may be more secure in some situations",
|
||||
);
|
||||
}
|
||||
// TODO: Fix this the next time the file is edited.
|
||||
// eslint-disable-next-line @typescript-eslint/no-floating-promises
|
||||
this.doRegister();
|
||||
|
||||
window.addEventListener("message", (event) => this.handleMessage(event));
|
||||
@@ -156,12 +162,16 @@ class Embed extends LitElement {
|
||||
if (
|
||||
// @ts-expect-error - TS2339 - Property 'GestureEvent' does not exist on type 'Window & typeof globalThis'.
|
||||
window.GestureEvent !== undefined &&
|
||||
// TODO: Fix this the next time the file is edited.
|
||||
// eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
|
||||
window.SharedWorker === undefined
|
||||
) {
|
||||
this.noWebWorker = true;
|
||||
}
|
||||
|
||||
// if no storage manager or estimate, don't cache
|
||||
// TODO: Fix this the next time the file is edited.
|
||||
// eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
|
||||
if (!navigator.storage?.estimate) {
|
||||
this.noCache = true;
|
||||
}
|
||||
@@ -189,6 +199,8 @@ class Embed extends LitElement {
|
||||
}
|
||||
|
||||
mergeConfigs() {
|
||||
// TODO: Fix this the next time the file is edited.
|
||||
// eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
|
||||
if (!this.customConfig) {
|
||||
return this.config;
|
||||
}
|
||||
@@ -217,6 +229,8 @@ class Embed extends LitElement {
|
||||
this.source = this.src;
|
||||
}
|
||||
|
||||
// TODO: Fix this the next time the file is edited.
|
||||
// eslint-disable-next-line @typescript-eslint/no-unsafe-argument
|
||||
const source = new URL(this.source, document.baseURI);
|
||||
|
||||
const config = this.mergeConfigs();
|
||||
@@ -353,6 +367,8 @@ class Embed extends LitElement {
|
||||
this.reloadCount <= 2
|
||||
) {
|
||||
this.reloadCount++;
|
||||
// TODO: Fix this the next time the file is edited.
|
||||
// eslint-disable-next-line @typescript-eslint/no-unsafe-return
|
||||
setTimeout(() => win.location.reload(), 100);
|
||||
return;
|
||||
}
|
||||
@@ -375,6 +391,8 @@ async function main() {
|
||||
customElements.define("replay-web-page", Embed);
|
||||
}
|
||||
|
||||
// TODO: Fix this the next time the file is edited.
|
||||
// eslint-disable-next-line @typescript-eslint/no-floating-promises
|
||||
main();
|
||||
|
||||
export { Embed };
|
||||
|
||||
Reference in New Issue
Block a user