diff --git a/eslint.config.mjs b/eslint.config.mjs index 387504707..83ff1e783 100644 --- a/eslint.config.mjs +++ b/eslint.config.mjs @@ -63,8 +63,10 @@ export default defineConfig([ // ignoreImports: true // }], // "consistent-return": "error", + // "sort-imports": ["error", {}], "default-case": "error", "default-case-last": "error", + "yoda": "error", // unsure what the defaults are here, but we want them to error "for-direction": "error", "constructor-super": "error", diff --git a/src/api/util/utility/passwordStrength.ts b/src/api/util/utility/passwordStrength.ts index 7a9d4c5f1..041997c96 100644 --- a/src/api/util/utility/passwordStrength.ts +++ b/src/api/util/utility/passwordStrength.ts @@ -44,12 +44,12 @@ export function checkPassword(password: string): number { } // checks for amount of Numbers - if (password.match(reNUMBER)?.length ?? 0 >= minNumbers - 1) { + if ((password.match(reNUMBER)?.length ?? 0) >= minNumbers - 1) { strength += 0.05; } // checks for amount of Uppercase Letters - if (password.match(reUPPERCASELETTER)?.length ?? 0 >= minUpperCase - 1) { + if ((password.match(reUPPERCASELETTER)?.length ?? 0) >= minUpperCase - 1) { strength += 0.05; } diff --git a/src/util/util/networking/abuseipdb/AbuseIpDbClient.ts b/src/util/util/networking/abuseipdb/AbuseIpDbClient.ts index c4b69a481..b001fc75f 100644 --- a/src/util/util/networking/abuseipdb/AbuseIpDbClient.ts +++ b/src/util/util/networking/abuseipdb/AbuseIpDbClient.ts @@ -18,7 +18,7 @@ export class AbuseIpDbClient { static async checkIpAddress(ip: string): Promise { const { ipdataApiKey } = Config.get().security; if (!ipdataApiKey) return null; - if (this.ipCheckCache.get(ip)?.expires ?? 0 > Date.now()) return this.ipCheckCache.get(ip)!.data; + if ((this.ipCheckCache.get(ip)?.expires ?? 0) > Date.now()) return this.ipCheckCache.get(ip)!.data; console.log(`[AbuseIPDB] Checking IP address ${ip}...`); const resp = (await (await fetch(`https://api.abuseipdb.com/api/v2/check?ipAddress=${ip}`)).json()) as Promise; @@ -32,7 +32,7 @@ export class AbuseIpDbClient { static async getBlacklist(): Promise { const { abuseIpDbApiKey, abuseipdbBlacklistRatelimit } = Config.get().security; if (!abuseIpDbApiKey) return null; - if (this.blacklistCache?.expires ?? 0 > Date.now()) return this.blacklistCache!.data; + if ((this.blacklistCache?.expires ?? 0) > Date.now()) return this.blacklistCache!.data; console.log("[AbuseIPDB] Fetching blacklist..."); const resp = (await ( diff --git a/src/util/util/networking/ipdata/IpDataClient.ts b/src/util/util/networking/ipdata/IpDataClient.ts index 2812ef593..b15513890 100644 --- a/src/util/util/networking/ipdata/IpDataClient.ts +++ b/src/util/util/networking/ipdata/IpDataClient.ts @@ -13,7 +13,7 @@ export class IpDataClient { static async getIpInfo(ip: string): Promise { const { ipdataApiKey } = Config.get().security; if (!ipdataApiKey) return null; - if (this.ipInfoCache.get(ip)?.expires ?? 0 > Date.now()) return this.ipInfoCache.get(ip)!.data; + if ((this.ipInfoCache.get(ip)?.expires ?? 0) > Date.now()) return this.ipInfoCache.get(ip)!.data; console.log(`[IpData] Fetching info for IP address ${ip}...`); const response = await fetch(`https://eu-api.ipdata.co/${ip}?api-key=${ipdataApiKey}`);