fix(eslint): rules included deprecated plugin

This commit is contained in:
Paul Makles
2022-06-12 19:38:29 +01:00
parent 56770d40df
commit c1324108e3
24 changed files with 122 additions and 61 deletions

View File

@@ -1850,7 +1850,7 @@ export const emojiDictionary = {
scotland: "🏴󠁧󠁢󠁳󠁣󠁴󠁿",
wales: "🏴󠁧󠁢󠁷󠁬󠁳󠁿",
...{
"1984": "custom:1984.gif",
1984: "custom:1984.gif",
KekW: "custom:KekW.png",
amogus: "custom:amogus.gif",
awaa: "custom:awaa.png",

View File

@@ -137,7 +137,7 @@ export default function MemberList({
server, see issue{" "}
<a
href="https://github.com/revoltchat/delta/issues/128"
target="_blank">
target="_blank" rel="noreferrer">
#128
</a>{" "}
for when this will be resolved.

View File

@@ -182,7 +182,7 @@ export const GroupMemberSidebar = observer(
);
// ! FIXME: this is temporary code until we get lazy guilds like subscriptions
const FETCHED: Set<String> = new Set();
const FETCHED: Set<string> = new Set();
export function resetMemberSidebarFetched() {
FETCHED.clear();

View File

@@ -68,13 +68,13 @@ export function PermissionSelect({
}
return "Neutral";
} else {
}
if (Long.fromNumber(value).and(permission).eq(permission)) {
return "Allow";
}
return "Neutral";
}
}, [value]);
function onSwitch(state: State) {

View File

@@ -336,9 +336,9 @@ export const generateVariables = (theme: Theme) => {
if (colour) {
const [r, g, b] = colour;
return `--${key}: ${theme[key]}; --${key}-rgb: ${r}, ${g}, ${b};`;
} else {
}
return `--${key}: ${theme[key]};`;
}
});
};

View File

@@ -149,9 +149,9 @@ export default function MFAFlow({ onClose, ...props }: ModalProps<"mfa_flow">) {
if (methods!.length === 1) {
props.callback();
return true;
} else {
}
setSelected(undefined);
}
},
},
]

View File

@@ -72,7 +72,7 @@ export async function uploadFile(
return res.data.id;
}
var input: HTMLInputElement;
let input: HTMLInputElement;
export function grabFiles(
maxFileSize: number,
cb: (files: File[]) => void,

View File

@@ -628,7 +628,7 @@ export default function ContextMenus() {
}
for (let i = 0; i < actions.length; i++) {
let action = actions[i];
const action = actions[i];
if (action) {
generateAction({
action,

View File

@@ -11,7 +11,7 @@ export function urlBase64ToUint8Array(base64String: string) {
export function mapToRecord<K extends symbol | string | number, V>(
map: Map<K, V>,
) {
let record = {} as Record<K, V>;
const record = {} as Record<K, V>;
map.forEach((v, k) => (record[k] = v));
return record;
}

View File

@@ -293,7 +293,7 @@ export default class State {
}
}
var state: State;
let state: State;
export async function hydrateState() {
state = new State();

View File

@@ -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]),
);

View File

@@ -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) {

View File

@@ -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, {

View File

@@ -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;
});

View File

@@ -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);
}
}
}

View File

@@ -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);
}
}

View File

@@ -120,11 +120,11 @@ export default function Discover() {
useEffect(() => {
function onMessage(message: MessageEvent) {
let url = new URL(message.origin);
const url = new URL(message.origin);
if (!TRUSTED_HOSTS.includes(url.host)) return;
try {
let data = JSON.parse(message.data);
const data = JSON.parse(message.data);
if (data.source === "discover") {
switch (data.type) {
case "init": {

View File

@@ -77,17 +77,17 @@ export default observer(() => {
<div className={styles.socials}>
<a
href="https://github.com/revoltchat"
target="_blank">
target="_blank" rel="noreferrer">
<Github size={24} />
</a>
<a
href="https://twitter.com/revoltchat"
target="_blank">
target="_blank" rel="noreferrer">
<Twitter size={24} />
</a>
<a
href="https://mastodon.social/@revoltchat"
target="_blank">
target="_blank" rel="noreferrer">
<Mastodon size={24} />
</a>
</div>
@@ -116,7 +116,7 @@ export default observer(() => {
<a
className={styles.attribution}
href="https://unsplash.com/@fakurian"
target="_blank">
target="_blank" rel="noreferrer">
<Text id="general.image_by" /> &lrm;@fakurian &rlm;·
unsplash.com
</a>

View File

@@ -260,7 +260,7 @@ export const Form = observer(({ page, callback }: Props) => {
<a
href="https://developers.revolt.chat/faq/instances#what-is-a-third-party-instance"
style={{ color: "var(--accent)" }}
target="_blank">
target="_blank" rel="noreferrer">
<Text id="general.learn_more" />
</a>
</span>

View File

@@ -52,7 +52,7 @@ export function FormLogin() {
if (session.result === "MFA") {
const { allowed_methods } = session;
let mfa_response: API.MFAResponse | undefined =
const mfa_response: API.MFAResponse | undefined =
await new Promise((callback) =>
modalController.push({
type: "mfa_flow",

View File

@@ -101,7 +101,7 @@ export default observer(({ channel }: Props) => {
filter={[
...(channel.channel_type === "Group"
? []
: ["ViewChannel" as "ViewChannel"]),
: ["ViewChannel" as const]),
"ReadMessageHistory",
"SendMessage",
"ManageMessages",

View File

@@ -11,7 +11,7 @@ cleanupOutdatedCaches();
// Generate list using scripts/locale.js
// prettier-ignore
var locale_keys = ["af","am","ar-dz","ar-kw","ar-ly","ar-ma","ar-sa","ar-tn","ar","az","be","bg","bi","bm","bn","bo","br","bs","ca","cs","cv","cy","da","de-at","de-ch","de","dv","el","en-au","en-ca","en-gb","en-ie","en-il","en-in","en-nz","en-sg","en-tt","en","eo","es-do","es-pr","es-us","es","et","eu","fa","fi","fo","fr-ca","fr-ch","fr","fy","ga","gd","gl","gom-latn","gu","he","hi","hr","ht","hu","hy-am","id","is","it-ch","it","ja","jv","ka","kk","km","kn","ko","ku","ky","lb","lo","lt","lv","me","mi","mk","ml","mn","mr","ms-my","ms","mt","my","nb","ne","nl-be","nl","nn","oc-lnc","pa-in","pl","pt-br","pt","ro","ru","rw","sd","se","si","sk","sl","sq","sr-cyrl","sr","ss","sv-fi","sv","sw","ta","te","tet","tg","th","tk","tl-ph","tlh","tr","tzl","tzm-latn","tzm","ug-cn","uk","ur","uz-latn","uz","vi","x-pseudo","yo","zh-cn","zh-hk","zh-tw","zh","ang","ar","az","be","bg","bn","bottom","br","ca","ca@valencia","ckb","contributors","cs","cy","da","de","de_CH","el","en","en_US","enchantment","enm","eo","es","et","eu","fa","fi","fil","fr","frm","ga","got","he","hi","hr","hu","id","it","ja","kmr","ko","la","lb","leet","li","lt","lv","mk","ml","ms","mt","nb_NO","nl","owo","peo","piglatin","pl","pr","pt_BR","pt_PT","ro","ro_MD","ru","si","sk","sl","sq","sr","sv","ta","te","th","tlh-qaak","tokipona","tr","uk","vec","vi","zh_Hans","zh_Hant"];
const locale_keys = ["af","am","ar-dz","ar-kw","ar-ly","ar-ma","ar-sa","ar-tn","ar","az","be","bg","bi","bm","bn","bo","br","bs","ca","cs","cv","cy","da","de-at","de-ch","de","dv","el","en-au","en-ca","en-gb","en-ie","en-il","en-in","en-nz","en-sg","en-tt","en","eo","es-do","es-pr","es-us","es","et","eu","fa","fi","fo","fr-ca","fr-ch","fr","fy","ga","gd","gl","gom-latn","gu","he","hi","hr","ht","hu","hy-am","id","is","it-ch","it","ja","jv","ka","kk","km","kn","ko","ku","ky","lb","lo","lt","lv","me","mi","mk","ml","mn","mr","ms-my","ms","mt","my","nb","ne","nl-be","nl","nn","oc-lnc","pa-in","pl","pt-br","pt","ro","ru","rw","sd","se","si","sk","sl","sq","sr-cyrl","sr","ss","sv-fi","sv","sw","ta","te","tet","tg","th","tk","tl-ph","tlh","tr","tzl","tzm-latn","tzm","ug-cn","uk","ur","uz-latn","uz","vi","x-pseudo","yo","zh-cn","zh-hk","zh-tw","zh","ang","ar","az","be","bg","bn","bottom","br","ca","ca@valencia","ckb","contributors","cs","cy","da","de","de_CH","el","en","en_US","enchantment","enm","eo","es","et","eu","fa","fi","fil","fr","frm","ga","got","he","hi","hr","hu","id","it","ja","kmr","ko","la","lb","leet","li","lt","lv","mk","ml","ms","mt","nb_NO","nl","owo","peo","piglatin","pl","pr","pt_BR","pt_PT","ro","ro_MD","ru","si","sk","sl","sq","sr","sv","ta","te","th","tlh-qaak","tokipona","tr","uk","vec","vi","zh_Hans","zh_Hant"];
precacheAndRoute(
self.__WB_MANIFEST.filter((entry) => {
@@ -29,7 +29,7 @@ precacheAndRoute(
}
for (const key of locale_keys) {
if (fn.startsWith(key + ".")) {
if (fn.startsWith(`${key }.`)) {
return false;
}
}