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:
Emma Segal-Grossman
2024-03-07 20:12:50 -05:00
committed by GitHub
parent 57123e8a63
commit 40d84f3383
21 changed files with 315 additions and 37 deletions
+18 -4
View File
@@ -64,6 +64,8 @@ class ItemIndex extends LitElement {
}
firstUpdated() {
// TODO: Fix this the next time the file is edited.
// eslint-disable-next-line @typescript-eslint/no-floating-promises
this.loadItems();
}
@@ -112,6 +114,8 @@ class ItemIndex extends LitElement {
this.sortedItems = [];
} catch (e) {
// likely no sw registered yet, or waiting for new sw to register, retry again
// TODO: Fix this the next time the file is edited.
// eslint-disable-next-line @typescript-eslint/promise-function-async
setTimeout(() => this.loadItems(), 500);
}
}
@@ -120,6 +124,8 @@ class ItemIndex extends LitElement {
event.preventDefault();
event.stopPropagation();
// TODO: Fix this the next time the file is edited.
// eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
if (!this.sortedItems) {
return;
}
@@ -128,6 +134,8 @@ class ItemIndex extends LitElement {
const item = this.sortedItems[index];
// TODO: Fix this the next time the file is edited.
// eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
if (!item || this._deleting[item.sourceUrl]) {
return;
}
@@ -318,7 +326,9 @@ class ItemIndex extends LitElement {
</div>
<div class="coll-list">
${this.sortedItems?.map(
${// TODO: Fix this the next time the file is edited.
// eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
this.sortedItems?.map(
(item, i) => html`
<div class="coll-block panel-block">
${this.renderItemInfo(item)}
@@ -344,9 +354,13 @@ class ItemIndex extends LitElement {
`
: html`
<div class="panel-block extra-padding">
${this.sortedItems === null
? html`<i>Loading Archives...</i>`
: this.renderEmpty()}
${
// TODO: Fix this the next time the file is edited.
// eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
this.sortedItems === null
? html`<i>Loading Archives...</i>`
: this.renderEmpty()
}
</div>
`}
</div>