Migrate to stylistic
Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
This commit is contained in:
parent
d8052e6a73
commit
6c6bf811a6
124 changed files with 239 additions and 196 deletions
|
@ -223,7 +223,7 @@ export async function fetchInitialEvent(
|
|||
try {
|
||||
const eventData = await client.fetchRoomEvent(roomId, eventId);
|
||||
initialEvent = new MatrixEvent(eventData);
|
||||
} catch (e) {
|
||||
} catch {
|
||||
logger.warn("Could not find initial event: " + eventId);
|
||||
initialEvent = null;
|
||||
}
|
||||
|
@ -235,7 +235,7 @@ export async function fetchInitialEvent(
|
|||
const rootEvent = room?.findEventById(threadId) ?? mapper(await client.fetchRoomEvent(roomId, threadId));
|
||||
try {
|
||||
room?.createThread(threadId, rootEvent, [initialEvent], true);
|
||||
} catch (e) {
|
||||
} catch {
|
||||
logger.warn("Could not find root event: " + threadId);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -105,6 +105,7 @@ export async function fixupColorFonts(): Promise<void> {
|
|||
colrFontCheckStarted = true;
|
||||
|
||||
if (await isColrFontSupported()) {
|
||||
// eslint-disable-next-line @typescript-eslint/no-require-imports
|
||||
const path = `url('${require("../../res/fonts/Twemoji_Mozilla/TwemojiMozilla-colr.woff2")}')`;
|
||||
document.fonts.add(new FontFace("Twemoji", path, {}));
|
||||
// For at least Chrome on Windows 10, we have to explictly add extra
|
||||
|
@ -113,6 +114,7 @@ export async function fixupColorFonts(): Promise<void> {
|
|||
document.fonts.add(new FontFace("Twemoji", path, { weight: "700" }));
|
||||
} else {
|
||||
// fall back to SBIX, generated via https://github.com/matrix-org/twemoji-colr/tree/matthew/sbix
|
||||
// eslint-disable-next-line @typescript-eslint/no-require-imports
|
||||
const path = `url('${require("../../res/fonts/Twemoji_Mozilla/TwemojiMozilla-sbix.woff2")}')`;
|
||||
document.fonts.add(new FontFace("Twemoji", path, {}));
|
||||
document.fonts.add(new FontFace("Twemoji", path, { weight: "600" }));
|
||||
|
|
|
@ -10,7 +10,7 @@ import { EnhancedMap } from "./maps";
|
|||
|
||||
// Inspired by https://pkg.go.dev/golang.org/x/sync/singleflight
|
||||
|
||||
const keyMap = new EnhancedMap<Object, EnhancedMap<string, unknown>>();
|
||||
const keyMap = new EnhancedMap<object, EnhancedMap<string, unknown>>();
|
||||
|
||||
/**
|
||||
* Access class to get a singleflight context. Singleflights execute a
|
||||
|
@ -47,7 +47,7 @@ export class Singleflight {
|
|||
* @param {string} key A string key relevant to that instance to namespace under.
|
||||
* @returns {SingleflightContext} Returns the context to execute the function.
|
||||
*/
|
||||
public static for(instance?: Object | null, key?: string | null): SingleflightContext {
|
||||
public static for(instance?: object | null, key?: string | null): SingleflightContext {
|
||||
if (!instance || !key) throw new Error("An instance and key must be supplied");
|
||||
return new SingleflightContext(instance, key);
|
||||
}
|
||||
|
@ -56,7 +56,7 @@ export class Singleflight {
|
|||
* Forgets all results for a given instance.
|
||||
* @param {Object} instance The instance to forget about.
|
||||
*/
|
||||
public static forgetAllFor(instance: Object): void {
|
||||
public static forgetAllFor(instance: object): void {
|
||||
keyMap.delete(instance);
|
||||
}
|
||||
|
||||
|
@ -72,7 +72,7 @@ export class Singleflight {
|
|||
|
||||
class SingleflightContext {
|
||||
public constructor(
|
||||
private instance: Object,
|
||||
private instance: object,
|
||||
private key: string,
|
||||
) {}
|
||||
|
||||
|
|
|
@ -21,7 +21,7 @@ export function getIDBFactory(): IDBFactory | undefined {
|
|||
// We check `self` first because `window` returns something which doesn't work for service workers.
|
||||
// Note: `self?.indexedDB ?? window.indexedDB` breaks in service workers for unknown reasons.
|
||||
return self?.indexedDB ? self.indexedDB : window.indexedDB;
|
||||
} catch (e) {}
|
||||
} catch {}
|
||||
}
|
||||
|
||||
let idb: IDBDatabase | null = null;
|
||||
|
|
|
@ -251,7 +251,7 @@ export default class WidgetUtils {
|
|||
// Delete existing widget with ID
|
||||
try {
|
||||
delete userWidgets[widgetId];
|
||||
} catch (e) {
|
||||
} catch {
|
||||
logger.error(`$widgetId is non-configurable`);
|
||||
}
|
||||
|
||||
|
|
|
@ -65,7 +65,7 @@ export const useOwnLiveBeacons = (liveBeaconIds: BeaconIdentifier[]): LiveBeacon
|
|||
setStoppingInProgress(true);
|
||||
try {
|
||||
await Promise.all(liveBeaconIds.map((beaconId) => OwnBeaconStore.instance.stopBeacon(beaconId)));
|
||||
} catch (error) {
|
||||
} catch {
|
||||
setStoppingInProgress(false);
|
||||
}
|
||||
};
|
||||
|
|
|
@ -25,7 +25,7 @@ const localStorage = window.localStorage;
|
|||
let indexedDB: IDBFactory;
|
||||
try {
|
||||
indexedDB = window.indexedDB;
|
||||
} catch (e) {}
|
||||
} catch {}
|
||||
|
||||
/**
|
||||
* Create a new matrix client, with the persistent stores set up appropriately
|
||||
|
|
|
@ -26,7 +26,7 @@ export const isBulkUnverifiedDeviceReminderSnoozed = (): boolean => {
|
|||
const parsedTimestamp = Number.parseInt(snoozedTimestamp || "", 10);
|
||||
|
||||
return Number.isInteger(parsedTimestamp) && parsedTimestamp + snoozePeriod > Date.now();
|
||||
} catch (error) {
|
||||
} catch {
|
||||
return false;
|
||||
}
|
||||
};
|
||||
|
|
|
@ -229,7 +229,7 @@ export default abstract class Exporter {
|
|||
const image = await fetch(media.srcHttp);
|
||||
blob = await image.blob();
|
||||
}
|
||||
} catch (err) {
|
||||
} catch {
|
||||
logger.log("Error decrypting media");
|
||||
}
|
||||
if (!blob) {
|
||||
|
|
|
@ -76,7 +76,7 @@ export async function createThumbnail(
|
|||
try {
|
||||
canvas = new window.OffscreenCanvas(targetWidth, targetHeight);
|
||||
context = canvas.getContext("2d") as OffscreenCanvasRenderingContext2D;
|
||||
} catch (e) {
|
||||
} catch {
|
||||
// Fallback support for other browsers (Safari and Firefox for now)
|
||||
canvas = document.createElement("canvas");
|
||||
canvas.width = targetWidth;
|
||||
|
|
|
@ -377,7 +377,7 @@ export function tryTransformPermalinkToLocalHref(permalink: string): string {
|
|||
if (m) {
|
||||
return m[1];
|
||||
}
|
||||
} catch (e) {
|
||||
} catch {
|
||||
// Not a valid URI
|
||||
return permalink;
|
||||
}
|
||||
|
@ -396,7 +396,7 @@ export function tryTransformPermalinkToLocalHref(permalink: string): string {
|
|||
permalink = `#/user/${permalinkParts.userId}`;
|
||||
} // else not a valid permalink for our purposes - do not handle
|
||||
}
|
||||
} catch (e) {
|
||||
} catch {
|
||||
// Not an href we need to care about
|
||||
}
|
||||
|
||||
|
@ -421,7 +421,7 @@ export function getPrimaryPermalinkEntity(permalink: string): string | null {
|
|||
if (!permalinkParts) return null; // not processable
|
||||
if (permalinkParts.userId) return permalinkParts.userId;
|
||||
if (permalinkParts.roomIdOrAlias) return permalinkParts.roomIdOrAlias;
|
||||
} catch (e) {
|
||||
} catch {
|
||||
// no entity - not a permalink
|
||||
}
|
||||
|
||||
|
|
|
@ -120,7 +120,7 @@ export async function buildAndEncodePickleKey(
|
|||
if (pickleKeyBuf) {
|
||||
return encodeUnpaddedBase64(pickleKeyBuf);
|
||||
}
|
||||
} catch (e) {
|
||||
} catch {
|
||||
logger.error("Error decrypting pickle key");
|
||||
}
|
||||
|
||||
|
|
|
@ -150,7 +150,7 @@ export async function persistTokenInStorage(
|
|||
// token if there is no token or we were unable to encrypt (e.g. if the browser doesn't
|
||||
// have WebCrypto).
|
||||
await StorageAccess.idbSave("account", storageKey, encryptedToken || token);
|
||||
} catch (e) {
|
||||
} catch {
|
||||
// if we couldn't save to indexedDB, fall back to localStorage. We
|
||||
// store the access token unencrypted since localStorage only saves
|
||||
// strings.
|
||||
|
@ -163,7 +163,7 @@ export async function persistTokenInStorage(
|
|||
} else {
|
||||
try {
|
||||
await StorageAccess.idbSave("account", storageKey, token);
|
||||
} catch (e) {
|
||||
} catch {
|
||||
if (!!token) {
|
||||
localStorage.setItem(storageKey, token);
|
||||
} else {
|
||||
|
|
|
@ -45,7 +45,7 @@ export function tooltipifyLinks(rootNodes: ArrayLike<Element>, ignoredNodes: Ele
|
|||
let href = node.getAttribute("href")!;
|
||||
try {
|
||||
href = new URL(href, window.location.href).toString();
|
||||
} catch (e) {
|
||||
} catch {
|
||||
// Not all hrefs will be valid URLs
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue