diff --git a/package.json b/package.json
index b2e391c3..0f158e83 100644
--- a/package.json
+++ b/package.json
@@ -38,24 +38,6 @@
{
"varsIgnorePattern": "^_"
}
- ],
- "require-jsdoc": [
- "error",
- {
- "require": {
- "FunctionDeclaration": true,
- "MethodDefinition": true,
- "ClassDeclaration": true,
- "ArrowFunctionExpression": false,
- "FunctionExpression": false
- },
- "ignore": {
- "MethodDefinition": [
- "toJSON",
- "hydrate"
- ]
- }
- }
]
}
},
@@ -121,6 +103,7 @@
"detect-browser": "^5.2.0",
"eslint": "^7.28.0",
"eslint-config-preact": "^1.1.4",
+ "eslint-plugin-jsdoc": "^39.3.2",
"eventemitter3": "^4.0.7",
"json-stringify-deterministic": "^1.0.2",
"localforage": "^1.9.0",
diff --git a/src/assets/emojis.ts b/src/assets/emojis.ts
index 7488ac14..aeb6764d 100644
--- a/src/assets/emojis.ts
+++ b/src/assets/emojis.ts
@@ -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",
diff --git a/src/components/navigation/right/MemberList.tsx b/src/components/navigation/right/MemberList.tsx
index 45aef23b..8b9495ba 100644
--- a/src/components/navigation/right/MemberList.tsx
+++ b/src/components/navigation/right/MemberList.tsx
@@ -137,7 +137,7 @@ export default function MemberList({
server, see issue{" "}
+ target="_blank" rel="noreferrer">
#128
{" "}
for when this will be resolved.
diff --git a/src/components/navigation/right/MemberSidebar.tsx b/src/components/navigation/right/MemberSidebar.tsx
index 364f4ef3..37333b45 100644
--- a/src/components/navigation/right/MemberSidebar.tsx
+++ b/src/components/navigation/right/MemberSidebar.tsx
@@ -182,7 +182,7 @@ export const GroupMemberSidebar = observer(
);
// ! FIXME: this is temporary code until we get lazy guilds like subscriptions
-const FETCHED: Set = new Set();
+const FETCHED: Set = new Set();
export function resetMemberSidebarFetched() {
FETCHED.clear();
diff --git a/src/components/settings/roles/PermissionSelect.tsx b/src/components/settings/roles/PermissionSelect.tsx
index 0a8b9742..0afc8c08 100644
--- a/src/components/settings/roles/PermissionSelect.tsx
+++ b/src/components/settings/roles/PermissionSelect.tsx
@@ -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) {
diff --git a/src/context/Theme.tsx b/src/context/Theme.tsx
index e07e0035..9d8ec18b 100644
--- a/src/context/Theme.tsx
+++ b/src/context/Theme.tsx
@@ -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]};`;
- }
+
});
};
diff --git a/src/context/modals/components/MFAFlow.tsx b/src/context/modals/components/MFAFlow.tsx
index 731694e5..0b44c302 100644
--- a/src/context/modals/components/MFAFlow.tsx
+++ b/src/context/modals/components/MFAFlow.tsx
@@ -149,9 +149,9 @@ export default function MFAFlow({ onClose, ...props }: ModalProps<"mfa_flow">) {
if (methods!.length === 1) {
props.callback();
return true;
- } else {
+ }
setSelected(undefined);
- }
+
},
},
]
diff --git a/src/context/revoltjs/FileUploads.tsx b/src/context/revoltjs/FileUploads.tsx
index db246144..4d8a9a0c 100644
--- a/src/context/revoltjs/FileUploads.tsx
+++ b/src/context/revoltjs/FileUploads.tsx
@@ -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,
diff --git a/src/lib/ContextMenus.tsx b/src/lib/ContextMenus.tsx
index 9f8dabf3..eced77dc 100644
--- a/src/lib/ContextMenus.tsx
+++ b/src/lib/ContextMenus.tsx
@@ -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,
diff --git a/src/lib/conversion.ts b/src/lib/conversion.ts
index f0840bb0..14469ea8 100644
--- a/src/lib/conversion.ts
+++ b/src/lib/conversion.ts
@@ -11,7 +11,7 @@ export function urlBase64ToUint8Array(base64String: string) {
export function mapToRecord(
map: Map,
) {
- let record = {} as Record;
+ const record = {} as Record;
map.forEach((v, k) => (record[k] = v));
return record;
}
diff --git a/src/mobx/State.ts b/src/mobx/State.ts
index b79461af..4168809e 100644
--- a/src/mobx/State.ts
+++ b/src/mobx/State.ts
@@ -293,7 +293,7 @@ export default class State {
}
}
-var state: State;
+let state: State;
export async function hydrateState() {
state = new State();
diff --git a/src/mobx/stores/Auth.ts b/src/mobx/stores/Auth.ts
index 8662bb1f..71cea92c 100644
--- a/src/mobx/stores/Auth.ts
+++ b/src/mobx/stores/Auth.ts
@@ -67,7 +67,7 @@ export default class Auth implements Store, Persistent {
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]),
);
diff --git a/src/mobx/stores/NotificationOptions.ts b/src/mobx/stores/NotificationOptions.ts
index 9632f048..5f685560 100644
--- a/src/mobx/stores/NotificationOptions.ts
+++ b/src/mobx/stores/NotificationOptions.ts
@@ -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) {
diff --git a/src/mobx/stores/Plugins.ts b/src/mobx/stores/Plugins.ts
index 506decb5..08a480d5 100644
--- a/src/mobx/stores/Plugins.ts
+++ b/src/mobx/stores/Plugins.ts
@@ -124,7 +124,7 @@ export default class Plugins implements Store, Persistent {
* @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 {
* @returns Plugin Instance
*/
private getInstance(plugin: Pick) {
- 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 {
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 {
*/
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 {
* @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 {
* @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, {
diff --git a/src/mobx/stores/Settings.ts b/src/mobx/stores/Settings.ts
index 56a36454..cf94e6c6 100644
--- a/src/mobx/stores/Settings.ts
+++ b/src/mobx/stores/Settings.ts
@@ -159,7 +159,7 @@ export default class Settings
@computed private pullKeys(keys: (keyof ISettings)[]) {
const obj: Partial = {};
keys.forEach((key) => {
- let value = this.get(key);
+ const value = this.get(key);
if (!value) return;
(obj as any)[key] = value;
});
diff --git a/src/mobx/stores/helpers/SAudio.ts b/src/mobx/stores/helpers/SAudio.ts
index fdc4b504..a8256e3e 100644
--- a/src/mobx/stores/helpers/SAudio.ts
+++ b/src/mobx/stores/helpers/SAudio.ts
@@ -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);
}
}
}
diff --git a/src/mobx/stores/helpers/STheme.ts b/src/mobx/stores/helpers/STheme.ts
index 9249d6ab..cde02cf3 100644
--- a/src/mobx/stores/helpers/STheme.ts
+++ b/src/mobx/stores/helpers/STheme.ts
@@ -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);
}
}
diff --git a/src/pages/discover/Discover.tsx b/src/pages/discover/Discover.tsx
index 7102c532..66fb7268 100644
--- a/src/pages/discover/Discover.tsx
+++ b/src/pages/discover/Discover.tsx
@@ -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": {
diff --git a/src/pages/login/Login.tsx b/src/pages/login/Login.tsx
index f4f79416..04fa8195 100644
--- a/src/pages/login/Login.tsx
+++ b/src/pages/login/Login.tsx
@@ -77,17 +77,17 @@ export default observer(() => {
@@ -116,7 +116,7 @@ export default observer(() => {
+ target="_blank" rel="noreferrer">
@fakurian ·
unsplash.com
diff --git a/src/pages/login/forms/Form.tsx b/src/pages/login/forms/Form.tsx
index c6683132..2ec8d0eb 100644
--- a/src/pages/login/forms/Form.tsx
+++ b/src/pages/login/forms/Form.tsx
@@ -260,7 +260,7 @@ export const Form = observer(({ page, callback }: Props) => {
+ target="_blank" rel="noreferrer">
diff --git a/src/pages/login/forms/FormLogin.tsx b/src/pages/login/forms/FormLogin.tsx
index c358be8f..6fc90852 100644
--- a/src/pages/login/forms/FormLogin.tsx
+++ b/src/pages/login/forms/FormLogin.tsx
@@ -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",
diff --git a/src/pages/settings/channel/Permissions.tsx b/src/pages/settings/channel/Permissions.tsx
index 662d3bcc..d728106f 100644
--- a/src/pages/settings/channel/Permissions.tsx
+++ b/src/pages/settings/channel/Permissions.tsx
@@ -101,7 +101,7 @@ export default observer(({ channel }: Props) => {
filter={[
...(channel.channel_type === "Group"
? []
- : ["ViewChannel" as "ViewChannel"]),
+ : ["ViewChannel" as const]),
"ReadMessageHistory",
"SendMessage",
"ManageMessages",
diff --git a/src/sw.ts b/src/sw.ts
index af71b0e2..1daec57c 100644
--- a/src/sw.ts
+++ b/src/sw.ts
@@ -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;
}
}
diff --git a/yarn.lock b/yarn.lock
index 0d7c990e..6e582177 100644
--- a/yarn.lock
+++ b/yarn.lock
@@ -1797,6 +1797,17 @@ __metadata:
languageName: node
linkType: hard
+"@es-joy/jsdoccomment@npm:~0.31.0":
+ version: 0.31.0
+ resolution: "@es-joy/jsdoccomment@npm:0.31.0"
+ dependencies:
+ comment-parser: 1.3.1
+ esquery: ^1.4.0
+ jsdoc-type-pratt-parser: ~3.1.0
+ checksum: 1691ff501559f45593e5f080d2c08dea4fadba5f48e526b9ff2943c050fbb40408f5e83968542e5b6bf47219c7573796d00bfe80dacfd1ba8187904cc475cefb
+ languageName: node
+ linkType: hard
+
"@eslint/eslintrc@npm:^0.4.3":
version: 0.4.3
resolution: "@eslint/eslintrc@npm:0.4.3"
@@ -3551,6 +3562,7 @@ __metadata:
detect-browser: ^5.2.0
eslint: ^7.28.0
eslint-config-preact: ^1.1.4
+ eslint-plugin-jsdoc: ^39.3.2
eventemitter3: ^4.0.7
fs-extra: ^10.0.0
json-stringify-deterministic: ^1.0.2
@@ -3682,6 +3694,13 @@ __metadata:
languageName: node
linkType: hard
+"comment-parser@npm:1.3.1":
+ version: 1.3.1
+ resolution: "comment-parser@npm:1.3.1"
+ checksum: 421e6a113a3afd548500e7174ab46a2049dccf92e82bbaa3b209031b1bdf97552aabfa1ae2a120c0b62df17e1ba70e0d8b05d68504fee78e1ef974c59bcfe718
+ languageName: node
+ linkType: hard
+
"common-tags@npm:^1.8.0":
version: 1.8.0
resolution: "common-tags@npm:1.8.0"
@@ -3815,7 +3834,7 @@ __metadata:
languageName: node
linkType: hard
-"debug@npm:4":
+"debug@npm:4, debug@npm:^4.3.4":
version: 4.3.4
resolution: "debug@npm:4.3.4"
dependencies:
@@ -4328,6 +4347,23 @@ __metadata:
languageName: node
linkType: hard
+"eslint-plugin-jsdoc@npm:^39.3.2":
+ version: 39.3.2
+ resolution: "eslint-plugin-jsdoc@npm:39.3.2"
+ dependencies:
+ "@es-joy/jsdoccomment": ~0.31.0
+ comment-parser: 1.3.1
+ debug: ^4.3.4
+ escape-string-regexp: ^4.0.0
+ esquery: ^1.4.0
+ semver: ^7.3.7
+ spdx-expression-parse: ^3.0.1
+ peerDependencies:
+ eslint: ^7.0.0 || ^8.0.0
+ checksum: 2fd3adb23f97c5cc8c03bd8c7338c12074e4e6d49eaee042db65317a69abd389a4c4992fbc9075fa3deabd1d89393b639683f612deac06d89950767571c03457
+ languageName: node
+ linkType: hard
+
"eslint-plugin-react-hooks@npm:^4.2.0":
version: 4.2.0
resolution: "eslint-plugin-react-hooks@npm:4.2.0"
@@ -5421,6 +5457,13 @@ __metadata:
languageName: node
linkType: hard
+"jsdoc-type-pratt-parser@npm:~3.1.0":
+ version: 3.1.0
+ resolution: "jsdoc-type-pratt-parser@npm:3.1.0"
+ checksum: 2f437b57621f1e481918165f6cf0e48256628a9e510d8b3f88a2ab667bf2128bf8b94c628b57c43e78f555ca61983e9c282814703840dc091d2623992214a061
+ languageName: node
+ linkType: hard
+
"jsesc@npm:^2.5.1":
version: 2.5.2
resolution: "jsesc@npm:2.5.2"
@@ -7060,6 +7103,17 @@ __metadata:
languageName: node
linkType: hard
+"semver@npm:^7.3.7":
+ version: 7.3.7
+ resolution: "semver@npm:7.3.7"
+ dependencies:
+ lru-cache: ^6.0.0
+ bin:
+ semver: bin/semver.js
+ checksum: 2fa3e877568cd6ce769c75c211beaed1f9fce80b28338cadd9d0b6c40f2e2862bafd62c19a6cff42f3d54292b7c623277bcab8816a2b5521cf15210d43e75232
+ languageName: node
+ linkType: hard
+
"serialize-javascript@npm:^4.0.0":
version: 4.0.0
resolution: "serialize-javascript@npm:4.0.0"
@@ -7267,6 +7321,30 @@ __metadata:
languageName: node
linkType: hard
+"spdx-exceptions@npm:^2.1.0":
+ version: 2.3.0
+ resolution: "spdx-exceptions@npm:2.3.0"
+ checksum: cb69a26fa3b46305637123cd37c85f75610e8c477b6476fa7354eb67c08128d159f1d36715f19be6f9daf4b680337deb8c65acdcae7f2608ba51931540687ac0
+ languageName: node
+ linkType: hard
+
+"spdx-expression-parse@npm:^3.0.1":
+ version: 3.0.1
+ resolution: "spdx-expression-parse@npm:3.0.1"
+ dependencies:
+ spdx-exceptions: ^2.1.0
+ spdx-license-ids: ^3.0.0
+ checksum: a1c6e104a2cbada7a593eaa9f430bd5e148ef5290d4c0409899855ce8b1c39652bcc88a725259491a82601159d6dc790bedefc9016c7472f7de8de7361f8ccde
+ languageName: node
+ linkType: hard
+
+"spdx-license-ids@npm:^3.0.0":
+ version: 3.0.11
+ resolution: "spdx-license-ids@npm:3.0.11"
+ checksum: 1da1acb090257773e60b022094050e810ae9fec874dc1461f65dc0400cd42dd830ab2df6e64fb49c2db3dce386dd0362110780e1b154db7c0bb413488836aaeb
+ languageName: node
+ linkType: hard
+
"sprintf-js@npm:~1.0.2":
version: 1.0.3
resolution: "sprintf-js@npm:1.0.3"