linting and stuff

This commit is contained in:
Rie Takahashi 2022-10-24 18:43:06 +01:00
parent 0e7bd87cee
commit c3da99eeee
15 changed files with 109 additions and 20 deletions

@ -16,6 +16,7 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>. * along with this program. If not, see <https://www.gnu.org/licenses/>.
*/ */
import { Forms } from "@components";
import { User } from "discord-types/general"; import { User } from "discord-types/general";
import { Constructor } from "type-fest"; import { Constructor } from "type-fest";
@ -25,7 +26,7 @@ import { lazyWebpack, proxyLazy } from "../../utils";
import { ModalContent, ModalFooter, ModalHeader, ModalProps, ModalRoot, ModalSize } from "../../utils/modal"; import { ModalContent, ModalFooter, ModalHeader, ModalProps, ModalRoot, ModalSize } from "../../utils/modal";
import { OptionType, Plugin } from "../../utils/types"; import { OptionType, Plugin } from "../../utils/types";
import { filters } from "../../webpack"; import { filters } from "../../webpack";
import { Button, FluxDispatcher, Forms, React, Text, Tooltip, UserStore, UserUtils } from "../../webpack/common"; import { Button, FluxDispatcher, React, Text, Tooltip, UserStore, UserUtils } from "../../webpack/common";
import ErrorBoundary from "../ErrorBoundary"; import ErrorBoundary from "../ErrorBoundary";
import { Flex } from "../Flex"; import { Flex } from "../Flex";
import { import {
@ -33,7 +34,7 @@ import {
SettingInputComponent, SettingInputComponent,
SettingNumericComponent, SettingNumericComponent,
SettingSelectComponent, SettingSelectComponent,
SettingSliderComponent, SettingSliderComponent
} from "./components"; } from "./components";
const UserSummaryItem = lazyWebpack(filters.byCode("defaultRenderUser", "showDefaultAvatarsForNullUsers")); const UserSummaryItem = lazyWebpack(filters.byCode("defaultRenderUser", "showDefaultAvatarsForNullUsers"));

@ -16,8 +16,10 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>. * along with this program. If not, see <https://www.gnu.org/licenses/>.
*/ */
import { Forms } from "@components";
import { PluginOptionBoolean } from "../../../utils/types"; import { PluginOptionBoolean } from "../../../utils/types";
import { Forms, React, Select } from "../../../webpack/common"; import { React, Select } from "../../../webpack/common";
import { ISettingElementProps } from "."; import { ISettingElementProps } from ".";
export function SettingBooleanComponent({ option, pluginSettings, id, onChange, onError }: ISettingElementProps<PluginOptionBoolean>) { export function SettingBooleanComponent({ option, pluginSettings, id, onChange, onError }: ISettingElementProps<PluginOptionBoolean>) {

@ -16,8 +16,10 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>. * along with this program. If not, see <https://www.gnu.org/licenses/>.
*/ */
import { Forms } from "@components";
import { OptionType, PluginOptionNumber } from "../../../utils/types"; import { OptionType, PluginOptionNumber } from "../../../utils/types";
import { Forms, React, TextInput } from "../../../webpack/common"; import { React, TextInput } from "../../../webpack/common";
import { ISettingElementProps } from "."; import { ISettingElementProps } from ".";
const MAX_SAFE_NUMBER = BigInt(Number.MAX_SAFE_INTEGER); const MAX_SAFE_NUMBER = BigInt(Number.MAX_SAFE_INTEGER);

@ -19,9 +19,9 @@
import { FormSection, FormText, FormTitle } from "@components/Forms"; import { FormSection, FormText, FormTitle } from "@components/Forms";
import Select from "@components/Select"; import Select from "@components/Select";
import { ISettingElementProps } from ".";
import { PluginOptionSelect } from "../../../utils/types"; import { PluginOptionSelect } from "../../../utils/types";
import { React } from "../../../webpack/common"; import { React } from "../../../webpack/common";
import { ISettingElementProps } from ".";
export function SettingSelectComponent({ option, pluginSettings, onChange, onError, id }: ISettingElementProps<PluginOptionSelect>) { export function SettingSelectComponent({ option, pluginSettings, onChange, onError, id }: ISettingElementProps<PluginOptionSelect>) {
const def = pluginSettings[id] ?? option.options?.find(o => o.default)?.value; const def = pluginSettings[id] ?? option.options?.find(o => o.default)?.value;

@ -16,8 +16,10 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>. * along with this program. If not, see <https://www.gnu.org/licenses/>.
*/ */
import { Forms } from "@components";
import { PluginOptionSlider } from "../../../utils/types"; import { PluginOptionSlider } from "../../../utils/types";
import { Forms, React, Slider } from "../../../webpack/common"; import { React, Slider } from "../../../webpack/common";
import { ISettingElementProps } from "."; import { ISettingElementProps } from ".";
export function makeRange(start: number, end: number, step = 1) { export function makeRange(start: number, end: number, step = 1) {

@ -16,8 +16,10 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>. * along with this program. If not, see <https://www.gnu.org/licenses/>.
*/ */
import { Forms } from "@components";
import { PluginOptionString } from "../../../utils/types"; import { PluginOptionString } from "../../../utils/types";
import { Forms, React, TextInput } from "../../../webpack/common"; import { React, TextInput } from "../../../webpack/common";
import { ISettingElementProps } from "."; import { ISettingElementProps } from ".";
export function SettingInputComponent({ option, pluginSettings, id, onChange, onError }: ISettingElementProps<PluginOptionString>) { export function SettingInputComponent({ option, pluginSettings, id, onChange, onError }: ISettingElementProps<PluginOptionString>) {

@ -17,6 +17,7 @@
*/ */
import { FormDivider, FormSection, FormText, FormTitle } from "@components/Forms"; import { FormDivider, FormSection, FormText, FormTitle } from "@components/Forms";
import Plugins from "~plugins"; import Plugins from "~plugins";
import { showNotice } from "../../api/Notices"; import { showNotice } from "../../api/Notices";

@ -16,11 +16,13 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>. * along with this program. If not, see <https://www.gnu.org/licenses/>.
*/ */
import { FormDivider, FormSection, FormText, FormTitle } from "@components/Forms";
import { useSettings } from "../api/settings"; import { useSettings } from "../api/settings";
import { ChangeList } from "../utils/ChangeList"; import { ChangeList } from "../utils/ChangeList";
import IpcEvents from "../utils/IpcEvents"; import IpcEvents from "../utils/IpcEvents";
import { useAwaiter } from "../utils/misc"; import { useAwaiter } from "../utils/misc";
import { Alerts, Button, Forms, Margins, Parser, React, Switch } from "../webpack/common"; import { Alerts, Button, Margins, Parser, React, Switch } from "../webpack/common";
import ErrorBoundary from "./ErrorBoundary"; import ErrorBoundary from "./ErrorBoundary";
import { Flex } from "./Flex"; import { Flex } from "./Flex";
import { launchMonacoEditor } from "./Monaco"; import { launchMonacoEditor } from "./Monaco";
@ -51,14 +53,14 @@ export default ErrorBoundary.wrap(function Settings() {
}, []); }, []);
return ( return (
<Forms.FormSection tag="h1" title="Vencord"> <FormSection tag="h1" title="Vencord">
<Forms.FormTitle tag="h5"> <FormTitle tag="h5">
Settings Settings
</Forms.FormTitle> </FormTitle>
<Forms.FormText> <FormText>
Settings Directory: <code style={{ userSelect: "text", cursor: "text" }}>{settingsDir}</code> Settings Directory: <code style={{ userSelect: "text", cursor: "text" }}>{settingsDir}</code>
</Forms.FormText> </FormText>
{!IS_WEB && <Flex className={Margins.marginBottom20} style={{ marginTop: 8 }}> {!IS_WEB && <Flex className={Margins.marginBottom20} style={{ marginTop: 8 }}>
<Button <Button
@ -92,7 +94,7 @@ export default ErrorBoundary.wrap(function Settings() {
Open QuickCSS File Open QuickCSS File
</Button>} </Button>}
<Forms.FormDivider /> <FormDivider />
<Switch <Switch
value={settings.useQuickCss} value={settings.useQuickCss}
onChange={(v: boolean) => settings.useQuickCss = v} onChange={(v: boolean) => settings.useQuickCss = v}
@ -114,6 +116,6 @@ export default ErrorBoundary.wrap(function Settings() {
> >
Get notified about new Updates Get notified about new Updates
</Switch>} </Switch>}
</Forms.FormSection > </FormSection>
); );
}); });

@ -16,11 +16,13 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>. * along with this program. If not, see <https://www.gnu.org/licenses/>.
*/ */
import { Forms } from "@components";
import gitHash from "~git-hash"; import gitHash from "~git-hash";
import { classes, useAwaiter } from "../utils/misc"; import { classes, useAwaiter } from "../utils/misc";
import { changes, checkForUpdates, getRepo, isNewer, rebuild, update, updateError, UpdateLogger } from "../utils/updater"; import { changes, checkForUpdates, getRepo, isNewer, rebuild, update, updateError, UpdateLogger } from "../utils/updater";
import { Alerts, Button, Card, Forms, Margins, Parser, React, Toasts } from "../webpack/common"; import { Alerts, Button, Card, Margins, Parser, React, Toasts } from "../webpack/common";
import ErrorBoundary from "./ErrorBoundary"; import ErrorBoundary from "./ErrorBoundary";
import { ErrorCard } from "./ErrorCard"; import { ErrorCard } from "./ErrorCard";
import { Flex } from "./Flex"; import { Flex } from "./Flex";

@ -16,12 +16,14 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>. * along with this program. If not, see <https://www.gnu.org/licenses/>.
*/ */
import { Forms } from "@components";
import { lazyWebpack } from "../utils"; import { lazyWebpack } from "../utils";
import { Devs } from "../utils/constants"; import { Devs } from "../utils/constants";
import definePlugin, { OptionType } from "../utils/types"; import definePlugin, { OptionType } from "../utils/types";
import { Settings } from "../Vencord"; import { Settings } from "../Vencord";
import { filters } from "../webpack"; import { filters } from "../webpack";
import { Forms, React } from "../webpack/common"; import { React } from "../webpack/common";
const KbdStyles = lazyWebpack(filters.byProps(["key", "removeBuildOverride"])); const KbdStyles = lazyWebpack(filters.byProps(["key", "removeBuildOverride"]));
@ -76,7 +78,7 @@ export default definePlugin({
return ( return (
<React.Fragment> <React.Fragment>
<Forms.FormTitle tag="h3">More Information</Forms.FormTitle> <Forms.FormTitle tag="h3">More Information</Forms.FormTitle>
<Forms.FormText variant="text-md/normal"> <Forms.FormText>
You can enable client DevTools{" "} You can enable client DevTools{" "}
<kbd className={KbdStyles.key}>{modKey}</kbd> +{" "} <kbd className={KbdStyles.key}>{modKey}</kbd> +{" "}
<kbd className={KbdStyles.key}>{altKey}</kbd> +{" "} <kbd className={KbdStyles.key}>{altKey}</kbd> +{" "}

@ -16,7 +16,9 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>. * along with this program. If not, see <https://www.gnu.org/licenses/>.
*/ */
import { Forms, React } from "../../../webpack/common"; import { Forms } from "@components";
import { React } from "../../../webpack/common";
export default function PronounsAboutComponent() { export default function PronounsAboutComponent() {
return ( return (

@ -1,3 +1,21 @@
/*
* Vencord, a modification for Discord's desktop app
* Copyright (c) 2022 Vendicated and contributors
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
import { filters, proxyWaitFor } from "../webpack"; import { filters, proxyWaitFor } from "../webpack";
export enum Tag { export enum Tag {

@ -1,3 +1,21 @@
/*
* Vencord, a modification for Discord's desktop app
* Copyright (c) 2022 Vendicated and contributors
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
import { lazyWebpack } from "src/utils"; import { lazyWebpack } from "src/utils";
import { filters } from "../webpack"; import { filters } from "../webpack";

@ -1,3 +1,21 @@
/*
* Vencord, a modification for Discord's desktop app
* Copyright (c) 2022 Vendicated and contributors
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
import { lazyWebpack } from "../../utils"; import { lazyWebpack } from "../../utils";
import { filters } from "../webpack"; import { filters } from "../webpack";

@ -1,4 +1,21 @@
/*
* Vencord, a modification for Discord's desktop app
* Copyright (c) 2022 Vendicated and contributors
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
export * as Toasts from "./Toasts";
export * as Forms from "./Forms"; export * as Forms from "./Forms";
export * as Select from "./Select"; export * as Select from "./Select";
export * as Toasts from "./Toasts";