refactor: misc. changes

This commit is contained in:
ryan-0324 2024-09-06 12:07:47 -04:00
parent f12156ee9d
commit 07ec5131b7
4 changed files with 29 additions and 6 deletions

View file

@ -60,7 +60,7 @@ export default tseslint.config(
"@stylistic/jsx-closing-bracket-location": "error",
"@stylistic/jsx-closing-tag-location": "error",
"@stylistic/jsx-curly-brace-presence": ["error", { propElementValues: "always" }],
"@stylistic/jsx-curly-spacing": "error",
"@stylistic/jsx-curly-spacing": ["error", { children: true }],
"@stylistic/jsx-equals-spacing": "error",
"@stylistic/jsx-first-prop-new-line": ["error", "multiline"],
"@stylistic/jsx-quotes": "error",
@ -82,7 +82,7 @@ export default tseslint.config(
"@stylistic/new-parens": "error",
"@stylistic/no-extra-semi": "error",
"@stylistic/no-floating-decimal": "error",
"@stylistic/no-multi-spaces": "error",
"@stylistic/no-multi-spaces": ["error", { exceptions: { Property: false } }],
"@stylistic/no-tabs": "error",
"@stylistic/no-trailing-spaces": "error",
"@stylistic/no-whitespace-before-property": "error",

View file

@ -57,15 +57,15 @@ export default tseslint.config(
"@stylistic/new-parens": "error",
"@stylistic/no-extra-semi": "error",
"@stylistic/no-floating-decimal": "error",
"@stylistic/no-multi-spaces": "error",
"@stylistic/no-multi-spaces": ["error", { exceptions: { Property: false } }],
"@stylistic/no-multiple-empty-lines": ["error", { max: 1, maxBOF: 0, maxEOF: 0 }],
"@stylistic/no-trailing-spaces": "error",
"@stylistic/no-whitespace-before-property": "error",
"@stylistic/object-curly-newline": "error",
"@stylistic/object-curly-spacing": ["error", "always"],
"@stylistic/rest-spread-spacing": "error",
"@stylistic/quote-props": ["error", "as-needed"],
"@stylistic/quotes": ["error", "double", { avoidEscape: true }],
"@stylistic/rest-spread-spacing": "error",
"@stylistic/semi": "error",
"@stylistic/semi-spacing": "error",
"@stylistic/semi-style": "error",
@ -166,13 +166,13 @@ export default tseslint.config(
ignores: ["src/**"],
rules: {
"@typescript-eslint/no-unnecessary-type-parameters": "error",
"unicorn/prefer-node-protocol": "error",
"simple-import-sort/imports": ["error", {
groups: [
["^((node:)?(assert(/strict)?|async_hooks|buffer|child_process|cluster|console|constants|crypto|dgram|diagnostics_channel|dns(/promises)?|domain|events|fs(/promises)?|http|http2|https|module|net|os|path(/(posix|win32))?|perf_hooks|process|punycode|querystring|readline(/promises)?|repl|stream(/(consumers|promises|web))?|string_decoder|timers(/promises)?|tls|trace_events|tty|url|util(/types)?|v8|vm|wasi|worker_threads|zlib)|node:test(/reporters)?)$"],
["^[^.]"]
]
}],
"unicorn/prefer-node-protocol": "error",
}
},
{

23
src/globals.d.ts vendored
View file

@ -84,13 +84,36 @@ declare global {
? Extract<unknown[], typeof arg>
: ToArray<typeof arg>;
}
// https://github.com/microsoft/TypeScript/issues/26255
// https://github.com/microsoft/TypeScript/issues/29841
interface Array<T> {
includes(searchElement: unknown, fromIndex?: number): boolean;
indexOf(searchElement: unknown, fromIndex?: number): number;
lastIndexOf(searchElement: unknown, fromIndex?: number): number;
map<U>(callbackfn: (value: T, index: TupleKeys<this>, array: this) => U, thisArg?: any): MappedTuple<this, U>;
}
interface ReadonlyArray<T> {
includes(searchElement: unknown, fromIndex?: number): boolean;
indexOf(searchElement: unknown, fromIndex?: number): number;
lastIndexOf(searchElement: unknown, fromIndex?: number): number;
map<U>(callbackfn: (value: T, index: TupleKeys<this>, array: this) => U, thisArg?: any): MappedTuple<this, U>;
}
interface Map<K, V> {
delete(key: unknown): boolean;
get(key: unknown): V | undefined;
has(key: unknown): boolean;
}
interface ReadonlyMap<K, V> {
get(key: unknown): V | undefined;
has(key: unknown): boolean;
}
interface Set<T> {
delete(value: unknown): boolean;
has(value: unknown): boolean;
}
interface ReadonlySet<T> {
has(value: unknown): boolean;
}
/* eslint-enable @typescript-eslint/method-signature-style */
}

View file

@ -17,7 +17,7 @@ export const OnlineMemberCountStore = proxyLazy(() => {
class OnlineMemberCountStore extends Flux.Store {
getCount(guildId?: string) {
return onlineMemberMap.get(guildId!);
return onlineMemberMap.get(guildId);
}
async _ensureCount(guildId: string) {