Upgrade eslint-plugin-matrix-org to 1.2.1
This upgrade came with a number of new lints that needed to be fixed across the code base. Primarily: explicit return types on functions, and explicit visibility modifiers on class members.
This commit is contained in:
@@ -89,7 +89,7 @@ class ConsoleLogger extends EventEmitter {
|
||||
this.originalFunctions[name] = originalFn;
|
||||
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
||||
// @ts-ignore
|
||||
consoleObj[name] = (...args) => {
|
||||
consoleObj[name] = (...args): void => {
|
||||
this.log(level, ...args);
|
||||
originalFn(...args);
|
||||
};
|
||||
@@ -158,7 +158,7 @@ class IndexedDBLogStore {
|
||||
private flushAgainPromise?: Promise<void>;
|
||||
private id: string;
|
||||
|
||||
constructor(
|
||||
public constructor(
|
||||
private indexedDB: IDBFactory,
|
||||
private loggerInstance: ConsoleLogger
|
||||
) {
|
||||
@@ -174,20 +174,20 @@ class IndexedDBLogStore {
|
||||
public connect(): Promise<void> {
|
||||
const req = this.indexedDB.open("logs");
|
||||
return new Promise((resolve, reject) => {
|
||||
req.onsuccess = () => {
|
||||
req.onsuccess = (): void => {
|
||||
this.db = req.result;
|
||||
|
||||
resolve();
|
||||
};
|
||||
|
||||
req.onerror = () => {
|
||||
req.onerror = (): void => {
|
||||
const err = "Failed to open log database: " + req?.error?.name;
|
||||
logger.error(err);
|
||||
reject(new Error(err));
|
||||
};
|
||||
|
||||
// First time: Setup the object store
|
||||
req.onupgradeneeded = () => {
|
||||
req.onupgradeneeded = (): void => {
|
||||
const db = req.result;
|
||||
// This is the log entries themselves. Each entry is a chunk of
|
||||
// logs (ie multiple lines). 'id' is the instance ID (so logs with
|
||||
@@ -218,7 +218,7 @@ class IndexedDBLogStore {
|
||||
});
|
||||
}
|
||||
|
||||
private onLoggerLog = () => {
|
||||
private onLoggerLog = (): void => {
|
||||
if (!this.db) return;
|
||||
|
||||
this.throttledFlush();
|
||||
@@ -289,10 +289,10 @@ class IndexedDBLogStore {
|
||||
}
|
||||
const txn = this.db.transaction(["logs", "logslastmod"], "readwrite");
|
||||
const objStore = txn.objectStore("logs");
|
||||
txn.oncomplete = () => {
|
||||
txn.oncomplete = (): void => {
|
||||
resolve();
|
||||
};
|
||||
txn.onerror = (event) => {
|
||||
txn.onerror = (event): void => {
|
||||
logger.error("Failed to flush logs : ", event);
|
||||
reject(new Error("Failed to write logs: " + txn?.error?.message));
|
||||
};
|
||||
@@ -333,10 +333,10 @@ class IndexedDBLogStore {
|
||||
.index("id")
|
||||
.openCursor(IDBKeyRange.only(id), "prev");
|
||||
let lines = "";
|
||||
query.onerror = () => {
|
||||
query.onerror = (): void => {
|
||||
reject(new Error("Query failed: " + query?.error?.message));
|
||||
};
|
||||
query.onsuccess = () => {
|
||||
query.onsuccess = (): void => {
|
||||
const cursor = query.result;
|
||||
if (!cursor) {
|
||||
resolve(lines);
|
||||
@@ -379,7 +379,7 @@ class IndexedDBLogStore {
|
||||
const o = txn.objectStore("logs");
|
||||
// only load the key path, not the data which may be huge
|
||||
const query = o.index("id").openKeyCursor(IDBKeyRange.only(id));
|
||||
query.onsuccess = () => {
|
||||
query.onsuccess = (): void => {
|
||||
const cursor = query.result;
|
||||
if (!cursor) {
|
||||
return;
|
||||
@@ -387,10 +387,10 @@ class IndexedDBLogStore {
|
||||
o.delete(cursor.primaryKey);
|
||||
cursor.continue();
|
||||
};
|
||||
txn.oncomplete = () => {
|
||||
txn.oncomplete = (): void => {
|
||||
resolve();
|
||||
};
|
||||
txn.onerror = () => {
|
||||
txn.onerror = (): void => {
|
||||
reject(
|
||||
new Error(
|
||||
"Failed to delete logs for " + `'${id}' : ${txn?.error?.message}`
|
||||
@@ -477,11 +477,11 @@ function selectQuery<T>(
|
||||
const query = store.openCursor(keyRange);
|
||||
return new Promise((resolve, reject) => {
|
||||
const results: T[] = [];
|
||||
query.onerror = () => {
|
||||
query.onerror = (): void => {
|
||||
reject(new Error("Query failed: " + query?.error?.message));
|
||||
};
|
||||
// collect results
|
||||
query.onsuccess = () => {
|
||||
query.onsuccess = (): void => {
|
||||
const cursor = query.result;
|
||||
if (!cursor) {
|
||||
resolve(results);
|
||||
|
||||
Reference in New Issue
Block a user