Add more eslint rules
This commit is contained in:
parent
0109381a4f
commit
dea34503ef
13 changed files with 33 additions and 21 deletions
|
@ -23,6 +23,18 @@
|
||||||
"semi-style": ["error", "last"],
|
"semi-style": ["error", "last"],
|
||||||
"space-in-parens": ["error", "never"],
|
"space-in-parens": ["error", "never"],
|
||||||
"block-spacing": ["error", "always"],
|
"block-spacing": ["error", "always"],
|
||||||
"object-curly-spacing": ["error", "always"]
|
"object-curly-spacing": ["error", "always"],
|
||||||
|
"eqeqeq": ["error", "always", { "null": "ignore" }],
|
||||||
|
"spaced-comment": ["error", "always"],
|
||||||
|
"yoda": "error",
|
||||||
|
"prefer-destructuring": ["error", { "object": true, "array": false }],
|
||||||
|
"operator-assignment": ["error", "always"],
|
||||||
|
"no-useless-computed-key": "error",
|
||||||
|
"no-unneeded-ternary": ["error", { "defaultAssignment": false }],
|
||||||
|
"no-invalid-regexp": "error",
|
||||||
|
"no-constant-condition": ["error", { "checkLoops": false }],
|
||||||
|
"no-duplicate-imports": "error",
|
||||||
|
"no-extra-semi": "error",
|
||||||
|
"consistent-return": ["error", { "treatUndefinedAsUnspecified": true }]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
import IpcEvents from "../src/utils/IpcEvents";
|
import IpcEvents from "../src/utils/IpcEvents";
|
||||||
|
|
||||||
// Discord deletes this so need to store in variable
|
// Discord deletes this so need to store in variable
|
||||||
var localStorage = window.localStorage;
|
var { localStorage } = window;
|
||||||
|
|
||||||
const handlers = {
|
const handlers = {
|
||||||
[IpcEvents.GET_REPO]: () => "", // TODO
|
[IpcEvents.GET_REPO]: () => "", // TODO
|
||||||
|
|
|
@ -43,7 +43,7 @@ async function install(installations) {
|
||||||
// Attempt to give flatpak perms
|
// Attempt to give flatpak perms
|
||||||
if (selected.isFlatpak) {
|
if (selected.isFlatpak) {
|
||||||
try {
|
try {
|
||||||
const branch = selected.branch;
|
const { branch } = selected;
|
||||||
const cwd = process.cwd();
|
const cwd = process.cwd();
|
||||||
const globalCmd = `flatpak override ${branch} --filesystem=${cwd}`;
|
const globalCmd = `flatpak override ${branch} --filesystem=${cwd}`;
|
||||||
const userCmd = `flatpak override --user ${branch} --filesystem=${cwd}`;
|
const userCmd = `flatpak override --user ${branch} --filesystem=${cwd}`;
|
||||||
|
|
|
@ -82,6 +82,8 @@ export function unregisterCommand(name: string) {
|
||||||
|
|
||||||
BUILT_IN.splice(idx, 1);
|
BUILT_IN.splice(idx, 1);
|
||||||
delete commands[name];
|
delete commands[name];
|
||||||
|
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface CommandContext {
|
export interface CommandContext {
|
||||||
|
|
|
@ -42,7 +42,7 @@ function withDispatcher(dispatcher: React.Dispatch<React.SetStateAction<boolean>
|
||||||
dispatcher(false);
|
dispatcher(false);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
};
|
}
|
||||||
|
|
||||||
interface CommonProps {
|
interface CommonProps {
|
||||||
repo: string;
|
repo: string;
|
||||||
|
|
|
@ -26,7 +26,7 @@ export default definePlugin({
|
||||||
],
|
],
|
||||||
|
|
||||||
altify(props: any) {
|
altify(props: any) {
|
||||||
if (props.alt !== "GIF") return;
|
if (props.alt !== "GIF") return props.alt;
|
||||||
|
|
||||||
let url: string = props.original || props.src;
|
let url: string = props.original || props.src;
|
||||||
try {
|
try {
|
||||||
|
|
|
@ -55,7 +55,7 @@ export default definePlugin({
|
||||||
}
|
}
|
||||||
|
|
||||||
this.preSend = addPreSendListener((_, messageObj) => {
|
this.preSend = addPreSendListener((_, messageObj) => {
|
||||||
const guildId = this.guildId;
|
const { guildId } = this;
|
||||||
for (const emoji of messageObj.validNonShortcutEmojis) {
|
for (const emoji of messageObj.validNonShortcutEmojis) {
|
||||||
if (!emoji.require_colons) continue;
|
if (!emoji.require_colons) continue;
|
||||||
if (emoji.guildId === guildId && !emoji.animated) continue;
|
if (emoji.guildId === guildId && !emoji.animated) continue;
|
||||||
|
@ -69,7 +69,7 @@ export default definePlugin({
|
||||||
});
|
});
|
||||||
|
|
||||||
this.preEdit = addPreEditListener((_, __, messageObj) => {
|
this.preEdit = addPreEditListener((_, __, messageObj) => {
|
||||||
const guildId = this.guildId;
|
const { guildId } = this;
|
||||||
|
|
||||||
for (const [emojiStr, _, emojiId] of messageObj.content.matchAll(/(?<!\\)<a?:(\w+):(\d+)>/ig)) {
|
for (const [emojiStr, _, emojiId] of messageObj.content.matchAll(/(?<!\\)<a?:(\w+):(\d+)>/ig)) {
|
||||||
const emoji = getCustomEmojiById(emojiId);
|
const emoji = getCustomEmojiById(emojiId);
|
||||||
|
|
|
@ -15,21 +15,21 @@ export default definePlugin({
|
||||||
|
|
||||||
start() {
|
start() {
|
||||||
Dispatcher.subscribe("DELETE_PENDING_REPLY", onDeletePendingReply);
|
Dispatcher.subscribe("DELETE_PENDING_REPLY", onDeletePendingReply);
|
||||||
document.addEventListener("keydown", keydown);
|
document.addEventListener("keydown", onKeydown);
|
||||||
},
|
},
|
||||||
|
|
||||||
stop() {
|
stop() {
|
||||||
Dispatcher.unsubscribe("DELETE_PENDING_REPLY", onDeletePendingReply);
|
Dispatcher.unsubscribe("DELETE_PENDING_REPLY", onDeletePendingReply);
|
||||||
document.removeEventListener("keydown", keydown);
|
document.removeEventListener("keydown", onKeydown);
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
let idx = -1;
|
let idx = -1;
|
||||||
const onDeletePendingReply = () => {
|
function onDeletePendingReply() {
|
||||||
idx = -1;
|
idx = -1;
|
||||||
};
|
}
|
||||||
|
|
||||||
const keydown = e => {
|
function onKeydown(e: KeyboardEvent) {
|
||||||
if (
|
if (
|
||||||
(!e.ctrlKey && !e.metaKey) ||
|
(!e.ctrlKey && !e.metaKey) ||
|
||||||
(e.key !== "ArrowUp" && e.key !== "ArrowDown")
|
(e.key !== "ArrowUp" && e.key !== "ArrowDown")
|
||||||
|
@ -46,7 +46,7 @@ const keydown = e => {
|
||||||
|
|
||||||
if (idx > messages.length) idx = messages.length;
|
if (idx > messages.length) idx = messages.length;
|
||||||
if (idx < 0) {
|
if (idx < 0) {
|
||||||
return Dispatcher.dispatch({
|
return void Dispatcher.dispatch({
|
||||||
type: "DELETE_PENDING_REPLY",
|
type: "DELETE_PENDING_REPLY",
|
||||||
channelId,
|
channelId,
|
||||||
});
|
});
|
||||||
|
@ -58,4 +58,4 @@ const keydown = e => {
|
||||||
message: messages[idx],
|
message: messages[idx],
|
||||||
showMentionToggle: channel.guild_id !== null,
|
showMentionToggle: channel.guild_id !== null,
|
||||||
});
|
});
|
||||||
};
|
}
|
||||||
|
|
|
@ -1,8 +1,7 @@
|
||||||
import electron, { contextBridge, webFrame } from "electron";
|
import electron, { contextBridge, webFrame, ipcRenderer } from "electron";
|
||||||
import { readFileSync } from "fs";
|
import { readFileSync } from "fs";
|
||||||
import { join } from "path";
|
import { join } from "path";
|
||||||
import VencordNative from "./VencordNative";
|
import VencordNative from "./VencordNative";
|
||||||
import { ipcRenderer } from "electron";
|
|
||||||
import IpcEvents from "./utils/IpcEvents";
|
import IpcEvents from "./utils/IpcEvents";
|
||||||
|
|
||||||
if (electron.desktopCapturer === void 0) {
|
if (electron.desktopCapturer === void 0) {
|
||||||
|
|
|
@ -7,7 +7,7 @@ function strEnum<T extends Record<string, string>>(obj: T): T {
|
||||||
for (const key in obj) {
|
for (const key in obj) {
|
||||||
o[key] = obj[key] as any;
|
o[key] = obj[key] as any;
|
||||||
o[obj[key]] = key as any;
|
o[obj[key]] = key as any;
|
||||||
};
|
}
|
||||||
return Object.freeze(o);
|
return Object.freeze(o);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -56,7 +56,7 @@ export function useAwaiter<T>(factory: () => Promise<T>, fallbackValue: T | null
|
||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
return [state.value, state.error, state.pending];
|
return [state.value, state.error, state.pending];
|
||||||
};
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A lazy component. The factory method is called on first render. For example useful
|
* A lazy component. The factory method is called on first render. For example useful
|
||||||
|
|
|
@ -25,7 +25,7 @@ export function openModal(Component: React.ComponentType, modalProps: Record<str
|
||||||
), { modalKey: key });
|
), { modalKey: key });
|
||||||
|
|
||||||
return key;
|
return key;
|
||||||
};
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Close a modal by key. The id you need for this is returned by openModal.
|
* Close a modal by key. The id you need for this is returned by openModal.
|
||||||
|
|
|
@ -50,7 +50,7 @@ function patchPush() {
|
||||||
if (mod === originalMod) throw err;
|
if (mod === originalMod) throw err;
|
||||||
|
|
||||||
logger.error("Error in patched chunk", err);
|
logger.error("Error in patched chunk", err);
|
||||||
return originalMod(module, exports, require);
|
return void originalMod(module, exports, require);
|
||||||
}
|
}
|
||||||
|
|
||||||
// There are (at the time of writing) 11 modules exporting the window
|
// There are (at the time of writing) 11 modules exporting the window
|
||||||
|
@ -145,4 +145,3 @@ function patchPush() {
|
||||||
configurable: true
|
configurable: true
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue