diff --git a/.eslintrc.json b/.eslintrc.json new file mode 100644 index 0000000..2d51750 --- /dev/null +++ b/.eslintrc.json @@ -0,0 +1,28 @@ +{ + "root": true, + "parser": "@typescript-eslint/parser", + "ignorePatterns": ["dist"], + "rules": { + "quotes": [ + "error", + "double", + { + "avoidEscape": true + } + ], + "jsx-quotes": ["error", "prefer-double"], + "no-mixed-spaces-and-tabs": "error", + "indent": ["error", 4, { "SwitchCase": 1 }], + "arrow-parens": ["error", "as-needed"], + "eol-last": ["error", "always"], + "func-call-spacing": ["error", "never"], + "no-multi-spaces": "error", + "no-trailing-spaces": "error", + "no-whitespace-before-property": "error", + "semi": ["error", "always"], + "semi-style": ["error", "last"], + "space-in-parens": ["error", "never"], + "block-spacing": ["error", "always"], + "object-curly-spacing": ["error", "always"] + } +} diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml new file mode 100644 index 0000000..715e59b --- /dev/null +++ b/.github/workflows/lint.yml @@ -0,0 +1,22 @@ +name: lint +on: + push: + branches: + - main + pull_request: + branches: + - main +jobs: + build: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + + - name: Install pnpm + run: npm i -g pnpm + + - name: Install deps + run: pnpm i + + - name: Run ESLint + run: pnpm run lint diff --git a/build.mjs b/build.mjs index 5b0b1c0..b59ebef 100755 --- a/build.mjs +++ b/build.mjs @@ -13,7 +13,7 @@ const watch = process.argv.includes("--watch"); * @type {esbuild.Plugin} */ const makeAllPackagesExternalPlugin = { - name: 'make-all-packages-external', + name: "make-all-packages-external", setup(build) { let filter = /^[^.\/]|^\.[^.\/]|^\.\.[^\/]/; // Must not start with "/" or "./" or "../" build.onResolve({ filter }, args => ({ path: args.path, external: true })); diff --git a/package.json b/package.json index 320b0c2..aaaac8a 100644 --- a/package.json +++ b/package.json @@ -3,8 +3,11 @@ "@types/node": "^18.7.13", "@types/react": "^18.0.17", "@types/yazl": "^2.4.2", + "@typescript-eslint/parser": "^5.39.0", "electron": "^20.1.0", "esbuild": "^0.15.5", + "eslint": "^8.24.0", + "typescript": "^4.8.4", "yazl": "^2.5.1" }, "dependencies": { @@ -17,6 +20,8 @@ "build": "node build.mjs", "watch": "node build.mjs --watch", "inject": "node scripts/patcher/install.js", - "uninject": "node scripts/patcher/uninstall.js" + "uninject": "node scripts/patcher/uninstall.js", + "lint": "eslint . --ext .js,.jsx,.ts,.tsx", + "lint:fix": "pnpm lint --fix" } } diff --git a/scripts/patcher/common.js b/scripts/patcher/common.js index 94cb383..f750601 100644 --- a/scripts/patcher/common.js +++ b/scripts/patcher/common.js @@ -63,8 +63,8 @@ function question(question) { terminal: false, }); - return new Promise((resolve) => { - rl.question(question, (answer) => { + return new Promise(resolve => { + rl.question(question, answer => { rl.close(); resolve(answer); }); @@ -72,7 +72,7 @@ function question(question) { } async function getMenuItem(installations) { - let menuItems = installations.map((info) => ({ + let menuItems = installations.map(info => ({ title: info.patched ? "[MODIFIED] " + info.location : info.location, info, })); @@ -122,9 +122,9 @@ function getWindowsDirs() { const appDirs = fs .readdirSync(location, { withFileTypes: true }) - .filter((file) => file.isDirectory()) - .filter((file) => file.name.startsWith("app-")) - .map((file) => path.join(location, file.name)); + .filter(file => file.isDirectory()) + .filter(file => file.name.startsWith("app-")) + .map(file => path.join(location, file.name)); let versions = []; let patched = false; @@ -169,9 +169,9 @@ function getDarwinDirs() { const appDirs = fs .readdirSync(location, { withFileTypes: true }) - .filter((file) => file.isDirectory()) - .filter((file) => file.name.startsWith("Resources")) - .map((file) => path.join(location, file.name)); + .filter(file => file.isDirectory()) + .filter(file => file.name.startsWith("Resources")) + .map(file => path.join(location, file.name)); let versions = []; let patched = false; @@ -239,13 +239,13 @@ function getLinuxDirs() { } else { appDirs = fs .readdirSync(location, { withFileTypes: true }) - .filter((file) => file.isDirectory()) + .filter(file => file.isDirectory()) .filter( - (file) => + file => file.name.startsWith("app-") || file.name === "resources" ) - .map((file) => path.join(location, file.name)); + .map(file => path.join(location, file.name)); } let versions = []; diff --git a/scripts/patcher/install.js b/scripts/patcher/install.js index f423ce9..c9babc8 100644 --- a/scripts/patcher/install.js +++ b/scripts/patcher/install.js @@ -96,7 +96,7 @@ async function install(installations) { const requiredFiles = ["index.js", "package.json"]; - if (requiredFiles.every((f) => fs.existsSync(path.join(dir, f)))) { + if (requiredFiles.every(f => fs.existsSync(path.join(dir, f)))) { console.log( "Successfully patched", version.name diff --git a/src/Vencord.ts b/src/Vencord.ts index 716cb83..5a0bb71 100644 --- a/src/Vencord.ts +++ b/src/Vencord.ts @@ -12,7 +12,7 @@ export { Settings }; import "./webpack/patchWebpack"; import "./utils/quickCss"; -import { checkForUpdates, UpdateLogger } from './utils/updater'; +import { checkForUpdates, UpdateLogger } from "./utils/updater"; import { onceReady } from "./webpack"; import { Router } from "./webpack/common"; diff --git a/src/VencordNative.ts b/src/VencordNative.ts index 494e9ff..2ffea69 100644 --- a/src/VencordNative.ts +++ b/src/VencordNative.ts @@ -1,5 +1,5 @@ -import IPC_EVENTS from './utils/IpcEvents'; -import { IpcRenderer, ipcRenderer } from 'electron'; +import IPC_EVENTS from "./utils/IpcEvents"; +import { IpcRenderer, ipcRenderer } from "electron"; function assertEventAllowed(event: string) { if (!(event in IPC_EVENTS)) throw new Error(`Event ${event} not allowed.`); diff --git a/src/api/Commands.ts b/src/api/Commands.ts index 3a3e88c..10503e9 100644 --- a/src/api/Commands.ts +++ b/src/api/Commands.ts @@ -1,5 +1,5 @@ import { Channel, Guild } from "discord-types/general"; -import { waitFor } from '../webpack'; +import { waitFor } from "../webpack"; export function _init(cmds: Command[]) { try { diff --git a/src/api/MessageEvents.ts b/src/api/MessageEvents.ts index 534012f..0b3be65 100644 --- a/src/api/MessageEvents.ts +++ b/src/api/MessageEvents.ts @@ -1,5 +1,5 @@ -import type { Message, Channel } from 'discord-types/general'; -import Logger from '../utils/logger'; +import type { Message, Channel } from "discord-types/general"; +import Logger from "../utils/logger"; const MessageEventsLogger = new Logger("MessageEvents", "#e5c890"); diff --git a/src/api/settings.ts b/src/api/settings.ts index 3328323..51bec1d 100644 --- a/src/api/settings.ts +++ b/src/api/settings.ts @@ -1,7 +1,7 @@ import plugins from "plugins"; import IpcEvents from "../utils/IpcEvents"; import { React } from "../webpack/common"; -import { mergeDefaults } from '../utils/misc'; +import { mergeDefaults } from "../utils/misc"; interface Settings { notifyAboutUpdates: boolean; diff --git a/src/components/ErrorBoundary.tsx b/src/components/ErrorBoundary.tsx index 21a3155..83f35e6 100644 --- a/src/components/ErrorBoundary.tsx +++ b/src/components/ErrorBoundary.tsx @@ -15,7 +15,7 @@ const NO_ERROR = {}; export default class ErrorBoundary extends React.Component> { static wrap(Component: React.ComponentType): (props: T) => React.ReactElement { - return (props) => ( + return props => ( diff --git a/src/components/Flex.tsx b/src/components/Flex.tsx index 881c7c2..eda3b33 100644 --- a/src/components/Flex.tsx +++ b/src/components/Flex.tsx @@ -1,5 +1,4 @@ -import { PropsWithChildren } from "react"; -import type { React } from '../webpack/common'; +import type { React } from "../webpack/common"; export function Flex(props: React.PropsWithChildren<{ flexDirection?: React.CSSProperties["flexDirection"]; diff --git a/src/components/Settings.tsx b/src/components/Settings.tsx index 0678745..56c97cb 100644 --- a/src/components/Settings.tsx +++ b/src/components/Settings.tsx @@ -1,14 +1,14 @@ import { classes, humanFriendlyJoin, useAwaiter } from "../utils/misc"; -import Plugins from 'plugins'; +import Plugins from "plugins"; import { useSettings } from "../api/settings"; import IpcEvents from "../utils/IpcEvents"; import { Button, Switch, Forms, React, Margins, Toasts, Alerts, Parser } from "../webpack/common"; import ErrorBoundary from "./ErrorBoundary"; import { startPlugin } from "../plugins"; -import { stopPlugin } from '../plugins/index'; -import { Flex } from './Flex'; -import { ChangeList } from '../utils/ChangeList'; +import { stopPlugin } from "../plugins/index"; +import { Flex } from "./Flex"; +import { ChangeList } from "../utils/ChangeList"; function showErrorToast(message: string) { Toasts.show({ @@ -35,7 +35,7 @@ export default ErrorBoundary.wrap(function Settings() {
{changes.map((s, i) => ( <> {i > 0 && ", "} - {Parser.parse('`' + s + '`')} + {Parser.parse("`" + s + "`")} ))}
@@ -69,7 +69,7 @@ export default ErrorBoundary.wrap(function Settings() { - SettingsDir: {settingsDir} + SettingsDir: {settingsDir} {!IS_WEB && diff --git a/src/components/Updater.tsx b/src/components/Updater.tsx index 1ed56d6..5e7e84f 100644 --- a/src/components/Updater.tsx +++ b/src/components/Updater.tsx @@ -1,8 +1,8 @@ import gitHash from "git-hash"; -import { changes, checkForUpdates, getRepo, rebuild, update, UpdateLogger, updateError, isOutdated, isNewer } from '../utils/updater'; -import { React, Forms, Button, Margins, Alerts, Card, Parser, Toasts } from '../webpack/common'; +import { changes, checkForUpdates, getRepo, rebuild, update, UpdateLogger, updateError, isOutdated, isNewer } from "../utils/updater"; +import { React, Forms, Button, Margins, Alerts, Card, Parser, Toasts } from "../webpack/common"; import { Flex } from "./Flex"; -import { classes, useAwaiter } from '../utils/misc'; +import { classes, useAwaiter } from "../utils/misc"; import { Link } from "./Link"; import ErrorBoundary from "./ErrorBoundary"; import { ErrorCard } from "./ErrorCard"; diff --git a/src/ipcMain/index.ts b/src/ipcMain/index.ts index 22f05fd..61b631e 100644 --- a/src/ipcMain/index.ts +++ b/src/ipcMain/index.ts @@ -1,9 +1,9 @@ import { app, BrowserWindow, desktopCapturer, ipcMain, shell } from "electron"; import { mkdirSync, readFileSync, watch } from "fs"; import { open, readFile, writeFile } from "fs/promises"; -import { join } from 'path'; +import { join } from "path"; import { debounce } from "../utils/debounce"; -import IpcEvents from '../utils/IpcEvents'; +import IpcEvents from "../utils/IpcEvents"; import "./updater"; @@ -47,7 +47,7 @@ ipcMain.handle(IpcEvents.OPEN_EXTERNAL, (_, url) => { ipcMain.handle(IpcEvents.GET_QUICK_CSS, () => readCss()); ipcMain.handle(IpcEvents.GET_SETTINGS_DIR, () => SETTINGS_DIR); -ipcMain.on(IpcEvents.GET_SETTINGS, (e) => e.returnValue = readSettings()); +ipcMain.on(IpcEvents.GET_SETTINGS, e => e.returnValue = readSettings()); let settingsWriteQueue = Promise.resolve(); ipcMain.handle(IpcEvents.SET_SETTINGS, (_, s) => { diff --git a/src/ipcMain/updater.ts b/src/ipcMain/updater.ts index cd1fc6c..0801e0b 100644 --- a/src/ipcMain/updater.ts +++ b/src/ipcMain/updater.ts @@ -1,10 +1,10 @@ -import { ipcMain } from 'electron'; +import { ipcMain } from "electron"; import { promisify } from "util"; import IpcEvents from "../utils/IpcEvents"; -import { execFile as cpExecFile } from 'child_process'; -import { join } from 'path'; -import { createReadStream } from 'fs'; -import { createHash } from 'crypto'; +import { execFile as cpExecFile } from "child_process"; +import { join } from "path"; +import { createReadStream } from "fs"; +import { createHash } from "crypto"; const VENCORD_SRC_DIR = join(__dirname, ".."); @@ -64,7 +64,7 @@ async function getRepo() { async function calculateGitChanges() { await git("fetch"); - const res = await git("log", `HEAD...origin/main`, "--pretty=format:%an/%h/%s"); + const res = await git("log", "HEAD...origin/main", "--pretty=format:%an/%h/%s"); const commits = res.stdout.trim(); return commits ? commits.split("\n").map(line => { diff --git a/src/patcher.ts b/src/patcher.ts index 2e13197..bb7aab2 100644 --- a/src/patcher.ts +++ b/src/patcher.ts @@ -1,7 +1,7 @@ import electron, { app, BrowserWindowConstructorOptions } from "electron"; import installExt, { REACT_DEVELOPER_TOOLS } from "electron-devtools-installer"; import { join } from "path"; -import { initIpc } from './ipcMain'; +import { initIpc } from "./ipcMain"; console.log("[Vencord] Starting up..."); @@ -49,7 +49,7 @@ process.env.DATA_DIR = join(app.getPath("userData"), "..", "Vencord"); electron.app.whenReady().then(() => { installExt(REACT_DEVELOPER_TOOLS) .then(() => console.info("Installed React DevTools")) - .catch((err) => console.error("Failed to install React DevTools", err)); + .catch(err => console.error("Failed to install React DevTools", err)); // Remove CSP electron.session.defaultSession.webRequest.onHeadersReceived(({ responseHeaders, url }, cb) => { diff --git a/src/plugins/STFU.ts b/src/plugins/STFU.ts index ff7094c..abe9bd6 100644 --- a/src/plugins/STFU.ts +++ b/src/plugins/STFU.ts @@ -1,5 +1,5 @@ import definePlugin from "../utils/types"; -import { Devs } from '../utils/constants'; +import { Devs } from "../utils/constants"; export default definePlugin({ name: "STFU", diff --git a/src/plugins/apiCommands.ts b/src/plugins/apiCommands.ts index 7c02dd9..449f804 100644 --- a/src/plugins/apiCommands.ts +++ b/src/plugins/apiCommands.ts @@ -7,7 +7,7 @@ export default definePlugin({ description: "Api required by anything that uses commands", patches: [ { - find: `"giphy","tenor"`, + find: '"giphy","tenor"', replacement: [ { // Matches BUILT_IN_COMMANDS. This is not exported so this is diff --git a/src/plugins/apiNotices.ts b/src/plugins/apiNotices.ts index 1b4f115..e9b4678 100644 --- a/src/plugins/apiNotices.ts +++ b/src/plugins/apiNotices.ts @@ -13,7 +13,7 @@ export default definePlugin({ { match: /;(.{1,2}=null;)(?=.{0,50}updateNotice)/g, replace: - ';if(Vencord.Api.Notices.currentNotice)return !1;$1' + ";if(Vencord.Api.Notices.currentNotice)return !1;$1" }, { match: /(?<=NOTICE_DISMISS:function.+?){(?=if\(null==(.+?)\))/, diff --git a/src/plugins/clearURLs/index.ts b/src/plugins/clearURLs/index.ts index abdeefd..c9bf2ed 100644 --- a/src/plugins/clearURLs/index.ts +++ b/src/plugins/clearURLs/index.ts @@ -90,7 +90,7 @@ export default definePlugin({ } // Check all universal rules - this.universalRules.forEach((rule) => { + this.universalRules.forEach(rule => { url.searchParams.forEach((_value, param, parent) => { this.removeParam(rule, param, parent); }); @@ -99,7 +99,7 @@ export default definePlugin({ // Check rules for each hosts that match this.hostRules.forEach((regex, hostRuleName) => { if (!regex.test(url.hostname)) return; - this.rulesByHost.get(hostRuleName).forEach((rule) => { + this.rulesByHost.get(hostRuleName).forEach(rule => { url.searchParams.forEach((_value, param, parent) => { this.removeParam(rule, param, parent); }); @@ -114,7 +114,7 @@ export default definePlugin({ if (msg.content.match(/http(s)?:\/\//)) { msg.content = msg.content.replace( /(https?:\/\/[^\s<]+[^<.,:;"'>)|\]\s])/g, - (match) => this.replacer(match) + match => this.replacer(match) ); } }, diff --git a/src/plugins/clickableRoleDot.ts b/src/plugins/clickableRoleDot.ts index 3fc4bef..61e6b28 100644 --- a/src/plugins/clickableRoleDot.ts +++ b/src/plugins/clickableRoleDot.ts @@ -1,6 +1,6 @@ import { Devs } from "../utils/constants"; import definePlugin from "../utils/types"; -import { Toasts } from '../webpack/common'; +import { Toasts } from "../webpack/common"; export default definePlugin({ name: "ClickableRoleDot", diff --git a/src/plugins/experiments.ts b/src/plugins/experiments.ts index 37a59c7..b441a76 100644 --- a/src/plugins/experiments.ts +++ b/src/plugins/experiments.ts @@ -1,5 +1,5 @@ import { Devs } from "../utils/constants"; -import definePlugin from '../utils/types'; +import definePlugin from "../utils/types"; export default definePlugin({ name: "Experiments", diff --git a/src/plugins/lenny.ts b/src/plugins/lenny.ts index 901febc..1877752 100644 --- a/src/plugins/lenny.ts +++ b/src/plugins/lenny.ts @@ -12,7 +12,7 @@ export default definePlugin({ name: "lenny", description: "Sends a lenny face", options: [OptionalMessageOption], - execute: (opts) => ({ + execute: opts => ({ content: findOption(opts, "message", "") + " ( ͡° ͜ʖ ͡°)" }), }, diff --git a/src/plugins/messageActions.ts b/src/plugins/messageActions.ts index 4df3853..a017f54 100644 --- a/src/plugins/messageActions.ts +++ b/src/plugins/messageActions.ts @@ -1,4 +1,4 @@ -import { addClickListener, removeClickListener } from '../api/MessageEvents'; +import { addClickListener, removeClickListener } from "../api/MessageEvents"; import { Devs } from "../utils/constants"; import definePlugin from "../utils/types"; import { find, findByProps } from "../webpack"; diff --git a/src/plugins/muteNewGuild.ts b/src/plugins/muteNewGuild.ts index 8b9a33d..428060f 100644 --- a/src/plugins/muteNewGuild.ts +++ b/src/plugins/muteNewGuild.ts @@ -1,5 +1,5 @@ import definePlugin from "../utils/types"; -import {Devs} from "../utils/constants"; +import { Devs } from "../utils/constants"; export default definePlugin({ name: "MuteNewGuild", @@ -14,4 +14,4 @@ export default definePlugin({ } } ], -}) +}); diff --git a/src/plugins/nitroBypass.ts b/src/plugins/nitroBypass.ts index d96ff0d..c5d69a4 100644 --- a/src/plugins/nitroBypass.ts +++ b/src/plugins/nitroBypass.ts @@ -1,8 +1,8 @@ -import { addPreSendListener, addPreEditListener, SendListener, removePreSendListener, removePreEditListener } from '../api/MessageEvents'; +import { addPreSendListener, addPreEditListener, removePreSendListener, removePreEditListener } from "../api/MessageEvents"; import { findByProps } from "../webpack"; import definePlugin from "../utils/types"; -import { Devs } from '../utils/constants'; -import { UserStore } from '../webpack/common'; +import { Devs } from "../utils/constants"; +import { UserStore } from "../webpack/common"; export default definePlugin({ name: "NitroBypass", @@ -11,7 +11,7 @@ export default definePlugin({ dependencies: ["MessageEventsAPI"], patches: [ { - find: `canUseAnimatedEmojis:function`, + find: "canUseAnimatedEmojis:function", replacement: [ "canUseAnimatedEmojis", "canUseEmojisEverywhere", @@ -58,8 +58,8 @@ export default definePlugin({ if (!emoji.require_colons) continue; if (emoji.guildId === guildId && !emoji.animated) continue; - const emojiString = `<${emoji.animated ? 'a' : ''}:${emoji.originalName || emoji.name}:${emoji.id}>`; - const url = emoji.url.replace(/\?size=[0-9]+/, `?size=48`); + const emojiString = `<${emoji.animated ? "a" : ""}:${emoji.originalName || emoji.name}:${emoji.id}>`; + const url = emoji.url.replace(/\?size=[0-9]+/, "?size=48"); messageObj.content = messageObj.content.replace(emojiString, (match, offset, origStr) => { return `${getWordBoundary(origStr, offset - 1)}${url}${getWordBoundary(origStr, offset + match.length)}`; }); @@ -74,7 +74,7 @@ export default definePlugin({ if (emoji == null || (emoji.guildId === guildId && !emoji.animated)) continue; if (!emoji.require_colons) continue; - const url = emoji.url.replace(/\?size=[0-9]+/, `?size=48`); + const url = emoji.url.replace(/\?size=[0-9]+/, "?size=48"); messageObj.content = messageObj.content.replace(emojiStr, (match, offset, origStr) => { return `${getWordBoundary(origStr, offset - 1)}${url}${getWordBoundary(origStr, offset + match.length)}`; }); diff --git a/src/plugins/noReplyMention.ts b/src/plugins/noReplyMention.ts index 4d4ceb3..b736c26 100644 --- a/src/plugins/noReplyMention.ts +++ b/src/plugins/noReplyMention.ts @@ -16,4 +16,4 @@ export default definePlugin({ } } ] -}) +}); diff --git a/src/plugins/noTrack.ts b/src/plugins/noTrack.ts index 13b52f8..b82c83f 100644 --- a/src/plugins/noTrack.ts +++ b/src/plugins/noTrack.ts @@ -1,5 +1,5 @@ import definePlugin from "../utils/types"; -import { Devs } from '../utils/constants'; +import { Devs } from "../utils/constants"; export default definePlugin({ name: "NoTrack", diff --git a/src/plugins/randomiseFileNames.ts b/src/plugins/randomiseFileNames.ts index 3826711..02166bf 100644 --- a/src/plugins/randomiseFileNames.ts +++ b/src/plugins/randomiseFileNames.ts @@ -23,6 +23,6 @@ export default definePlugin({ { length: 7 }, () => chars[Math.floor(Math.random() * chars.length)] ).join(""); - return rand + (file.lastIndexOf(".") > -1 ? file.slice(file.lastIndexOf(".")) : "") + return rand + (file.lastIndexOf(".") > -1 ? file.slice(file.lastIndexOf(".")) : ""); }, }); diff --git a/src/plugins/settings.ts b/src/plugins/settings.ts index 7125823..afd3fd3 100644 --- a/src/plugins/settings.ts +++ b/src/plugins/settings.ts @@ -1,6 +1,6 @@ import definePlugin from "../utils/types"; import gitHash from "git-hash"; -import { Devs } from '../utils/constants'; +import { Devs } from "../utils/constants"; export default definePlugin({ name: "Settings", @@ -30,8 +30,8 @@ export default definePlugin({ match: /\{section:(.{1,2})\.ID\.HEADER,\s*label:(.{1,2})\..{1,2}\.Messages\.ACTIVITY_SETTINGS\}/, replace: (m, mod) => `{section:${mod}.ID.HEADER,label:"Vencord"},` + - `{section:"VencordSetting",label:"Vencord",element:Vencord.Components.Settings},` + - `{section:"VencordUpdater",label:"Updater",element:Vencord.Components.Updater,predicate:()=>!IS_WEB},` + + '{section:"VencordSetting",label:"Vencord",element:Vencord.Components.Settings},' + + '{section:"VencordUpdater",label:"Updater",element:Vencord.Components.Updater,predicate:()=>!IS_WEB},' + `{section:${mod}.ID.DIVIDER},${m}` } diff --git a/src/plugins/silentTyping.ts b/src/plugins/silentTyping.ts index 56ef30d..9bba0ca 100644 --- a/src/plugins/silentTyping.ts +++ b/src/plugins/silentTyping.ts @@ -1,5 +1,5 @@ -import definePlugin from '../utils/types'; -import { Devs } from '../utils/constants'; +import definePlugin from "../utils/types"; +import { Devs } from "../utils/constants"; export default definePlugin({ name: "SilentTyping", diff --git a/src/plugins/unindent.ts b/src/plugins/unindent.ts index 608020f..f6eca1d 100644 --- a/src/plugins/unindent.ts +++ b/src/plugins/unindent.ts @@ -1,6 +1,6 @@ import definePlugin from "../utils/types"; -import { addPreSendListener, addPreEditListener, MessageObject, removePreSendListener, removePreEditListener } from '../api/MessageEvents'; -import { Devs } from '../utils/constants'; +import { addPreSendListener, addPreEditListener, MessageObject, removePreSendListener, removePreEditListener } from "../api/MessageEvents"; +import { Devs } from "../utils/constants"; export default definePlugin({ name: "Unindent", diff --git a/src/plugins/viewIcons.tsx b/src/plugins/viewIcons.tsx index 2ac0ab1..2b404f2 100644 --- a/src/plugins/viewIcons.tsx +++ b/src/plugins/viewIcons.tsx @@ -1,6 +1,6 @@ import { Devs } from "../utils/constants"; import IpcEvents from "../utils/IpcEvents"; -import definePlugin from '../utils/types'; +import definePlugin from "../utils/types"; const OPEN_URL = "Vencord.Plugins.plugins.ViewIcons.openImage("; export default definePlugin({ diff --git a/src/preload.ts b/src/preload.ts index c716d2c..9578bf6 100644 --- a/src/preload.ts +++ b/src/preload.ts @@ -2,7 +2,7 @@ import electron, { contextBridge, webFrame } from "electron"; import { readFileSync } from "fs"; import { join } from "path"; import VencordNative from "./VencordNative"; -import { ipcRenderer } from 'electron'; +import { ipcRenderer } from "electron"; import IpcEvents from "./utils/IpcEvents"; if (electron.desktopCapturer === void 0) { @@ -15,7 +15,7 @@ if (electron.desktopCapturer === void 0) { require.cache[electronPath]!.exports = { ...electron, desktopCapturer: { - getSources: (opts) => ipcRenderer.invoke(IpcEvents.GET_DESKTOP_CAPTURE_SOURCES, opts) + getSources: opts => ipcRenderer.invoke(IpcEvents.GET_DESKTOP_CAPTURE_SOURCES, opts) } }; } diff --git a/src/utils/modal.tsx b/src/utils/modal.tsx index 05baa8e..f59c26c 100644 --- a/src/utils/modal.tsx +++ b/src/utils/modal.tsx @@ -18,11 +18,11 @@ let modalId = 1337; */ export function openModal(Component: React.ComponentType, modalProps: Record) { let key = `Vencord${modalId++}`; - modals.openModal(props => + modals.openModal(props => ( - , { modalKey: key }); + ), { modalKey: key }); return key; }; diff --git a/src/utils/updater.ts b/src/utils/updater.ts index f02af3a..c2c050e 100644 --- a/src/utils/updater.ts +++ b/src/utils/updater.ts @@ -1,7 +1,7 @@ import IpcEvents from "./IpcEvents"; import Logger from "./logger"; -import { IpcRes } from './types'; -import gitHash from 'git-hash'; +import { IpcRes } from "./types"; +import gitHash from "git-hash"; export const UpdateLogger = new Logger("Updater", "white"); export let isOutdated = false; diff --git a/src/webpack/common.tsx b/src/webpack/common.tsx index 82d812b..1a15489 100644 --- a/src/webpack/common.tsx +++ b/src/webpack/common.tsx @@ -1,8 +1,8 @@ -import { waitFor, filters, _resolveReady } from './webpack'; +import { waitFor, filters, _resolveReady } from "./webpack"; import type Components from "discord-types/components"; import type Stores from "discord-types/stores"; import type Other from "discord-types/other"; -import { lazyWebpack } from '../utils/misc'; +import { lazyWebpack } from "../utils/misc"; export const Margins = lazyWebpack(filters.byProps(["marginTop20"])); diff --git a/src/webpack/patchWebpack.ts b/src/webpack/patchWebpack.ts index 469b930..dd7b537 100644 --- a/src/webpack/patchWebpack.ts +++ b/src/webpack/patchWebpack.ts @@ -1,4 +1,4 @@ -import { WEBPACK_CHUNK } from '../utils/constants'; +import { WEBPACK_CHUNK } from "../utils/constants"; import Logger from "../utils/logger"; import { _initWebpack } from "."; @@ -8,7 +8,7 @@ const logger = new Logger("WebpackInterceptor", "#8caaee"); Object.defineProperty(window, WEBPACK_CHUNK, { get: () => webpackChunk, - set: (v) => { + set: v => { if (v?.push !== Array.prototype.push) { logger.info(`Patching ${WEBPACK_CHUNK}.push`); _initWebpack(v); @@ -141,7 +141,7 @@ function patchPush() { handlePush.original = window[WEBPACK_CHUNK].push; Object.defineProperty(window[WEBPACK_CHUNK], "push", { get: () => handlePush, - set: (v) => (handlePush.original = v), + set: v => (handlePush.original = v), configurable: true }); } diff --git a/src/webpack/webpack.ts b/src/webpack/webpack.ts index 15104bb..f1fea46 100644 --- a/src/webpack/webpack.ts +++ b/src/webpack/webpack.ts @@ -36,7 +36,7 @@ export type CallbackFn = (mod: any) => void; export function _initWebpack(instance: typeof window.webpackChunkdiscord_app) { if (cache !== void 0) throw "no."; - wreq = instance.push([[Symbol()], {}, (r) => r]); + wreq = instance.push([[Symbol()], {}, r => r]); cache = wreq.c; instance.pop(); }