From 71a60a0359eda13221f2314c0b1c33c86f240fd3 Mon Sep 17 00:00:00 2001 From: Vendicated Date: Fri, 16 Sep 2022 22:59:34 +0200 Subject: [PATCH] Add .editorconfig; reformat project --- .editorconfig | 12 ++++++++++++ .vscode/extensions.json | 3 +++ .vscode/settings.json | 1 - src/Vencord.ts | 2 +- src/VencordNative.ts | 2 +- src/api/MessageEvents.ts | 2 +- src/api/index.ts | 2 +- src/api/settings.ts | 2 +- src/components/ErrorBoundary.tsx | 2 +- src/components/Settings.tsx | 2 +- src/components/index.ts | 2 +- src/globals.d.ts | 2 +- src/patcher.ts | 2 +- src/plugins/STFU.ts | 2 +- src/plugins/banger.ts | 2 +- src/plugins/index.ts | 2 +- src/plugins/messageActions.ts | 2 +- src/plugins/settings.ts | 2 +- src/plugins/unindent.ts | 2 +- src/utils/IpcEvents.ts | 2 +- src/utils/constants.ts | 2 +- src/utils/debounce.ts | 2 +- src/utils/logger.ts | 2 +- src/utils/misc.tsx | 2 +- src/utils/modal.tsx | 2 +- src/utils/types.ts | 2 +- src/webpack/common.ts | 2 +- src/webpack/index.ts | 2 +- src/webpack/webpack.ts | 4 ++-- 29 files changed, 42 insertions(+), 28 deletions(-) create mode 100644 .editorconfig create mode 100644 .vscode/extensions.json delete mode 100644 .vscode/settings.json diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 00000000..c1e2c643 --- /dev/null +++ b/.editorconfig @@ -0,0 +1,12 @@ +# EditorConfig is awesome: https://EditorConfig.org + +# top-most EditorConfig file +root = true + +[*] +indent_style = space +indent_size = 4 +end_of_line = lf +charset = utf-8 +trim_trailing_whitespace = true +insert_final_newline = true diff --git a/.vscode/extensions.json b/.vscode/extensions.json new file mode 100644 index 00000000..3df8d339 --- /dev/null +++ b/.vscode/extensions.json @@ -0,0 +1,3 @@ +{ + "recommendations": [ "EditorConfig.EditorConfig" ] +} diff --git a/.vscode/settings.json b/.vscode/settings.json deleted file mode 100644 index 9e26dfee..00000000 --- a/.vscode/settings.json +++ /dev/null @@ -1 +0,0 @@ -{} \ No newline at end of file diff --git a/src/Vencord.ts b/src/Vencord.ts index b0ff5407..3a405b2e 100644 --- a/src/Vencord.ts +++ b/src/Vencord.ts @@ -9,4 +9,4 @@ import { waitFor } from "./webpack"; export let Components; -waitFor("useState", () => setTimeout(() => import("./components").then(mod => Components = mod), 0)); \ No newline at end of file +waitFor("useState", () => setTimeout(() => import("./components").then(mod => Components = mod), 0)); diff --git a/src/VencordNative.ts b/src/VencordNative.ts index e5ccaaa5..33bb869d 100644 --- a/src/VencordNative.ts +++ b/src/VencordNative.ts @@ -37,4 +37,4 @@ export default { } return require(mod); } -}; \ No newline at end of file +}; diff --git a/src/api/MessageEvents.ts b/src/api/MessageEvents.ts index b6230b2c..534012ff 100644 --- a/src/api/MessageEvents.ts +++ b/src/api/MessageEvents.ts @@ -82,4 +82,4 @@ export function addClickListener(listener: ClickListener) { export function removeClickListener(listener: ClickListener) { return listeners.delete(listener); -} \ No newline at end of file +} diff --git a/src/api/index.ts b/src/api/index.ts index 61724187..0633ee8a 100644 --- a/src/api/index.ts +++ b/src/api/index.ts @@ -1 +1 @@ -export * as MessageEvents from "./MessageEvents"; \ No newline at end of file +export * as MessageEvents from "./MessageEvents"; diff --git a/src/api/settings.ts b/src/api/settings.ts index e6d92737..4ee94d32 100644 --- a/src/api/settings.ts +++ b/src/api/settings.ts @@ -98,7 +98,7 @@ type ResolvePropDeep = P extends "" ? T : * whenever Unindent is toggled. Pass an empty string to get notified for all changes * @param onUpdate Callback function whenever a setting matching path is updated. It gets passed the new value and the path * to the updated setting. This path will be the same as your path argument, unless it was an empty string. - * + * * @example addSettingsListener("", (newValue, path) => console.log(`${path} is now ${newValue}`)) * addSettingsListener("plugins.Unindent.enabled", v => console.log("Unindent is now", v ? "enabled" : "disabled")) */ diff --git a/src/components/ErrorBoundary.tsx b/src/components/ErrorBoundary.tsx index ae528385..e9039474 100644 --- a/src/components/ErrorBoundary.tsx +++ b/src/components/ErrorBoundary.tsx @@ -68,4 +68,4 @@ export default class ErrorBoundary extends React.Component ); } -} \ No newline at end of file +} diff --git a/src/components/Settings.tsx b/src/components/Settings.tsx index 1e13d7fe..d5b655bb 100644 --- a/src/components/Settings.tsx +++ b/src/components/Settings.tsx @@ -115,4 +115,4 @@ export default ErrorBoundary.wrap(function Settings(props) { } ); -}); \ No newline at end of file +}); diff --git a/src/components/index.ts b/src/components/index.ts index b999c271..bf87b3e6 100644 --- a/src/components/index.ts +++ b/src/components/index.ts @@ -1 +1 @@ -export { default as Settings } from "./Settings"; \ No newline at end of file +export { default as Settings } from "./Settings"; diff --git a/src/globals.d.ts b/src/globals.d.ts index 131ec4eb..92ca95cc 100644 --- a/src/globals.d.ts +++ b/src/globals.d.ts @@ -14,4 +14,4 @@ declare global { } } -export { }; \ No newline at end of file +export { }; diff --git a/src/patcher.ts b/src/patcher.ts index 8cd86788..8e28fd10 100644 --- a/src/patcher.ts +++ b/src/patcher.ts @@ -23,7 +23,7 @@ class BrowserWindow extends electron.BrowserWindow { Object.assign(BrowserWindow, electron.BrowserWindow); // esbuild may rename our BrowserWindow, which leads to it being excluded // from getFocusedWindow(), so this is necessary -// https://github.com/discord/electron/blob/13-x-y/lib/browser/api/browser-window.ts#L60-L62 +// https://github.com/discord/electron/blob/13-x-y/lib/browser/api/browser-window.ts#L60-L62 Object.defineProperty(BrowserWindow, "name", { value: "BrowserWindow", configurable: true }); // Replace electrons exports with our custom BrowserWindow diff --git a/src/plugins/STFU.ts b/src/plugins/STFU.ts index 38b20641..ee9c90f3 100644 --- a/src/plugins/STFU.ts +++ b/src/plugins/STFU.ts @@ -11,4 +11,4 @@ export default definePlugin({ replace: ".default=function(){}}" } }] -}); \ No newline at end of file +}); diff --git a/src/plugins/banger.ts b/src/plugins/banger.ts index 1109f91c..d87ef996 100644 --- a/src/plugins/banger.ts +++ b/src/plugins/banger.ts @@ -13,4 +13,4 @@ export default definePlugin({ } } ], -}); \ No newline at end of file +}); diff --git a/src/plugins/index.ts b/src/plugins/index.ts index 1a6c93d2..14906566 100644 --- a/src/plugins/index.ts +++ b/src/plugins/index.ts @@ -56,4 +56,4 @@ export function stopPlugin(p: Plugin) { return false; } } -} \ No newline at end of file +} diff --git a/src/plugins/messageActions.ts b/src/plugins/messageActions.ts index 2972cbc8..42f2e2f7 100644 --- a/src/plugins/messageActions.ts +++ b/src/plugins/messageActions.ts @@ -41,4 +41,4 @@ export default definePlugin({ document.removeEventListener("keydown", keydown); document.removeEventListener("keyup", keyup); } -}); \ No newline at end of file +}); diff --git a/src/plugins/settings.ts b/src/plugins/settings.ts index 63c36d6b..7d6af2dd 100644 --- a/src/plugins/settings.ts +++ b/src/plugins/settings.ts @@ -37,4 +37,4 @@ export default definePlugin({ } }] -}); \ No newline at end of file +}); diff --git a/src/plugins/unindent.ts b/src/plugins/unindent.ts index 1f63f69b..3cb34f34 100644 --- a/src/plugins/unindent.ts +++ b/src/plugins/unindent.ts @@ -44,4 +44,4 @@ export default definePlugin({ removePreSendListener(this.preSend); removePreEditListener(this.preEdit); } -}); \ No newline at end of file +}); diff --git a/src/utils/IpcEvents.ts b/src/utils/IpcEvents.ts index 70ba5020..6061fcb0 100644 --- a/src/utils/IpcEvents.ts +++ b/src/utils/IpcEvents.ts @@ -19,4 +19,4 @@ export default strEnum({ SET_SETTINGS: "VencordSetSettings", OPEN_EXTERNAL: "VencordOpenExternal", OPEN_PATH: "VencordOpenPath", -} as const); \ No newline at end of file +} as const); diff --git a/src/utils/constants.ts b/src/utils/constants.ts index 92f78f50..3d60e296 100644 --- a/src/utils/constants.ts +++ b/src/utils/constants.ts @@ -1,2 +1,2 @@ export const WEBPACK_CHUNK = "webpackChunkdiscord_app"; -export const REACT_GLOBAL = "Vencord.Webpack.Common.React"; \ No newline at end of file +export const REACT_GLOBAL = "Vencord.Webpack.Common.React"; diff --git a/src/utils/debounce.ts b/src/utils/debounce.ts index 6a1756b2..f001b7ba 100644 --- a/src/utils/debounce.ts +++ b/src/utils/debounce.ts @@ -4,4 +4,4 @@ export function debounce(func: T, delay = 300): T { clearTimeout(timeout); timeout = setTimeout(() => { func(...args); }, delay); } as any; -} \ No newline at end of file +} diff --git a/src/utils/logger.ts b/src/utils/logger.ts index be32f2b3..0dda4bb8 100644 --- a/src/utils/logger.ts +++ b/src/utils/logger.ts @@ -30,4 +30,4 @@ export default class Logger { public debug(...args: any[]) { this._log("debug", "#eebebe", args); } -} \ No newline at end of file +} diff --git a/src/utils/misc.tsx b/src/utils/misc.tsx index 9d4c001f..8a9afe11 100644 --- a/src/utils/misc.tsx +++ b/src/utils/misc.tsx @@ -53,7 +53,7 @@ export function LazyComponent(factory: () => React.ComponentType) { } /** - * Recursively merges defaults into an object and returns the same object + * Recursively merges defaults into an object and returns the same object * @param obj Object * @param defaults Defaults * @returns obj diff --git a/src/utils/modal.tsx b/src/utils/modal.tsx index 63821f34..e5723a81 100644 --- a/src/utils/modal.tsx +++ b/src/utils/modal.tsx @@ -31,4 +31,4 @@ export function openModal(Component: React.ComponentType, modalProps: Record[]; dependencies?: string[], required?: boolean; -} \ No newline at end of file +} diff --git a/src/webpack/common.ts b/src/webpack/common.ts index e45d2caa..525a678e 100644 --- a/src/webpack/common.ts +++ b/src/webpack/common.ts @@ -33,4 +33,4 @@ waitFor(["ButtonLooks", "default"], m => { waitFor(filters.byDisplayName("SwitchItem"), m => Switch = m.default); waitFor(filters.byDisplayName("Flex"), m => Flex = m.default); waitFor(filters.byDisplayName("Card"), m => Card = m.default); -waitFor(filters.byDisplayName("Tooltip"), m => Tooltip = m.default); \ No newline at end of file +waitFor(filters.byDisplayName("Tooltip"), m => Tooltip = m.default); diff --git a/src/webpack/index.ts b/src/webpack/index.ts index a388dbdd..6f4ea125 100644 --- a/src/webpack/index.ts +++ b/src/webpack/index.ts @@ -1,2 +1,2 @@ export * from "./webpack"; -export * as Common from "./common"; \ No newline at end of file +export * as Common from "./common"; diff --git a/src/webpack/webpack.ts b/src/webpack/webpack.ts index 73ea1a32..27306de5 100644 --- a/src/webpack/webpack.ts +++ b/src/webpack/webpack.ts @@ -112,7 +112,7 @@ export function search(...filters: Array) { * Extract a specific module by id into its own Source File. This has no effect on * the code, it is only useful to be able to look at a specific module without having * to view a massive file. extract then returns the extracted module so you can jump to it. - * As mentioned above, note that this extracted module is not actually used, + * As mentioned above, note that this extracted module is not actually used, * so putting breakpoints or similar will have no effect. * @param id The id of the module to extract */ @@ -130,4 +130,4 @@ ${mod.toString()} `; const extracted = (0, eval)(code); return extracted as Function; -} \ No newline at end of file +}