From 3b4d68e0a10221b1a6d075a30eb8c9f6455a2f2b Mon Sep 17 00:00:00 2001 From: Audric Ackermann Date: Mon, 18 Nov 2024 16:52:45 +1100 Subject: [PATCH] chore: lint --- .eslintrc.js | 3 -- patches/@types+backbone+1.4.2.patch | 35 ------------------- .../message-content/MessageContent.tsx | 19 +--------- ts/session/sending/MessageSender.ts | 3 -- ts/session/utils/TaskWithTimeout.ts | 5 --- 5 files changed, 1 insertion(+), 64 deletions(-) delete mode 100644 patches/@types+backbone+1.4.2.patch diff --git a/.eslintrc.js b/.eslintrc.js index c248be821..43cbfc9ef 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -58,9 +58,6 @@ module.exports = { // it helps readability to put public API at top, 'no-use-before-define': 'off', - // we need them with code in WIP sometimes, and it doesn't do any harm - 'no-useless-return': 'off', - // useful for unused or internal fields 'no-underscore-dangle': 'off', diff --git a/patches/@types+backbone+1.4.2.patch b/patches/@types+backbone+1.4.2.patch deleted file mode 100644 index 6491b4554..000000000 --- a/patches/@types+backbone+1.4.2.patch +++ /dev/null @@ -1,35 +0,0 @@ -diff --git a/node_modules/@types/backbone/README.md b/node_modules/@types/backbone/README.md -deleted file mode 100644 -index b353b41..0000000 ---- a/node_modules/@types/backbone/README.md -+++ /dev/null -@@ -1,16 +0,0 @@ --# Installation --> `npm install --save @types/backbone` -- --# Summary --This package contains type definitions for Backbone (http://backbonejs.org/). -- --# Details --Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/backbone. -- --### Additional Details -- * Last updated: Thu, 30 Apr 2020 23:00:14 GMT -- * Dependencies: [@types/underscore](https://npmjs.com/package/@types/underscore), [@types/jquery](https://npmjs.com/package/@types/jquery) -- * Global values: `Backbone` -- --# Credits --These definitions were written by [Boris Yankov](https://github.com/borisyankov), [Natan Vivo](https://github.com/nvivo), [kenjiru](https://github.com/kenjiru), [jjoekoullas](https://github.com/jjoekoullas), [Julian Gonggrijp](https://github.com/jgonggrijp), [Kyle Scully](https://github.com/zieka), and [Robert Kesterson](https://github.com/rkesters). -diff --git a/node_modules/@types/backbone/index.d.ts b/node_modules/@types/backbone/index.d.ts -index da53a62..4db8b56 100644 ---- a/node_modules/@types/backbone/index.d.ts -+++ b/node_modules/@types/backbone/index.d.ts -@@ -225,7 +225,7 @@ declare namespace Backbone { - * That works only if you set it in the constructor or the initialize method. - **/ - defaults(): ObjectHash; -- id: any; -+ id: string; - idAttribute: string; - validationError: any; - diff --git a/ts/components/conversation/message/message-content/MessageContent.tsx b/ts/components/conversation/message/message-content/MessageContent.tsx index b4ebccb6b..6878645e4 100644 --- a/ts/components/conversation/message/message-content/MessageContent.tsx +++ b/ts/components/conversation/message/message-content/MessageContent.tsx @@ -1,6 +1,6 @@ import classNames from 'classnames'; import { isEmpty } from 'lodash'; -import { MouseEvent, useCallback, useLayoutEffect, useState } from 'react'; +import { useCallback, useLayoutEffect, useState } from 'react'; import { InView } from 'react-intersection-observer'; import { useSelector } from 'react-redux'; import styled from 'styled-components'; @@ -37,22 +37,6 @@ type Props = { messageId: string; }; -// TODO not too sure what is this doing? It is not preventDefault() -// or stopPropagation() so I think this is never cancelling a click event? -function onClickOnMessageInnerContainer(event: MouseEvent) { - const selection = window.getSelection(); - // Text is being selected - if (selection && selection.type === 'Range') { - return; - } - - // User clicked on message body - const target = event.target as HTMLDivElement; - if (target.className === 'text-selectable' || window.contextMenuShown) { - return; - } -} - const StyledMessageContent = styled.div<{ msgDirection: MessageModelType }>` display: flex; align-self: ${props => (props.msgDirection === 'incoming' ? 'flex-start' : 'flex-end')}; @@ -155,7 +139,6 @@ export const MessageContent = (props: Props) => { diff --git a/ts/session/sending/MessageSender.ts b/ts/session/sending/MessageSender.ts index 47c035224..2f446cc55 100644 --- a/ts/session/sending/MessageSender.ts +++ b/ts/session/sending/MessageSender.ts @@ -257,7 +257,6 @@ async function sendSingleMessage({ }, ]); - // make sure to update the local sent_at timestamp, because sometimes, we will get the just pushed message in the receiver side // before we return from the await below. // and the isDuplicate messages relies on sent_at timestamp to be valid. @@ -305,7 +304,6 @@ async function sendSingleMessage({ retries: Math.max(attempts - 1, 0), factor: 1, minTimeout: retryMinTimeout || MessageSender.getMinRetryTimeout(), - } ); } @@ -641,7 +639,6 @@ async function handleBatchResultWithSubRequests({ isString(storedHash) && isNumber(storedAt) ) { - seenHashes.push({ expiresAt: NetworkTime.now() + TTL_DEFAULT.CONTENT_MESSAGE, // non config msg expire at CONTENT_MESSAGE at most hash: storedHash, diff --git a/ts/session/utils/TaskWithTimeout.ts b/ts/session/utils/TaskWithTimeout.ts index 1e77199e3..9bf777087 100644 --- a/ts/session/utils/TaskWithTimeout.ts +++ b/ts/session/utils/TaskWithTimeout.ts @@ -16,10 +16,7 @@ export const createTaskWithTimeout = (task: any, id: string, givenTimeout?: numb window?.log?.error(message); reject(new Error(message)); - return; } - - return; }, timeout); const clearTimer = () => { try { @@ -41,13 +38,11 @@ export const createTaskWithTimeout = (task: any, id: string, givenTimeout?: numb clearTimer(); complete = true; resolve(result); - return; }; const failure = (error: any) => { clearTimer(); complete = true; reject(error); - return; }; let promise;