This commit is contained in:
thororen1234 2024-08-03 00:24:47 -04:00
parent 6dca8bca13
commit b8a4dff851
15 changed files with 26 additions and 33 deletions

View file

@ -7,7 +7,6 @@
// @ts-check // @ts-check
import stylistic from "@stylistic/eslint-plugin"; import stylistic from "@stylistic/eslint-plugin";
import pathAlias from "eslint-plugin-path-alias";
import header from "eslint-plugin-simple-header"; import header from "eslint-plugin-simple-header";
import simpleImportSort from "eslint-plugin-simple-import-sort"; import simpleImportSort from "eslint-plugin-simple-import-sort";
import unusedImports from "eslint-plugin-unused-imports"; import unusedImports from "eslint-plugin-unused-imports";
@ -23,7 +22,6 @@ export default tseslint.config(
"@typescript-eslint": tseslint.plugin, "@typescript-eslint": tseslint.plugin,
"simple-import-sort": simpleImportSort, "simple-import-sort": simpleImportSort,
"unused-imports": unusedImports, "unused-imports": unusedImports,
"path-alias": pathAlias,
}, },
settings: { settings: {
"import/resolver": { "import/resolver": {
@ -120,7 +118,6 @@ export default tseslint.config(
"simple-import-sort/imports": "error", "simple-import-sort/imports": "error",
"simple-import-sort/exports": "error", "simple-import-sort/exports": "error",
"unused-imports/no-unused-imports": "error", "unused-imports/no-unused-imports": "error",
"path-alias/no-relative": "error"
} }
} }
); );

View file

@ -20,7 +20,7 @@ import "../suppressExperimentalWarnings.js";
import "../checkNodeVersion.js"; import "../checkNodeVersion.js";
import { exec, execSync } from "child_process"; import { exec, execSync } from "child_process";
import esbuild, { build, BuildOptions, context, Plugin } from "esbuild"; import esbuild, { build, BuildOptions, Plugin } from "esbuild";
import { constants as FsConstants, readFileSync } from "fs"; import { constants as FsConstants, readFileSync } from "fs";
import { access, readdir, readFile } from "fs/promises"; import { access, readdir, readFile } from "fs/promises";
import { minify as minifyHtml } from "html-minifier-terser"; import { minify as minifyHtml } from "html-minifier-terser";

View file

@ -4,7 +4,6 @@
* SPDX-License-Identifier: GPL-3.0-or-later * SPDX-License-Identifier: GPL-3.0-or-later
*/ */
import { classNameFactory } from "@api/Styles";
import ErrorBoundary from "@components/ErrorBoundary"; import ErrorBoundary from "@components/ErrorBoundary";
import { findComponentByCodeLazy } from "@webpack"; import { findComponentByCodeLazy } from "@webpack";
import { moment, React, useMemo } from "@webpack/common"; import { moment, React, useMemo } from "@webpack/common";

View file

@ -4,8 +4,6 @@
* SPDX-License-Identifier: GPL-3.0-or-later * SPDX-License-Identifier: GPL-3.0-or-later
*/ */
/* eslint-disable arrow-parens */
import * as DataStore from "@api/DataStore"; import * as DataStore from "@api/DataStore";
import { Flex } from "@components/Flex"; import { Flex } from "@components/Flex";
import { DeleteIcon, PlusIcon } from "@components/Icons"; import { DeleteIcon, PlusIcon } from "@components/Icons";
@ -107,12 +105,12 @@ export default function ({
id: "all", id: "all",
sources: [...colorwayData, ...customColorwayData] sources: [...colorwayData, ...customColorwayData]
}, },
...colorwayData.map((source) => ({ ...colorwayData.map(source => ({
name: source.source, name: source.source,
id: source.source.toLowerCase().replaceAll(" ", "-"), id: source.source.toLowerCase().replaceAll(" ", "-"),
sources: [source] sources: [source]
})), })),
...customColorwayData.map((source) => ({ ...customColorwayData.map(source => ({
name: source.source, name: source.source,
id: source.source.toLowerCase().replaceAll(" ", "-"), id: source.source.toLowerCase().replaceAll(" ", "-"),
sources: [source] sources: [source]
@ -147,7 +145,7 @@ export default function ({
const onlineSources: { name: string, url: string; }[] = await DataStore.get("colorwaySourceFiles") as { name: string, url: string; }[]; const onlineSources: { name: string, url: string; }[] = await DataStore.get("colorwaySourceFiles") as { name: string, url: string; }[];
const responses: Response[] = await Promise.all( const responses: Response[] = await Promise.all(
onlineSources.map((source) => onlineSources.map(source =>
fetch(source.url, force ? { cache: "no-store" } : {}) fetch(source.url, force ? { cache: "no-store" } : {})
) )
); );
@ -309,7 +307,7 @@ export default function ({
style={{ marginLeft: "8px" }} style={{ marginLeft: "8px" }}
onMouseEnter={onMouseEnter} onMouseEnter={onMouseEnter}
onMouseLeave={onMouseLeave} onMouseLeave={onMouseLeave}
onClick={() => openModal((props) => <CreatorModal onClick={() => openModal(props => <CreatorModal
modalProps={props} modalProps={props}
loadUIProps={loadUI} loadUIProps={loadUI}
/>)} />)}
@ -350,7 +348,7 @@ export default function ({
id="colorway-opencolorstealer" id="colorway-opencolorstealer"
onMouseEnter={onMouseEnter} onMouseEnter={onMouseEnter}
onMouseLeave={onMouseLeave} onMouseLeave={onMouseLeave}
onClick={() => openModal((props) => <ColorPickerModal modalProps={props} />)} onClick={() => openModal(props => <ColorPickerModal modalProps={props} />)}
> >
<PalleteIcon width={20} height={20} style={{ padding: "6px", boxSizing: "content-box" }} /> <PalleteIcon width={20} height={20} style={{ padding: "6px", boxSizing: "content-box" }} />
</Button>} </Button>}
@ -469,7 +467,7 @@ export default function ({
{(showLabelsInSelectorGridView || viewMode === "list") && <Text className={"colorwayLabel" + ((showLabelsInSelectorGridView && viewMode === "grid") ? " labelInGrid" : "")}>Auto</Text>} {(showLabelsInSelectorGridView || viewMode === "list") && <Text className={"colorwayLabel" + ((showLabelsInSelectorGridView && viewMode === "grid") ? " labelInGrid" : "")}>Auto</Text>}
<div <div
className="colorwayInfoIconContainer" className="colorwayInfoIconContainer"
onClick={async (e) => { onClick={async e => {
e.stopPropagation(); e.stopPropagation();
const activeAutoPreset = await DataStore.get("activeAutoPreset"); const activeAutoPreset = await DataStore.get("activeAutoPreset");
openModal((props: ModalProps) => <AutoColorwaySelector autoColorwayId={activeAutoPreset} modalProps={props} onChange={autoPresetId => { openModal((props: ModalProps) => <AutoColorwaySelector autoColorwayId={activeAutoPreset} modalProps={props} onChange={autoPresetId => {
@ -591,7 +589,7 @@ export default function ({
{activeColorwayObject.id === color.name && activeColorwayObject.source === color.source && <circle cx="12" cy="12" r="5" className="radioIconForeground-3wH3aU" fill="currentColor" />} {activeColorwayObject.id === color.name && activeColorwayObject.source === color.source && <circle cx="12" cy="12" r="5" className="radioIconForeground-3wH3aU" fill="currentColor" />}
</svg>} </svg>}
<div className="discordColorwayPreviewColorContainer"> <div className="discordColorwayPreviewColorContainer">
{!color.isGradient ? colors.map((colorItm) => <div {!color.isGradient ? colors.map(colorItm => <div
className="discordColorwayPreviewColor" className="discordColorwayPreviewColor"
style={{ style={{
backgroundColor: color[colorItm], backgroundColor: color[colorItm],
@ -609,9 +607,9 @@ export default function ({
{(showLabelsInSelectorGridView || viewMode === "list") && <Text className={"colorwayLabel" + ((showLabelsInSelectorGridView && viewMode === "grid") ? " labelInGrid" : "")}>{color.name}</Text>} {(showLabelsInSelectorGridView || viewMode === "list") && <Text className={"colorwayLabel" + ((showLabelsInSelectorGridView && viewMode === "grid") ? " labelInGrid" : "")}>{color.name}</Text>}
{settings.selectorType === "normal" && <div {settings.selectorType === "normal" && <div
className="colorwayInfoIconContainer" className="colorwayInfoIconContainer"
onClick={(e) => { onClick={e => {
e.stopPropagation(); e.stopPropagation();
openModal((props) => <ColorwayInfoModal openModal(props => <ColorwayInfoModal
modalProps={props} modalProps={props}
colorway={color} colorway={color}
loadUIProps={loadUI} loadUIProps={loadUI}
@ -733,7 +731,7 @@ export default function ({
{activeColorwayObject.id === color.name && activeColorwayObject.source === color.source && <circle cx="12" cy="12" r="5" className="radioIconForeground-3wH3aU" fill="currentColor" />} {activeColorwayObject.id === color.name && activeColorwayObject.source === color.source && <circle cx="12" cy="12" r="5" className="radioIconForeground-3wH3aU" fill="currentColor" />}
</svg>} </svg>}
<div className="discordColorwayPreviewColorContainer"> <div className="discordColorwayPreviewColorContainer">
{!color.isGradient ? colors.map((colorItm) => <div {!color.isGradient ? colors.map(colorItm => <div
className="discordColorwayPreviewColor" className="discordColorwayPreviewColor"
style={{ style={{
backgroundColor: color[colorItm], backgroundColor: color[colorItm],

View file

@ -26,8 +26,8 @@ const badVerbsReplacements = ["love", "eat", "deconstruct", "marry", "fart", "te
const badNounsReplacements = ["pasta", "kebab", "cake", "potato", "woman", "computer", "java", "hamburger", "monster truck", "osu!", "Ukrainian ball in search of gas game", "Anime", "Anime girl", "good", "keyboard", "NVIDIA RTX 3090 Graphics Card", "storm", "queen", "single", "umbrella", "mosque", "physics", "bath", "virus", "bathroom", "mom", "owner", "airport", "Avast Antivirus Free"]; const badNounsReplacements = ["pasta", "kebab", "cake", "potato", "woman", "computer", "java", "hamburger", "monster truck", "osu!", "Ukrainian ball in search of gas game", "Anime", "Anime girl", "good", "keyboard", "NVIDIA RTX 3090 Graphics Card", "storm", "queen", "single", "umbrella", "mosque", "physics", "bath", "virus", "bathroom", "mom", "owner", "airport", "Avast Antivirus Free"];
function replaceBadNouns(content) { function replaceBadNouns(content) {
// eslint-disable-next-line quotes
const regex = new RegExp('\\b(' + badNouns.join('|') + ')\\b', 'gi'); const regex = new RegExp("\\b(" + badNouns.join("|") + ")\\b", "gi");
return content.replace(regex, function (match) { return content.replace(regex, function (match) {
const randomIndex = Math.floor(Math.random() * badNounsReplacements.length); const randomIndex = Math.floor(Math.random() * badNounsReplacements.length);
@ -36,8 +36,8 @@ function replaceBadNouns(content) {
} }
function replaceBadVerbs(content) { function replaceBadVerbs(content) {
// eslint-disable-next-line quotes
const regex = new RegExp('\\b(' + badVerbs.join('|') + ')\\b', 'gi'); const regex = new RegExp("\\b(" + badVerbs.join("|") + ")\\b", "gi");
return content.replace(regex, function (match) { return content.replace(regex, function (match) {
const randomIndex = Math.floor(Math.random() * badVerbsReplacements.length); const randomIndex = Math.floor(Math.random() * badVerbsReplacements.length);

View file

@ -28,7 +28,7 @@ export default new (class NoteHandler {
}, },
flags: message.flags, flags: message.flags,
// Moment has a toString() function, this doesn't convert to '[object Object]'. // Moment has a toString() function, this doesn't convert to '[object Object]'.
// eslint-disable-next-line @typescript-eslint/no-base-to-string
timestamp: message.timestamp.toString(), timestamp: message.timestamp.toString(),
attachments: message.attachments as Discord.Attachment[], attachments: message.attachments as Discord.Attachment[],
embeds: message.embeds, embeds: message.embeds,

View file

@ -1,5 +1,5 @@
/* eslint-disable simple-header/header */ /* eslint-disable simple-header/header */
/* eslint-disable indent */
/* /*
* Vencord, a modification for Discord's desktop app * Vencord, a modification for Discord's desktop app
* Copyright (c) 2023 your mom lol * Copyright (c) 2023 your mom lol

View file

@ -4,7 +4,6 @@
* SPDX-License-Identifier: GPL-3.0-or-later * SPDX-License-Identifier: GPL-3.0-or-later
*/ */
/* eslint-disable indent */
import "./styles.css"; import "./styles.css";
import { generateId } from "@api/Commands"; import { generateId } from "@api/Commands";

View file

@ -165,11 +165,11 @@ const overrideObject = (obj, propertyName, overrideValue) => {
} }
let overriden = false; let overriden = false;
for (const key in obj) { for (const key in obj) {
// eslint-disable-next-line no-prototype-builtins
if (obj.hasOwnProperty(key) && key === propertyName) { if (obj.hasOwnProperty(key) && key === propertyName) {
obj[key] = overrideValue; obj[key] = overrideValue;
overriden = true; overriden = true;
// eslint-disable-next-line no-prototype-builtins
} else if (obj.hasOwnProperty(key) && typeof obj[key] === "object") { } else if (obj.hasOwnProperty(key) && typeof obj[key] === "object") {
if (overrideObject(obj[key], propertyName, overrideValue)) { if (overrideObject(obj[key], propertyName, overrideValue)) {
overriden = true; overriden = true;

View file

@ -17,8 +17,7 @@
*/ */
import { LazyComponent } from "@utils/react"; import { LazyComponent } from "@utils/react";
import { FilterFn, filters, lazyWebpackSearchHistory, waitFor } from "@webpack";
import { FilterFn, filters, lazyWebpackSearchHistory, waitFor } from "../webpack";
export function waitForComponent<T extends React.ComponentType<any> = React.ComponentType<any> & Record<string, any>>(name: string, filter: FilterFn | string | string[]): T { export function waitForComponent<T extends React.ComponentType<any> = React.ComponentType<any> & Record<string, any>>(name: string, filter: FilterFn | string | string[]): T {
if (IS_REPORTER) lazyWebpackSearchHistory.push(["waitForComponent", Array.isArray(filter) ? filter : [filter]]); if (IS_REPORTER) lazyWebpackSearchHistory.push(["waitForComponent", Array.isArray(filter) ? filter : [filter]]);

View file

@ -16,7 +16,8 @@
* 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 { filters, mapMangledModuleLazy, waitFor } from "../webpack"; import { filters, mapMangledModuleLazy, waitFor } from "@webpack";
import type * as t from "./types/menu"; import type * as t from "./types/menu";
export let Menu = {} as t.Menu; export let Menu = {} as t.Menu;

View file

@ -16,7 +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 { findByPropsLazy, waitFor } from "../webpack"; import { findByPropsLazy, waitFor } from "@webpack";
export let React: typeof import("react"); export let React: typeof import("react");
export let useState: typeof React.useState; export let useState: typeof React.useState;

View file

@ -16,9 +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 { findByCodeLazy, findByPropsLazy } from "@webpack";
import type * as Stores from "discord-types/stores"; import type * as Stores from "discord-types/stores";
import { findByCodeLazy, findByPropsLazy } from "../webpack";
import { waitForStore } from "./internal"; import { waitForStore } from "./internal";
import * as t from "./types/stores"; import * as t from "./types/stores";

View file

@ -17,9 +17,9 @@
*/ */
import { canonicalizeMatch } from "@utils/patches"; import { canonicalizeMatch } from "@utils/patches";
import { _resolveReady, filters, findByCodeLazy, findByPropsLazy, findLazy, mapMangledModuleLazy, waitFor } from "@webpack";
import type { Channel } from "discord-types/general"; import type { Channel } from "discord-types/general";
import { _resolveReady, filters, findByCodeLazy, findByPropsLazy, findLazy, mapMangledModuleLazy, waitFor } from "../webpack";
import type * as t from "./types/utils"; import type * as t from "./types/utils";
export let FluxDispatcher: t.FluxDispatcher; export let FluxDispatcher: t.FluxDispatcher;

View file

@ -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 { patches } from "@plugins";
import { WEBPACK_CHUNK } from "@utils/constants"; import { WEBPACK_CHUNK } from "@utils/constants";
import { Logger } from "@utils/Logger"; import { Logger } from "@utils/Logger";
import { canonicalizeReplacement } from "@utils/patches"; import { canonicalizeReplacement } from "@utils/patches";
@ -23,7 +24,6 @@ import { PatchReplacement } from "@utils/types";
import { WebpackInstance } from "discord-types/other"; import { WebpackInstance } from "discord-types/other";
import { traceFunction } from "../debug/Tracer"; import { traceFunction } from "../debug/Tracer";
import { patches } from "../plugins";
import { _initWebpack, beforeInitListeners, factoryListeners, moduleListeners, subscriptions, wreq } from "."; import { _initWebpack, beforeInitListeners, factoryListeners, moduleListeners, subscriptions, wreq } from ".";
const logger = new Logger("WebpackInterceptor", "#8caaee"); const logger = new Logger("WebpackInterceptor", "#8caaee");