chore(mobx): clean up documentation

This commit is contained in:
Paul 2021-12-11 12:08:43 +00:00
parent 49f45aa5aa
commit 830b24a393
7 changed files with 16 additions and 16 deletions

View file

@ -47,6 +47,9 @@
"ClassDeclaration": true, "ClassDeclaration": true,
"ArrowFunctionExpression": false, "ArrowFunctionExpression": false,
"FunctionExpression": false "FunctionExpression": false
},
"ignore": {
"MethodDefinition": ["toJSON", "hydrate"]
} }
} }
] ]

View file

@ -26,7 +26,6 @@ export default class Auth implements Persistent<Data> {
makeAutoObservable(this); makeAutoObservable(this);
} }
// eslint-disable-next-line require-jsdoc
toJSON() { toJSON() {
return { return {
sessions: this.sessions, sessions: this.sessions,
@ -34,7 +33,6 @@ export default class Auth implements Persistent<Data> {
}; };
} }
// eslint-disable-next-line require-jsdoc
hydrate(data: Data) { hydrate(data: Data) {
Object.keys(data.sessions).forEach((id) => Object.keys(data.sessions).forEach((id) =>
this.sessions.set(id, data.sessions[id]), this.sessions.set(id, data.sessions[id]),

View file

@ -20,14 +20,12 @@ export default class Draft implements Persistent<Data> {
makeAutoObservable(this); makeAutoObservable(this);
} }
// eslint-disable-next-line require-jsdoc
toJSON() { toJSON() {
return { return {
drafts: this.drafts, drafts: this.drafts,
}; };
} }
// eslint-disable-next-line require-jsdoc
@action hydrate(data: Data) { @action hydrate(data: Data) {
Object.keys(data.drafts).forEach((key) => Object.keys(data.drafts).forEach((key) =>
this.drafts.set(key, data.drafts[key]), this.drafts.set(key, data.drafts[key]),

View file

@ -2,16 +2,25 @@ import { action, computed, makeAutoObservable, ObservableSet } from "mobx";
import Persistent from "../Persistent"; import Persistent from "../Persistent";
export type Experiment = "search" | "theme_shop"; /**
* Union type of available experiments.
*/
export type Experiment = "dummy" | "theme_shop";
/**
* Currently active experiments.
*/
export const AVAILABLE_EXPERIMENTS: Experiment[] = ["theme_shop"]; export const AVAILABLE_EXPERIMENTS: Experiment[] = ["theme_shop"];
/**
* Definitions for experiments listed by {@link Experiment}.
*/
export const EXPERIMENTS: { export const EXPERIMENTS: {
[key in Experiment]: { title: string; description: string }; [key in Experiment]: { title: string; description: string };
} = { } = {
search: { dummy: {
title: "Search", title: "Dummy Experiment",
description: "Allows you to search for messages in channels.", description: "This is a dummy experiment.",
}, },
theme_shop: { theme_shop: {
title: "Theme Shop", title: "Theme Shop",
@ -37,14 +46,12 @@ export default class Experiments implements Persistent<Data> {
makeAutoObservable(this); makeAutoObservable(this);
} }
// eslint-disable-next-line require-jsdoc
toJSON() { toJSON() {
return { return {
enabled: this.enabled, enabled: this.enabled,
}; };
} }
// eslint-disable-next-line require-jsdoc
@action hydrate(data: Data) { @action hydrate(data: Data) {
if (data.enabled) { if (data.enabled) {
for (const experiment of data.enabled) { for (const experiment of data.enabled) {

View file

@ -22,14 +22,12 @@ export default class Experiments implements Persistent<Data> {
makeAutoObservable(this); makeAutoObservable(this);
} }
// eslint-disable-next-line require-jsdoc
toJSON() { toJSON() {
return { return {
server: this.server, server: this.server,
}; };
} }
// eslint-disable-next-line require-jsdoc
@action hydrate(data: Data) { @action hydrate(data: Data) {
if (data.server) { if (data.server) {
Object.keys(data.server).forEach((key) => Object.keys(data.server).forEach((key) =>

View file

@ -63,14 +63,12 @@ export default class LocaleOptions implements Persistent<Data> {
makeAutoObservable(this); makeAutoObservable(this);
} }
// eslint-disable-next-line require-jsdoc
toJSON() { toJSON() {
return { return {
lang: this.lang, lang: this.lang,
}; };
} }
// eslint-disable-next-line require-jsdoc
@action hydrate(data: Data) { @action hydrate(data: Data) {
this.setLanguage(data.lang); this.setLanguage(data.lang);
} }

View file

@ -44,7 +44,6 @@ export default class NotificationOptions implements Persistent<Data> {
makeAutoObservable(this); makeAutoObservable(this);
} }
// eslint-disable-next-line require-jsdoc
toJSON() { toJSON() {
return { return {
server: this.server, server: this.server,
@ -52,7 +51,6 @@ export default class NotificationOptions implements Persistent<Data> {
}; };
} }
// eslint-disable-next-line require-jsdoc
@action hydrate(data: Data) { @action hydrate(data: Data) {
if (data.server) { if (data.server) {
Object.keys(data.server).forEach((key) => Object.keys(data.server).forEach((key) =>