feat(eslint): migrate (#596)

* eslint: migrate to defineConfig and add no-multiple-empty-lines rule

* chore: fix multiple empty lines
This commit is contained in:
prism 2025-12-25 19:27:36 +01:00 • committed by GitHub
parent 3c3e1b6ec8
commit 050dd1cdcc
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
135 changed files with 3 additions and 197 deletions

View file

@ -5,13 +5,14 @@
*/
import stylistic from "@stylistic/eslint-plugin";
import { defineConfig } from "eslint/config";
import react from "eslint-plugin-react";
import header from "eslint-plugin-simple-header";
import simpleImportSort from "eslint-plugin-simple-import-sort";
import unusedImports from "eslint-plugin-unused-imports";
import tseslint from "typescript-eslint";
export default tseslint.config(
export default defineConfig(
{ ignores: ["dist", "browser", "packages/vencord-types"] },
{
files: ["src/**/*.{tsx,ts,mts,mjs,js,jsx}", "eslint.config.mjs"],
@ -86,6 +87,7 @@ export default tseslint.config(
"@stylistic/object-curly-spacing": ["error", "always"],
"@stylistic/spaced-comment": ["error", "always", { "markers": ["!"] }],
"@stylistic/no-extra-semi": "error",
"no-multiple-empty-lines": ["error", { "max": 1, "maxBOF": 0, "maxEOF": 0 }],
// TS Rules
"@stylistic/function-call-spacing": ["error", "never"],

View file

@ -88,7 +88,6 @@ export const _handleCommand = function (cmd: VencordCommand, args: CommandArgume
}
} as never;
/**
* Prepare a Command Option for Discord by filling missing fields
* @param opt

View file

@ -106,7 +106,6 @@ export function removeMessagePreEditListener(listener: MessageEditListener) {
return editListeners.delete(listener);
}
// Message clicks
export type MessageClickListener = (message: Message, channel: Channel, event: MouseEvent) => void;

View file

@ -193,5 +193,3 @@ export const compileStyle = (style: Style) => {
return className ? classNameToSelector(className) : match;
});
};

View file

@ -98,7 +98,6 @@ export function BaseText<T extends TextTag = "div">(props: BaseTextProps<T>): Re
);
}
// #region Old compatibility
export const TextCompat: DiscordText = function TextCompat({ color, variant, ...restProps }) {

View file

@ -37,4 +37,3 @@ export function Heart(props: SVGProps<SVGSVGElement>) {
</svg>
);
}

View file

@ -285,7 +285,6 @@ export function PluginIcon(props: IconProps) {
);
}
export function PlusIcon(props: IconProps) {
return (
<Icon

View file

@ -21,7 +21,6 @@ import { ModalContent, ModalProps, ModalRoot, ModalSize, openModal } from "@util
import { IconComponent } from "@utils/types";
import { Clickable } from "@webpack/common";
const cl = classNameFactory("vc-plugin-ui-elements-");
export function UIElementsButton() {

View file

@ -45,4 +45,3 @@ export function BooleanSetting({ option, pluginSettings, definedSettings, id, on
</SettingsSection>
);
}

View file

@ -52,4 +52,3 @@ export function SliderSetting({ option, pluginSettings, definedSettings, id, onC
</SettingsSection>
);
}

View file

@ -352,7 +352,6 @@ export default function PluginSettings() {
}
}
// Code directly taken from supportHelper.tsx
const { totalStockPlugins, totalUserPlugins, enabledStockPlugins, enabledUserPlugins, enabledPlugins } = useMemo(() => {
const isApiPlugin = (plugin: string) => plugin.endsWith("API") || Plugins[plugin].required;
@ -451,7 +450,6 @@ export default function PluginSettings() {
: <ExcludedPluginsList search={search} />
}
<Divider className={Margins.top20} />
<HeadingTertiary className={classes(Margins.top20, Margins.bottom8)}>

View file

@ -13,7 +13,6 @@ import { Logger } from "@utils/Logger";
import definePlugin, { OptionType } from "@utils/types";
import { ApplicationAssetUtils, FluxDispatcher, showToast } from "@webpack/common";
interface ActivityAssets {
large_image?: string;
large_text?: string;
@ -50,8 +49,6 @@ interface MediaData {
isFinished?: boolean;
}
const settings = definePluginSettings({
serverUrl: {
description: "AudioBookShelf server URL (e.g., https://abs.example.com)",

View file

@ -61,7 +61,6 @@ export const settings = definePluginSettings({
}
});
// Save the join time of all users in a Map
type userJoinData = { channelId: string, time: number; guildId: string; };
const userJoinTimes = new Map<string, userJoinData>();

View file

@ -43,7 +43,6 @@ const DATASTORE_KEY = "bannersEverywhere";
const UserProfileStore = findStoreLazy("UserProfileStore");
export default definePlugin({
name: "BannersEverywhere",
description: "Displays banners in the member list ",

View file

@ -36,7 +36,6 @@ function DecodeIcon() {
);
}
function isValidUtf8String(str) {
try {
new TextDecoder("utf-8", { fatal: true }).decode(new Uint8Array(str.split("").map(char => char.charCodeAt(0))));
@ -64,7 +63,6 @@ function decodeBase64Strings(base64Strings) {
}).filter(decoded => decoded !== null);
}
function openDecodedBase64Modal(decodedContent) {
const key = openModal(props => (
<ErrorBoundary>

View file

@ -61,10 +61,6 @@ interface ChatBarCommandState {
getters: Set<() => HTMLElement | null>;
}
export const chatBarCommandStates = new Map<string, ChatBarCommandState>();
export const chatBarCommandStatesById = new Map<string, ChatBarCommandState>();
const CHATBAR_DATASET_KEY = "vcCommandPaletteId";
@ -150,12 +146,6 @@ export function wrapChatBarChildren(children: ReactNode): ReactNode {
return wrappedChildren;
}
interface ChatBarCommandBridgeProps {
element: ReactElement;
buttonKey: string;

View file

@ -55,7 +55,6 @@ import TooltipTab from "./tabs/TooltipTab";
import TypographyTab from "./tabs/TypographyTab";
import UserSummaryItemTab from "./tabs/UserSummaryItemTab";
const TABS = [
{ id: "accordion", label: "Accordion" },
{ id: "anchor", label: "Anchor" },

View file

@ -28,7 +28,6 @@ function getProfileColors(userId) {
}
}
function copyProfileColors(userId) {
const colors = getProfileColors(userId);

View file

@ -22,7 +22,6 @@ export function SetColorModal({ id, modalProps }: { id: string, modalProps: Moda
const [colorPickerColor, setColorPickerColor] = useState(initialColor);
// hex color code as an int (NOT rgb 0-255)
function setUserColor(color: number) {
setColorPickerColor(color);
}

View file

@ -21,7 +21,6 @@ import { SetColorModal } from "./SetColorModal";
export const DATASTORE_KEY = "equicord-customcolors";
export let colors: Record<string, string> = {};
(async () => {
colors = await get<Record<string, string>>(DATASTORE_KEY) || {};
})();

View file

@ -9,7 +9,6 @@ import { useState } from "@webpack/common";
import { makeDevBanner, settings, settingVariables } from ".";
export function FormatSetting(setValue) {
const { format } = settings.store;
const [state, setState] = useState(format ?? "{buildChannel} {buildNumber} ({buildHash}) | {equicordName} {equicordVersion} ({equicordHash})");

View file

@ -33,7 +33,6 @@ export const ClientIcon = (props: React.PropsWithChildren<SVGProps<SVGSVGElement
</svg>
);
export const DevBannerIcon = (props: React.PropsWithChildren<SVGProps<SVGSVGElement>>) => (
<svg
{...props}

View file

@ -21,7 +21,6 @@ import { JSX } from "react";
import plugins, { ExcludedPlugins } from "~plugins";
export function ChatPluginCard({ url, description }: { url: string, description: string; }) {
const pluginNameFromUrl = new URL(url).pathname.split("/")[2];

View file

@ -39,7 +39,6 @@ function restartPrompt(): Promise<boolean> {
});
}
export async function toggleEnabled(name: string) {
let restartNeeded = false;
function onRestartNeeded() {

View file

@ -28,7 +28,6 @@ import { Root } from "react-dom/client";
import ReplyNavigator from "./ReplyNavigator";
import styles from "./styles.css?managed";
export const jumper: any = findByPropsLazy("jumpToMessage");
const FindReplyIcon = () => {
return <svg viewBox="0 0 20 20" fill="currentColor" aria-hidden="true" width="18" height="18">
@ -87,7 +86,6 @@ const settings = definePluginSettings({
}
});
export default definePlugin({
name: "FindReply",
description: "Jumps to the earliest reply to a message in a channel (lets you follow past conversations more easily).",

View file

@ -71,7 +71,6 @@ const UserContextMenuPatch: NavContextMenuPatchCallback = (children, { channel,
);
};
export default definePlugin({
name: "FollowVoiceUser",
description: "Follow a friend in voice chat.",

View file

@ -278,7 +278,6 @@ function generatePoissonDiskPosition(
};
}
function calculateCanvasSize(userCount: number, avatarSize: number): { width: number, height: number; } {
const padding = 50;
const textSpace = 60;

View file

@ -12,7 +12,6 @@ import { Activity } from "@vencord/discord-types";
import { ActivityFlags, ActivityType } from "@vencord/discord-types/enums";
import { ApplicationAssetUtils, FluxDispatcher } from "@webpack/common";
const Native = VencordNative.pluginHelpers.GensokyoRadioRPC as PluginNative<typeof import("./native")>;
const applicationId = "1253772057926303804";

View file

@ -16,4 +16,3 @@ export function IconGhost({ fill }) {
</svg>
);
}

View file

@ -91,7 +91,6 @@ const addCollectionContextMenuPatch: NavContextMenuPatchCallback = (children, pr
}
};
export const settings = definePluginSettings({
itemPrefix: {
description: "The prefix for gif items",

View file

@ -27,7 +27,6 @@ export function getGifByTarget(url: string, target?: HTMLDivElement | null): Gif
return getGifByMessageAndUrl(url, message);
}
export function getGifByMessageAndTarget(target: HTMLDivElement, message: Message) {
const url = target.closest('[class*="imageWrapper"]')?.querySelector("video")?.src ?? target.closest('[class*="imageWrapper"]')?.querySelector("img")?.src;
@ -86,7 +85,6 @@ export function getGifByMessageAndUrl(url: string, message: Message): Gif | null
};
}
const attachment = message.attachments.find(a => cleanUrl(a.url) === cleanedUrl || a.proxy_url === cleanedUrl);
if (attachment) return {
id: uuidv4(settings.store.itemPrefix),

View file

@ -39,7 +39,6 @@ export async function exportCollections() {
return JSON.stringify({ collections }, null, 4);
}
export async function importCollections(data: string) {
try {
var parsed = JSON.parse(data);
@ -55,7 +54,6 @@ export async function importCollections(data: string) {
throw new Error("Invalid Collections");
}
export async function uploadGifCollections(showToast = true): Promise<void> {
if (IS_WEB || IS_EQUIBOP || IS_VESKTOP) {
const input = document.createElement("input");
@ -104,8 +102,6 @@ export async function uploadGifCollections(showToast = true): Promise<void> {
}
}
const toastSuccess = () => Toasts.show({
type: Toasts.Type.SUCCESS,
message: "Settings successfully imported.",

View file

@ -27,7 +27,6 @@ function getMessage(opts, other) {
return `${chosenGifUrl} ${ownerPing}`;
}
const settings = definePluginSettings({
pingOwnerChance: {
type: OptionType.BOOLEAN,

View file

@ -38,7 +38,6 @@ export const settings = definePluginSettings({
},
});
const getProfileThemeProps = findByCodeLazy(".getPreviewThemeColors", "primaryColor:");
const ProfilePopoutComponent = ErrorBoundary.wrap(

View file

@ -9,7 +9,6 @@ import { Guild } from "@vencord/discord-types";
import { findStoreLazy, proxyLazyWebpack } from "@webpack";
import { Flux, FluxDispatcher, GuildStore } from "@webpack/common";
export const HiddenServersStore = proxyLazyWebpack(() => {
const { Store } = Flux;

View file

@ -68,7 +68,6 @@ function restoreGuild(guild: Guild, SortedGuildStore: any) {
HiddenServersStore.removeHiddenGuild("folder-" + folder.folderId);
}
function GuildRow({ guild }) {
return (
<div key={guild.id} className={cl("row")}>

View file

@ -39,7 +39,6 @@ export const noteHandler = proxyLazyWebpack(() => {
};
}
public getNotes(notebook?: string): Record<string, HolyNotes.Note> {
return noteHandlerCache.get(notebook);
}
@ -93,7 +92,6 @@ export const noteHandler = proxyLazyWebpack(() => {
saveCacheToDataStore(from, lodash.omit(origNotebook, note.id) as unknown as HolyNotes.Note[]);
saveCacheToDataStore(to, newNoteBook as unknown as HolyNotes.Note[]);
Toasts.show({
id: Toasts.genId(),
message: `Successfully moved note from ${from} to ${to}.`,

View file

@ -6,7 +6,6 @@
import { findByProps } from "@webpack";
export default ({ error }: { error?: Error; } = {}) => {
const classes = findByProps("emptyResultsWrap");

View file

@ -49,7 +49,6 @@ export function NoteBookTabs({ tabs, selectedTabId, onSelectTab }: { tabs: strin
}
}, [tabs, selectedTabId]);
React.useEffect(() => {
handleResize();

View file

@ -63,8 +63,6 @@ const renderNotebook = ({
));
};
export const NoteModal = (props: ModalProps & { onClose: () => void; }) => {
const [sortType, setSortType] = React.useState(true);
const [searchInput, setSearch] = React.useState("");

View file

@ -65,7 +65,6 @@ function ToolBarHeader() {
);
}
export default definePlugin({
name: "HolyNotes",
description: "Holy Notes allows you to save messages",

View file

@ -27,7 +27,6 @@ import type { SVGProps } from "react";
// eslint-disable-next-line no-duplicate-imports
import { PropsWithChildren } from "react";
interface BaseIconProps extends IconProps {
viewBox: string;
}
@ -53,7 +52,6 @@ function Icon({ height = 24, width = 24, className, children, viewBox, ...svgPro
);
}
export function Husk(props: IconProps) {
return (
<Icon

View file

@ -65,7 +65,6 @@ const ContextMenuPatch: NavContextMenuPatchCallback = (children, { channel }: {
);
};
const settings = definePluginSettings({
permanentlyIgnoredUsers: {
type: OptionType.STRING,

View file

@ -44,7 +44,6 @@ function PopOverIcon() {
);
}
function Indicator() {
return (
<Tooltip text="This message has a hidden message! (InvisibleChat)">

View file

@ -13,7 +13,6 @@ import { Logger } from "@utils/Logger";
import definePlugin, { OptionType } from "@utils/types";
import { ApplicationAssetUtils, FluxDispatcher, showToast } from "@webpack/common";
interface ActivityAssets {
large_image?: string;
large_text?: string;

View file

@ -33,7 +33,6 @@ export function MultipleChoice({ modalProps, onSelect, choices }: MultipleChoice
action => action.label.toLowerCase().includes(queryEh.toLowerCase())
);
const visibleActions = filteredActions.slice(startIndex, startIndex + 20);
const totalActions = filteredActions.length;

View file

@ -48,7 +48,6 @@ export function SimpleTextInput({ modalProps, onSelect, placeholder, info }: Sim
);
}
export function openSimpleTextInput(placeholder?: string, info?: string): Promise<string> {
return new Promise(resolve => {
openModal(modalProps => (

View file

@ -84,7 +84,6 @@ export const settings = definePluginSettings({
}
});
export default definePlugin({
name: "KeyboardNavigation",
description: "Allows you to navigate the UI with a keyboard.",
@ -108,7 +107,6 @@ export default definePlugin({
document.removeEventListener("keydown", this.event);
},
event(e: KeyboardEvent) {
enum Modifiers {

View file

@ -20,7 +20,6 @@ import { definePluginSettings } from "@api/Settings";
import { EquicordDevs } from "@utils/constants";
import definePlugin, { makeRange, OptionType } from "@utils/types";
const settings = definePluginSettings({
limitTo: {
type: OptionType.SELECT,

View file

@ -144,7 +144,6 @@ function handleMessageLoad(data: any) {
currentFetch = null;
}
export default definePlugin({
name: "MessageFetchTimer",
description: "Shows how long it took to fetch messages for the current channel",

View file

@ -232,7 +232,6 @@ function LogsContent({ visibleMessages, canLoadMore, sortNewest, tab, reset, han
const LogsContentMemo = LazyComponent(() => React.memo(LogsContent));
function NoResults({ tab }: { tab: LogTabs; }) {
const generateSuggestedTabs = (tab: LogTabs) => {
switch (tab) {

View file

@ -52,7 +52,6 @@ export function useMessages(query: string, currentTab: LogTabs, sortNewest: bool
countMessagesByStatusIDB(status),
]);
if (isMounted) {
setMessages(messages);
setStatusTotal(statusTotal);
@ -92,11 +91,9 @@ export function useMessages(query: string, currentTab: LogTabs, sortNewest: bool
}, [debouncedQuery, sortNewest, numDisplayedMessages, currentTab, pending]);
return { messages, statusTotal, total, pending, reset: () => setPending(true) };
}
function getStatus(currentTab: LogTabs) {
switch (currentTab) {
case LogTabs.DELETED:

View file

@ -179,7 +179,6 @@ export async function addMessagesBulkIDB(messages: LoggedMessageJSON[], status?:
messages.forEach(message => cachedMessages.set(message.id, message));
}
export async function deleteMessageIDB(message_id: string) {
await db.delete("messages", message_id);

View file

@ -84,7 +84,6 @@ async function messageDeleteHandler(payload: MessageDeletePayload & { isBulk: bo
});
}
if (message == null || message.channel_id == null || !message.deleted) return;
// Flogger.log("ADDING MESSAGE (DELETED)", message);
if (payload.isBulk)

View file

@ -30,8 +30,6 @@ let imageCacheDir: string;
const getImageCacheDir = async () => imageCacheDir ?? await getDefaultNativeImageDir();
const getLogsDir = async () => logsDir ?? await getDefaultNativeDataDir();
export async function initDirs() {
const { logsDir: ld, imageCacheDir: icd } = await getSettings();
@ -88,14 +86,12 @@ export async function deleteFileNative(_event: IpcMainInvokeEvent, attachmentId:
await unlink(imagePath);
}
export async function writeLogs(_event: IpcMainInvokeEvent, contents: string) {
const logsDir = await getLogsDir();
writeFile(path.join(logsDir, LOGS_DATA_FILENAME), contents);
}
export async function getDefaultNativeImageDir(): Promise<string> {
return path.join(await getDefaultNativeDataDir(), "savedImages");
}

View file

@ -80,7 +80,6 @@ export interface MessageDeleteBulkPayload {
channelId: string;
}
export interface MessageUpdatePayload {
type: string;
guildId: string;

View file

@ -27,7 +27,6 @@ import { findLastIndex, getGuildIdByChannel } from "./misc";
export * from "./cleanUp";
export * from "./misc";
// stolen from mlv2
// https://github.com/1Lighty/BetterDiscordPlugins/blob/master/Plugins/MessageLoggerV2/MessageLoggerV2.plugin.js#L2367
interface Id { id: string, time: number; message?: LoggedMessageJSON; }
@ -126,7 +125,6 @@ export function shouldIgnore({ channelId, authorId, guildId, flags, bot, ghostPi
const isAuthorBlacklisted = blacklistedIds.includes(authorId);
const isChannelBlacklisted = blacklistedIds.includes(channelId);
const shouldIgnoreMutedGuilds = settings.store.ignoreMutedGuilds;
const shouldIgnoreMutedCategories = settings.store.ignoreMutedCategories;
const shouldIgnoreMutedChannels = settings.store.ignoreMutedChannels;

View file

@ -72,8 +72,6 @@ export const sortMessagesByDate = (timestampA: string, timestampB: string) => {
}
};
// stolen from mlv2
export function findLastIndex<T>(array: T[], predicate: (e: T, t: number, n: T[]) => boolean) {
let l = array.length;
@ -95,7 +93,6 @@ export const mapTimestamp = (m: any) => {
return m;
};
export const messageJsonToMessageClass = memoize((log: { message: LoggedMessageJSON; }) => {
// console.time("message populate");
if (!log?.message) return null;
@ -128,7 +125,6 @@ export const messageJsonToMessageClass = memoize((log: { message: LoggedMessageJ
return message;
});
export function parseJSON(json?: string | null) {
try {
return JSON.parse(json!);

View file

@ -22,7 +22,6 @@ import { ChannelStore, GuildStore } from "@webpack/common";
import { getGuildIdByChannel } from "./index";
import { memoize } from "./memoize";
const validIdSearchTypes = ["server", "guild", "channel", "in", "user", "from", "message", "has", "before", "after", "around", "near", "during"] as const;
type ValidIdSearchTypesUnion = typeof validIdSearchTypes[number];

View file

@ -79,13 +79,11 @@ export async function deleteImage(attachmentId: string): Promise<void> {
if (idbPath)
return await del(idbPath, ImageStore);
if (IS_WEB) return;
await Native.deleteFileNative(attachmentId);
}
async function downloadAttachmentWeb(attachemnt: LoggedAttachment, attempts = 0) {
if (!attachemnt?.url || !attachemnt?.id || !attachemnt?.fileExtension) {
Flogger.error("Invalid attachment", attachemnt);

View file

@ -105,4 +105,3 @@ export async function exportLogs() {
DiscordNative.fileManager.saveWithDialog(data, filename);
}
}

View file

@ -27,7 +27,6 @@ export const settings = definePluginSettings({
}
});
export function rand(min, max) {
return Math.floor(Math.random() * (max - min + 1)) + min;
}

View file

@ -20,7 +20,6 @@ export function IconContainer(props: { children: JSX.Element | JSX.Element[]; })
);
}
export function SearchIcon({ width, height, color }: { width: number, height: number, color: string; }) {
return (
<svg role="img" width={width} height={height} viewBox="0 0 24 24">

View file

@ -445,7 +445,6 @@ export const Packs = () => {
);
};
export function Header(props: { children: JSX.Element | JSX.Element[]; }) {
return (
<div className={cl("header")}>

View file

@ -168,7 +168,6 @@ function PickerContentRow({ rowIndex, grid1, grid2, grid3, channelId }: PickerCo
);
}
function HeaderCollapseIcon({ isExpanded }: { isExpanded: boolean; }) {
return (
<svg
@ -434,7 +433,6 @@ export function PickerContent({ stickerPacks, selectedStickerPackId, setSelected
);
}
export const PickerHeader = ({ onQueryChange }: PickerHeaderProps) => {
const [query, setQuery] = React.useState<string | undefined>();

View file

@ -16,7 +16,6 @@ const PendingReplyStore = findByPropsLazy("getPendingReply");
const MessageUtils = findByPropsLazy("sendMessage");
const DraftStore = findByPropsLazy("getDraft", "getState");
export const ffmpeg = new FFmpeg();
async function resizeImage(url: string) {

View file

@ -93,7 +93,6 @@ export default definePlugin({
},
],
PanelWrapper({ VencordOriginal, ...props }) {
const { showTidalControls, showTidalLyrics, showSpotifyLyrics, showSpotifyControls, LyricsPosition, showYoutubeMusicControls } = settings.store;
return (

View file

@ -215,7 +215,6 @@ function SpotifySeekBar() {
);
}
function AlbumContextMenu({ track }: { track: Track; }) {
const volume = useStateFromStores([SpotifyStore], () => SpotifyStore.volume);

View file

@ -24,7 +24,6 @@ export function NoteSvg() {
);
}
const getIndexes = (lyrics: SyncedLyric[], position: number, delay: number) => {
const posInSec = (position + delay) / 1000;
@ -82,7 +81,6 @@ export function useLyrics({ scroll = true }: { scroll?: boolean; } = {}) {
}
}, [currentLyrics]);
useEffect(() => {
if (currentLyrics && position != null) {
const [currentIndex, nextLyricIndex] = getIndexes(currentLyrics, position, LyricDelay);

View file

@ -19,7 +19,6 @@ interface Line {
endTimeMs: string;
}
export async function getLyricsSpotify(trackId: string): Promise<LyricsData | null> {
const resp = await fetch("https://spotify-lyrics-api-pi.vercel.app/?trackid=" + trackId);
if (!resp.ok) return null;

View file

@ -328,7 +328,6 @@ export function TidalPlayer() {
const isPlaying = useStateFromStores([TidalStore], () => TidalStore.isPlaying);
const [shouldHide, setShouldHide] = useState(false);
React.useEffect(() => {
setShouldHide(false);
if (!isPlaying) {
@ -351,4 +350,3 @@ export function TidalPlayer() {
</div>
);
}

View file

@ -347,7 +347,6 @@ export function YtmPlayer() {
const isPlaying = useStateFromStores([YoutubeMusicStore], () => YoutubeMusicStore.isPlaying);
const [shouldHide, setShouldHide] = useState(false);
React.useEffect(() => {
setShouldHide(false);
if (!isPlaying) {
@ -370,4 +369,3 @@ export function YtmPlayer() {
</div>
);
}

View file

@ -31,7 +31,6 @@ enum MediaType {
export type RepeatMode = "NONE" | "ONE" | "ALL";
export interface Song {
title: string;
artist: string;
@ -166,7 +165,6 @@ class YoutubeMusicSocket {
this.onChange({ position: 0, isPlaying: false, song: undefined });
});
this.socket.addEventListener("message", e => {
let message: Message;
try {
@ -225,7 +223,6 @@ export const YoutubeMusicStore = proxyLazyWebpack(() => {
VencordNative.native.openExternal(url);
}
set position(p: number) {
this.mPosition = p * 1000;
this.start = Date.now();

View file

@ -17,7 +17,6 @@ const ChannelTypes = findByPropsLazy("DM", "GUILD_TEXT", "PUBLIC_THREAD", "UNKNO
const ChannelTypesSets = findByPropsLazy("THREADS", "GUILD_TEXTUAL", "ALL_DMS");
const MessageTypes = findByPropsLazy("REPLY", "STAGE_RAISE_HAND", "CHANNEL_NAME_CHANGE");
export default definePlugin({
name: "NotificationTitle",
description: "Makes desktop notifications more informative",

View file

@ -17,7 +17,6 @@ const settings = definePluginSettings({
},
});
function replaceQuestionMarks(content: string): string {
const allQuestionMarks = content.split("").every(char => char === "?");

View file

@ -245,7 +245,6 @@ function ContextMenu() {
aria-label="Voice state modifier"
>
<Menu.MenuItem
id="servers"
label="Select Servers"
@ -715,7 +714,6 @@ function getChannels() {
}
}
if (settings.store.includeStates && !settings.store.avoidStates) {
if ((settings.store.deafen && !selfDeaf) || (!settings.store.deafen && selfDeaf)) return;
if ((settings.store.video && !selfVideo) || (!settings.store.video && selfVideo)) return;

View file

@ -375,5 +375,3 @@ export default definePlugin({
if (visEnd === "overlay") unmountOverlay();
}
});

View file

@ -56,4 +56,3 @@ export default definePlugin({
}
})
});

View file

@ -16,7 +16,6 @@ export async function getApplicationAsset(key: string): Promise<string> {
return (await ApplicationAssetUtils.fetchAssetIds("0", [key]))[0];
}
enum StatsDisplay {
messagesSentToday,
messagesSentAllTime,

View file

@ -63,7 +63,6 @@ export const settings = definePluginSettings({
function handleReactionEvent(event: FluxReactionEvent): void {
const { messageId, channelId, emoji } = event;
if (!messageId || !channelId || !emoji) return;
const isPhantom = isPhantomMessage(messageId);

View file

@ -68,7 +68,6 @@ export function getChannelDisplayInfo(channelId: string): { name: string; avatar
};
}
function getImageDimensions(dataUrl: string): Promise<{ width: number; height: number; }> {
return new Promise(resolve => {
const img = new Image();
@ -292,7 +291,6 @@ function doRecreatePhantomMessage(messageId: string, channelId: string, reaction
}, 50);
}
async function uploadAttachment(channelId: string, att: ScheduledAttachment): Promise<{ id: string; filename: string; uploaded_filename: string; } | null> {
return new Promise(resolve => {
const bytes = Uint8Array.from(atob(att.data), c => c.charCodeAt(0));

View file

@ -17,5 +17,4 @@ const kanadeSvg = () => {
);
};
export { kanadeSvg };

View file

@ -147,10 +147,7 @@ export default definePlugin({
}],
});
// text processing injection processor
function textProcessing(input: string) {
return `${input}\n${settings.store.textHeader ? settings.store.textHeader + " " : ""}${settings.store.name}`;
}

View file

@ -466,7 +466,6 @@ export default definePlugin({
</>
),
settings,
start() {

View file

@ -36,7 +36,6 @@ const settings = definePluginSettings({
setErrorMessage(null);
}
if (changed < value) {
setShouldShowWarning(true);
} else {
@ -46,7 +45,6 @@ const settings = definePluginSettings({
setValue(changed);
}
return (
<section>
<Heading>The amount of soundboard ids you want to save at a time (0 lets you save infinite)</Heading>

View file

@ -31,7 +31,6 @@ export interface SoundLogEntry extends SoundEvent {
users: { id: string, plays: number[]; }[];
}
export const cl = classNameFactory("vc-soundlog-");
export function getEmojiUrl(emoji) {

View file

@ -22,7 +22,6 @@ interface ActivityAssets {
small_text?: string;
}
interface ActivityButton {
label: string;
url: string;
@ -256,7 +255,6 @@ export default definePlugin({
const res = await fetch(`https://api.stats.fm/api/v1/users/${settings.store.username}/streams/current`);
if (!res.ok) throw `${res.status} ${res.statusText}`;
const json = await res.json() as SFMR;
if (!json.item) {
logger.error("Error from Stats.fm API", json);

View file

@ -124,7 +124,6 @@ const RenderStatusMenuItem = ({ status, update, disabled }: { status: DiscordSta
</div >;
};
const StatusSubMenuComponent = () => {
const premiumType = OverridePremiumTypeStore.getState().premiumTypeActual ?? 0;
const update = useForceUpdater();
@ -143,7 +142,6 @@ const StatusSubMenuComponent = () => {
</Menu.Menu>;
};
export default definePlugin({
name: "StatusPresets",
description: "Allows you to remember your statuses and set them later",

View file

@ -64,7 +64,6 @@ function blockedComponentRender(sticker) {
return <>{elements}</>;
}
const messageContextMenuPatch: NavContextMenuPatchCallback = (children, props) => {
const { favoriteableId, favoriteableType } = props ?? {};
@ -116,7 +115,6 @@ function toggleBlock(name) {
}
}
function isStickerBlocked(name) {
if (settings.store.blockedStickers === undefined || settings.store.blockedStickers == null) {
return;

View file

@ -292,7 +292,6 @@ function SubmitThemes() {
);
}
function ThemeLibrary() {
const [currentTab, setCurrentTab] = useState(TabItem.THEMES);

View file

@ -7,7 +7,6 @@
import { EquicordDevs } from "@utils/constants";
import definePlugin from "@utils/types";
export default definePlugin({
name: "TidalEmbeds",
description: "Embeds TIDAL songs to make them playable in Discord.",

View file

@ -437,8 +437,6 @@ async function handleGuildMessage(message: Message) {
const all = notifyFor.includes(message.channel_id);
const friend = settings.store.friendServerNotifications && RelationshipStore.isFriend(message.author.id);
if (!all && !friend) {
t = true;
const isMention: boolean = message.content.includes(`<@${UserStore.getCurrentUser().id}>`);
@ -554,7 +552,6 @@ async function relationshipAdd(user: User, type: Number) {
Notification.body = "You can now message them directly.";
Notification.onClick = () => switchChannels(null, user.id);
await showNotification(Notification);
} else if (type === RelationshipType.INCOMING_REQUEST) {

View file

@ -50,7 +50,6 @@ export default definePlugin({
}
});
async function onMessage(data: string) {
const json: TosuApi = JSON.parse(data);
// @ts-ignore

View file

@ -138,7 +138,6 @@ export default definePlugin({
timestamp: new Date()
};
if (settings.store.mode !== 2) {
addLogEntry(logEntry, oldChannelId);
addLogEntry(logEntry, channelId);

View file

@ -11,7 +11,6 @@ import { ChannelStore, FluxDispatcher, Menu } from "@webpack/common";
import { SetWallpaperModal } from "./modal";
const addWallpaperMenu = (channelId?: string, guildId?: string) => {
const setWallpaper = (url?: string) => {
FluxDispatcher.dispatch({

View file

@ -16,7 +16,6 @@ import { ChannelContextPatch, GuildContextPatch, UserContextPatch } from "./comp
import { GlobalDefaultComponent, TipsComponent } from "./components/util";
import { WallpaperFreeStore } from "./store";
export const settings = definePluginSettings({
globalDefault: {
description: "Set a global default wallpaper for all channels.",

View file

@ -49,7 +49,6 @@ function isItemAllowed(item: (CustomEmoji | UnicodeEmoji)) {
return cache_allowedList.some(emoji => emoji.name === item.name);
}
function itemAlreadyInList(item: ContextMenuEmoji) {
return cache_allowedList.some(emoji => emoji.name === item.name);
}

View file

@ -88,7 +88,6 @@ const stringifyPolicy = (policy: PolicyMap): string =>
.map(directive => directive.flat().join(" "))
.join("; ");
const patchCsp = (headers: PolicyMap) => {
const reportOnlyHeader = findHeader(headers, "content-security-policy-report-only");
if (reportOnlyHeader)

View file

@ -61,7 +61,6 @@ async function fetchUpdates() {
if (hash === gitHash)
return false;
const asset = data.assets.find(a => a.name === ASAR_FILE);
PendingUpdate = asset.browser_download_url;

View file

@ -203,7 +203,6 @@ export default definePlugin({
return <Component {...badge} />;
}, { noop: true }),
getBadgeMouseEventHandlers(badge: ProfileBadge & BadgeUserArgs) {
const handlers = {} as Record<string, (e: React.MouseEvent) => void>;

Some files were not shown because too many files have changed in this diff Show more