From 8cd196b5e464f70893d12242a79e0fd9058dff8d Mon Sep 17 00:00:00 2001 From: Rexogamer Date: Thu, 13 Feb 2025 06:03:59 +0000 Subject: [PATCH] chore: add `eslint-plugin-de-morgan` --- .eslintrc.js | 2 +- package.json | 1 + src/lib/auth/login.ts | 2 +- src/lib/utils/utils.ts | 2 +- yarn.lock | 10 ++++++++++ 5 files changed, 14 insertions(+), 3 deletions(-) diff --git a/.eslintrc.js b/.eslintrc.js index 36fc6de..71788e8 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -1,6 +1,6 @@ module.exports = { root: true, - extends: '@react-native', + extends: ['@react-native', 'plugin:de-morgan/recommended-legacy'], rules: { 'react/react-in-jsx-scope': 0, 'react-native/no-inline-styles': 0, // TODO: turn this back on when the codebase is less error-filled diff --git a/package.json b/package.json index 857635a..8d4aa75 100644 --- a/package.json +++ b/package.json @@ -86,6 +86,7 @@ "babel-plugin-react-native-web": "^0.19.13", "babel-plugin-transform-remove-console": "^6.9.4", "eslint": "^8.57.1", + "eslint-plugin-de-morgan": "^1.0.0", "jest": "^29.7.0", "knip": "^5.44.1", "prettier": "^3.5.0", diff --git a/src/lib/auth/login.ts b/src/lib/auth/login.ts index 2a0afd6..727b050 100644 --- a/src/lib/auth/login.ts +++ b/src/lib/auth/login.ts @@ -154,7 +154,7 @@ export async function loginWithSavedToken(status: string) { await client.useExistingSession({token: res}); } catch (e: any) { console.log(e); - !(e.message?.startsWith('Read error') || e.message === 'Network Error') && + !e.message?.startsWith('Read error') && e.message !== 'Network Error' && client.user ? app.setLoggedOutScreen('loginPage') : status === 'loggedIn' diff --git a/src/lib/utils/utils.ts b/src/lib/utils/utils.ts index 13b005a..9f29147 100644 --- a/src/lib/utils/utils.ts +++ b/src/lib/utils/utils.ts @@ -126,7 +126,7 @@ export function calculateGrouped(msg1: Message, msg2: Message) { return ( // a message is grouped with the previous message if all of the following statements are true: msg1.author._id === msg2.author._id && // the author is the same - !(msg1.reply_ids && msg1.reply_ids.length > 0) && // the message is not a reply + (!msg1.reply_ids || msg1.reply_ids.length <= 0) && // the message is not a reply differenceInMinutes(time1, time2) < 7 && // the time difference is less than 7 minutes isSameDay(time1, time2) && // the messages were sent on the same day and (msg2.masquerade // the masquerade is the same diff --git a/yarn.lock b/yarn.lock index 0e394ef..af0d6df 100644 --- a/yarn.lock +++ b/yarn.lock @@ -6051,6 +6051,15 @@ __metadata: languageName: node linkType: hard +"eslint-plugin-de-morgan@npm:^1.0.0": + version: 1.0.0 + resolution: "eslint-plugin-de-morgan@npm:1.0.0" + peerDependencies: + eslint: ">=8.0.0" + checksum: 10c0/bde5c30ae0f827992102699d49330a6ef1d1b7660f0f038ba8dca6683622e074e9b18400387286e3df55eb252b429178e2eee303ed25ca070fd83d91afb1aa52 + languageName: node + linkType: hard + "eslint-plugin-eslint-comments@npm:^3.2.0": version: 3.2.0 resolution: "eslint-plugin-eslint-comments@npm:3.2.0" @@ -10702,6 +10711,7 @@ __metadata: babel-plugin-transform-remove-console: "npm:^6.9.4" date-fns: "npm:^4.1.0" eslint: "npm:^8.57.1" + eslint-plugin-de-morgan: "npm:^1.0.0" i18next: "npm:^24.2.2" intl-pluralrules: "npm:^2.0.1" jest: "npm:^29.7.0"