mirror of
https://github.com/stoatchat/for-legacy-web.git
synced 2026-03-07 01:15:28 +00:00
fix(eslint): rules included deprecated plugin
This commit is contained in:
@@ -293,7 +293,7 @@ export default class State {
|
||||
}
|
||||
}
|
||||
|
||||
var state: State;
|
||||
let state: State;
|
||||
|
||||
export async function hydrateState() {
|
||||
state = new State();
|
||||
|
||||
@@ -67,7 +67,7 @@ export default class Auth implements Store, Persistent<Data> {
|
||||
typeof data.sessions === "object" &&
|
||||
data.sessions !== null
|
||||
) {
|
||||
let v = data.sessions;
|
||||
const v = data.sessions;
|
||||
Object.keys(data.sessions).forEach((id) =>
|
||||
this.sessions.set(id, v[id]),
|
||||
);
|
||||
|
||||
@@ -203,7 +203,7 @@ export default class NotificationOptions
|
||||
* @returns Whether this object is muted
|
||||
*/
|
||||
isMuted(target?: Channel | Server) {
|
||||
var value: NotificationState | undefined;
|
||||
let value: NotificationState | undefined;
|
||||
if (target instanceof Channel) {
|
||||
value = this.computeForChannel(target);
|
||||
} else if (target instanceof Server) {
|
||||
|
||||
@@ -124,7 +124,7 @@ export default class Plugins implements Store, Persistent<Data> {
|
||||
* @param id Plugin Id
|
||||
*/
|
||||
@computed get(namespace: string, id: string) {
|
||||
return this.plugins.get(namespace + "/" + id);
|
||||
return this.plugins.get(`${namespace }/${ id}`);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -133,7 +133,7 @@ export default class Plugins implements Store, Persistent<Data> {
|
||||
* @returns Plugin Instance
|
||||
*/
|
||||
private getInstance(plugin: Pick<Plugin, "namespace" | "id">) {
|
||||
return this.instances.get(plugin.namespace + "/" + plugin.id);
|
||||
return this.instances.get(`${plugin.namespace }/${ plugin.id}`);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -154,12 +154,12 @@ export default class Plugins implements Store, Persistent<Data> {
|
||||
if (!this.state.experiments.isEnabled("plugins"))
|
||||
return console.error("Enable plugins in experiments!");
|
||||
|
||||
let loaded = this.getInstance(plugin);
|
||||
const loaded = this.getInstance(plugin);
|
||||
if (loaded) {
|
||||
this.unload(plugin.namespace, plugin.id);
|
||||
}
|
||||
|
||||
this.plugins.set(plugin.namespace + "/" + plugin.id, plugin);
|
||||
this.plugins.set(`${plugin.namespace }/${ plugin.id}`, plugin);
|
||||
|
||||
if (typeof plugin.enabled === "undefined" || plugin) {
|
||||
this.load(plugin.namespace, plugin.id);
|
||||
@@ -173,7 +173,7 @@ export default class Plugins implements Store, Persistent<Data> {
|
||||
*/
|
||||
remove(namespace: string, id: string) {
|
||||
this.unload(namespace, id);
|
||||
this.plugins.delete(namespace + "/" + id);
|
||||
this.plugins.delete(`${namespace }/${ id}`);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -182,13 +182,13 @@ export default class Plugins implements Store, Persistent<Data> {
|
||||
* @param id Plugin Id
|
||||
*/
|
||||
load(namespace: string, id: string) {
|
||||
let plugin = this.get(namespace, id);
|
||||
const plugin = this.get(namespace, id);
|
||||
if (!plugin) throw "Unknown plugin!";
|
||||
|
||||
try {
|
||||
let ns = plugin.namespace + "/" + plugin.id;
|
||||
const ns = `${plugin.namespace }/${ plugin.id}`;
|
||||
|
||||
let instance: Instance = eval(plugin.entrypoint)();
|
||||
const instance: Instance = eval(plugin.entrypoint)();
|
||||
this.instances.set(ns, {
|
||||
...instance,
|
||||
format: plugin.format,
|
||||
@@ -214,11 +214,11 @@ export default class Plugins implements Store, Persistent<Data> {
|
||||
* @param id Plugin Id
|
||||
*/
|
||||
unload(namespace: string, id: string) {
|
||||
let plugin = this.get(namespace, id);
|
||||
const plugin = this.get(namespace, id);
|
||||
if (!plugin) throw "Unknown plugin!";
|
||||
|
||||
let ns = plugin.namespace + "/" + plugin.id;
|
||||
let loaded = this.getInstance(plugin);
|
||||
const ns = `${plugin.namespace }/${ plugin.id}`;
|
||||
const loaded = this.getInstance(plugin);
|
||||
if (loaded) {
|
||||
loaded.onUnload?.();
|
||||
this.plugins.set(ns, {
|
||||
|
||||
@@ -159,7 +159,7 @@ export default class Settings
|
||||
@computed private pullKeys(keys: (keyof ISettings)[]) {
|
||||
const obj: Partial<ISettings> = {};
|
||||
keys.forEach((key) => {
|
||||
let value = this.get(key);
|
||||
const value = this.get(key);
|
||||
if (!value) return;
|
||||
(obj as any)[key] = value;
|
||||
});
|
||||
|
||||
@@ -82,11 +82,11 @@ export default class SAudio {
|
||||
getAudio(path: string) {
|
||||
if (this.cache.has(path)) {
|
||||
return this.cache.get(path)!;
|
||||
} else {
|
||||
}
|
||||
const el = new Audio(path);
|
||||
this.cache.set(path, el);
|
||||
return el;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
loadCache() {
|
||||
@@ -100,7 +100,7 @@ export default class SAudio {
|
||||
try {
|
||||
audio.play();
|
||||
} catch (err) {
|
||||
console.error("Hit error while playing", sound + ":", err);
|
||||
console.error("Hit error while playing", `${sound }:`, err);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -110,7 +110,7 @@ export default class STheme {
|
||||
for (const key of Object.keys(variables)) {
|
||||
const value = variables[key];
|
||||
if (typeof value === "string") {
|
||||
variables[key + "-contrast"] = getContrastingColour(value);
|
||||
variables[`${key }-contrast`] = getContrastingColour(value);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user