Add .editorconfig; reformat project

This commit is contained in:
Vendicated 2022-09-16 22:59:34 +02:00
parent 5f62d2d3ec
commit 71a60a0359
No known key found for this signature in database
GPG Key ID: EC781ADFB93EFFA3
29 changed files with 42 additions and 28 deletions

12
.editorconfig Normal file

@ -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

3
.vscode/extensions.json vendored Normal file

@ -0,0 +1,3 @@
{
"recommendations": [ "EditorConfig.EditorConfig" ]
}

@ -1 +0,0 @@
{}

@ -9,4 +9,4 @@ import { waitFor } from "./webpack";
export let Components; export let Components;
waitFor("useState", () => setTimeout(() => import("./components").then(mod => Components = mod), 0)); waitFor("useState", () => setTimeout(() => import("./components").then(mod => Components = mod), 0));

@ -37,4 +37,4 @@ export default {
} }
return require(mod); return require(mod);
} }
}; };

@ -82,4 +82,4 @@ export function addClickListener(listener: ClickListener) {
export function removeClickListener(listener: ClickListener) { export function removeClickListener(listener: ClickListener) {
return listeners.delete(listener); return listeners.delete(listener);
} }

@ -1 +1 @@
export * as MessageEvents from "./MessageEvents"; export * as MessageEvents from "./MessageEvents";

@ -98,7 +98,7 @@ type ResolvePropDeep<T, P> = P extends "" ? T :
* whenever Unindent is toggled. Pass an empty string to get notified for all changes * 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 * @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. * 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}`)) * @example addSettingsListener("", (newValue, path) => console.log(`${path} is now ${newValue}`))
* addSettingsListener("plugins.Unindent.enabled", v => console.log("Unindent is now", v ? "enabled" : "disabled")) * addSettingsListener("plugins.Unindent.enabled", v => console.log("Unindent is now", v ? "enabled" : "disabled"))
*/ */

@ -68,4 +68,4 @@ export default class ErrorBoundary extends React.Component<React.PropsWithChildr
</Card> </Card>
); );
} }
} }

@ -115,4 +115,4 @@ export default ErrorBoundary.wrap(function Settings(props) {
} }
</Forms.FormSection > </Forms.FormSection >
); );
}); });

@ -1 +1 @@
export { default as Settings } from "./Settings"; export { default as Settings } from "./Settings";

2
src/globals.d.ts vendored

@ -14,4 +14,4 @@ declare global {
} }
} }
export { }; export { };

@ -23,7 +23,7 @@ class BrowserWindow extends electron.BrowserWindow {
Object.assign(BrowserWindow, electron.BrowserWindow); Object.assign(BrowserWindow, electron.BrowserWindow);
// esbuild may rename our BrowserWindow, which leads to it being excluded // esbuild may rename our BrowserWindow, which leads to it being excluded
// from getFocusedWindow(), so this is necessary // 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 }); Object.defineProperty(BrowserWindow, "name", { value: "BrowserWindow", configurable: true });
// Replace electrons exports with our custom BrowserWindow // Replace electrons exports with our custom BrowserWindow

@ -11,4 +11,4 @@ export default definePlugin({
replace: ".default=function(){}}" replace: ".default=function(){}}"
} }
}] }]
}); });

@ -13,4 +13,4 @@ export default definePlugin({
} }
} }
], ],
}); });

@ -56,4 +56,4 @@ export function stopPlugin(p: Plugin) {
return false; return false;
} }
} }
} }

@ -41,4 +41,4 @@ export default definePlugin({
document.removeEventListener("keydown", keydown); document.removeEventListener("keydown", keydown);
document.removeEventListener("keyup", keyup); document.removeEventListener("keyup", keyup);
} }
}); });

@ -37,4 +37,4 @@ export default definePlugin({
} }
}] }]
}); });

@ -44,4 +44,4 @@ export default definePlugin({
removePreSendListener(this.preSend); removePreSendListener(this.preSend);
removePreEditListener(this.preEdit); removePreEditListener(this.preEdit);
} }
}); });

@ -19,4 +19,4 @@ export default strEnum({
SET_SETTINGS: "VencordSetSettings", SET_SETTINGS: "VencordSetSettings",
OPEN_EXTERNAL: "VencordOpenExternal", OPEN_EXTERNAL: "VencordOpenExternal",
OPEN_PATH: "VencordOpenPath", OPEN_PATH: "VencordOpenPath",
} as const); } as const);

@ -1,2 +1,2 @@
export const WEBPACK_CHUNK = "webpackChunkdiscord_app"; export const WEBPACK_CHUNK = "webpackChunkdiscord_app";
export const REACT_GLOBAL = "Vencord.Webpack.Common.React"; export const REACT_GLOBAL = "Vencord.Webpack.Common.React";

@ -4,4 +4,4 @@ export function debounce<T extends Function>(func: T, delay = 300): T {
clearTimeout(timeout); clearTimeout(timeout);
timeout = setTimeout(() => { func(...args); }, delay); timeout = setTimeout(() => { func(...args); }, delay);
} as any; } as any;
} }

@ -30,4 +30,4 @@ export default class Logger {
public debug(...args: any[]) { public debug(...args: any[]) {
this._log("debug", "#eebebe", args); this._log("debug", "#eebebe", args);
} }
} }

@ -53,7 +53,7 @@ export function LazyComponent<T = any>(factory: () => React.ComponentType<T>) {
} }
/** /**
* 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 obj Object
* @param defaults Defaults * @param defaults Defaults
* @returns obj * @returns obj

@ -31,4 +31,4 @@ export function openModal(Component: React.ComponentType, modalProps: Record<str
*/ */
export function closeModal(key: string) { export function closeModal(key: string) {
modals.closeModal(key); modals.closeModal(key);
} }

@ -28,4 +28,4 @@ interface PluginDef {
patches?: Omit<Patch, "plugin">[]; patches?: Omit<Patch, "plugin">[];
dependencies?: string[], dependencies?: string[],
required?: boolean; required?: boolean;
} }

@ -33,4 +33,4 @@ waitFor(["ButtonLooks", "default"], m => {
waitFor(filters.byDisplayName("SwitchItem"), m => Switch = m.default); waitFor(filters.byDisplayName("SwitchItem"), m => Switch = m.default);
waitFor(filters.byDisplayName("Flex"), m => Flex = m.default); waitFor(filters.byDisplayName("Flex"), m => Flex = m.default);
waitFor(filters.byDisplayName("Card"), m => Card = m.default); waitFor(filters.byDisplayName("Card"), m => Card = m.default);
waitFor(filters.byDisplayName("Tooltip"), m => Tooltip = m.default); waitFor(filters.byDisplayName("Tooltip"), m => Tooltip = m.default);

@ -1,2 +1,2 @@
export * from "./webpack"; export * from "./webpack";
export * as Common from "./common"; export * as Common from "./common";

@ -112,7 +112,7 @@ export function search(...filters: Array<string | RegExp>) {
* Extract a specific module by id into its own Source File. This has no effect on * 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 * 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. * 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. * so putting breakpoints or similar will have no effect.
* @param id The id of the module to extract * @param id The id of the module to extract
*/ */
@ -130,4 +130,4 @@ ${mod.toString()}
`; `;
const extracted = (0, eval)(code); const extracted = (0, eval)(code);
return extracted as Function; return extracted as Function;
} }