From f50a6abe367b65692390ee47715e257ac0058cda Mon Sep 17 00:00:00 2001 From: Evan Hahn <69474926+EvanHahn-Signal@users.noreply.github.com> Date: Fri, 3 Jun 2022 21:07:51 +0000 Subject: [PATCH] Remove unused `eslint-disable`s --- .eslintrc.js | 2 + app/main.ts | 5 -- app/spell_check.ts | 4 +- preload.js | 2 +- preload_test.js | 6 +- sticker-creator/store/ducks/stickers.ts | 3 +- sticker-creator/store/reducer.ts | 3 +- ts/background.ts | 1 - ts/components/CompositionInput.tsx | 1 - ts/components/ForwardMessageModal.tsx | 88 ++++++++----------- ts/components/GroupCallRemoteParticipant.tsx | 3 - ts/components/LeftPane.tsx | 5 -- ts/components/StopPropagation.tsx | 5 +- .../conversation/GroupV1Migration.stories.tsx | 3 +- .../conversation/GroupV2Change.stories.tsx | 3 +- ts/components/conversation/Image.tsx | 3 +- .../leftPane/LeftPaneSearchHelper.tsx | 2 - ts/models/conversations.ts | 1 - ts/models/messages.ts | 1 - ts/scripts/notarize-universal-dmg.ts | 2 - ts/scripts/notarize.ts | 4 +- ts/scripts/test-electron.ts | 3 +- ts/scripts/test-release.ts | 3 +- ts/shims/events.ts | 5 +- ts/sql/Interface.ts | 5 +- ts/state/createStore.ts | 2 +- ts/state/selectors/message.ts | 1 - ts/test-both/util/asyncIterables_test.ts | 4 +- ts/test-mock/benchmarks/fixtures.ts | 2 +- ts/textsecure/EventTarget.ts | 3 +- ts/textsecure/MessageReceiver.ts | 3 - ts/textsecure/OutgoingMessage.ts | 3 - ts/textsecure/ProvisioningCipher.ts | 3 +- ts/textsecure/SendMessage.ts | 2 - ts/textsecure/SyncRequest.ts | 2 - ts/textsecure/WebAPI.ts | 1 - ts/types/errors.ts | 4 +- ts/util/assignWithNoUnnecessaryAllocation.ts | 4 +- ts/util/getOwn.ts | 4 +- ts/views/conversation_view.tsx | 4 - ts/windows/attachments.ts | 5 +- 41 files changed, 68 insertions(+), 142 deletions(-) diff --git a/.eslintrc.js b/.eslintrc.js index a6b47ccb5438..499cf9a471c0 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -217,4 +217,6 @@ module.exports = { ], rules, + + reportUnusedDisableDirectives: true, }; diff --git a/app/main.ts b/app/main.ts index f897df977d0c..c3313e8550bb 100644 --- a/app/main.ts +++ b/app/main.ts @@ -165,10 +165,6 @@ function showWindow() { } } -// This code runs before the 'ready' event fires, so we don't have our logging -// infrastructure in place yet. So we use console.log directly. -/* eslint-disable no-console */ - if (!process.mas) { console.log('making app single instance'); const gotLock = app.requestSingleInstanceLock(); @@ -1614,7 +1610,6 @@ app.on('ready', async () => { return; } - // eslint-disable-next-line more/no-then appStartInitialSpellcheckSetting = await getSpellCheckSetting(); try { diff --git a/app/spell_check.ts b/app/spell_check.ts index cb573fdd9f7e..1d9320bcd985 100644 --- a/app/spell_check.ts +++ b/app/spell_check.ts @@ -1,8 +1,6 @@ -// Copyright 2020-2021 Signal Messenger, LLC +// Copyright 2020-2022 Signal Messenger, LLC // SPDX-License-Identifier: AGPL-3.0-only -/* eslint-disable strict */ - import type { BrowserWindow } from 'electron'; import { Menu, clipboard, nativeImage } from 'electron'; import { uniq } from 'lodash'; diff --git a/preload.js b/preload.js index 102bea56e9c1..8b19ed50d16d 100644 --- a/preload.js +++ b/preload.js @@ -3,7 +3,7 @@ /* global Whisper, window */ -/* eslint-disable global-require, no-inner-declarations */ +/* eslint-disable global-require */ const preloadStartTime = Date.now(); let preloadEndTime = 0; diff --git a/preload_test.js b/preload_test.js index 21aa7c22a1ce..746d17a3415b 100644 --- a/preload_test.js +++ b/preload_test.js @@ -1,18 +1,16 @@ -// Copyright 2021 Signal Messenger, LLC +// Copyright 2021-2022 Signal Messenger, LLC // SPDX-License-Identifier: AGPL-3.0-only /* global window */ const { ipcRenderer } = require('electron'); +const fastGlob = require('fast-glob'); window.assert = require('chai').assert; // This is a hack to let us run TypeScript tests in the renderer process. See the // code in `test/index.html`. -/* eslint-disable global-require, import/no-extraneous-dependencies */ -const fastGlob = require('fast-glob'); - window.test = { onComplete(info) { return ipcRenderer.invoke('ci:test-electron:done', info); diff --git a/sticker-creator/store/ducks/stickers.ts b/sticker-creator/store/ducks/stickers.ts index d6901bcb771f..cc2bd437ce60 100644 --- a/sticker-creator/store/ducks/stickers.ts +++ b/sticker-creator/store/ducks/stickers.ts @@ -1,4 +1,4 @@ -// Copyright 2019-2021 Signal Messenger, LLC +// Copyright 2019-2022 Signal Messenger, LLC // SPDX-License-Identifier: AGPL-3.0-only /* eslint-disable no-param-reassign */ @@ -12,7 +12,6 @@ import { clamp, find, isNumber, pull, remove, take, uniq } from 'lodash'; import type { SortEnd } from 'react-sortable-hoc'; import { bindActionCreators } from 'redux'; import arrayMove from 'array-move'; -// eslint-disable-next-line import/no-cycle import type { AppState } from '../reducer'; import type { PackMetaData, diff --git a/sticker-creator/store/reducer.ts b/sticker-creator/store/reducer.ts index 69b6f910f062..8ceb3ea19973 100644 --- a/sticker-creator/store/reducer.ts +++ b/sticker-creator/store/reducer.ts @@ -1,9 +1,8 @@ -// Copyright 2019-2020 Signal Messenger, LLC +// Copyright 2019-2022 Signal Messenger, LLC // SPDX-License-Identifier: AGPL-3.0-only import type { Reducer } from 'redux'; import { combineReducers } from 'redux'; -// eslint-disable-next-line import/no-cycle import { reducer as stickers } from './ducks/stickers'; export const reducer = combineReducers({ diff --git a/ts/background.ts b/ts/background.ts index e489442a5860..3fd96e389815 100644 --- a/ts/background.ts +++ b/ts/background.ts @@ -271,7 +271,6 @@ export async function startApp(): Promise { serverTrustRoot: window.getServerTrustRoot(), }); - // eslint-disable-next-line no-inner-declarations function queuedEventListener>( handler: (...args: Args) => Promise | void, track = true diff --git a/ts/components/CompositionInput.tsx b/ts/components/CompositionInput.tsx index e19577ef516f..60a09fd6d9b3 100644 --- a/ts/components/CompositionInput.tsx +++ b/ts/components/CompositionInput.tsx @@ -244,7 +244,6 @@ export function CompositionInput(props: Props): React.ReactElement { }; if (inputApi) { - // eslint-disable-next-line no-param-reassign inputApi.current = { focus, insertEmoji, diff --git a/ts/components/ForwardMessageModal.tsx b/ts/components/ForwardMessageModal.tsx index c069cf4660bc..2db401e03623 100644 --- a/ts/components/ForwardMessageModal.tsx +++ b/ts/components/ForwardMessageModal.tsx @@ -393,56 +393,46 @@ export const ForwardMessageModal: FunctionComponent = ({ /> {candidateConversations.length ? ( - {({ contentRect, measureRef }: MeasuredComponentProps) => { - // We disable this ESLint rule because we're capturing a bubbled - // keydown event. See [this note in the jsx-a11y docs][0]. - // - // [0]: https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/blob/c275964f52c35775208bd00cb612c6f82e42e34f/docs/rules/no-static-element-interactions.md#case-the-event-handler-is-only-being-used-to-capture-bubbled-events - /* eslint-disable jsx-a11y/no-static-element-interactions */ - return ( -
- { - if ( - disabledReason !== - ContactCheckboxDisabledReason.MaximumContactsSelected - ) { - toggleSelectedConversation(conversationId); - } - }} - lookupConversationWithoutUuid={ - asyncShouldNeverBeCalled + {({ contentRect, measureRef }: MeasuredComponentProps) => ( +
+ { + if ( + disabledReason !== + ContactCheckboxDisabledReason.MaximumContactsSelected + ) { + toggleSelectedConversation(conversationId); } - showConversation={shouldNeverBeCalled} - showUserNotFoundModal={shouldNeverBeCalled} - setIsFetchingUUID={shouldNeverBeCalled} - onSelectConversation={shouldNeverBeCalled} - renderMessageSearchResult={() => { - shouldNeverBeCalled(); - return
; - }} - rowCount={rowCount} - shouldRecomputeRowHeights={false} - showChooseGroupMembers={shouldNeverBeCalled} - theme={theme} - /> -
- ); - /* eslint-enable jsx-a11y/no-static-element-interactions */ - }} + }} + lookupConversationWithoutUuid={asyncShouldNeverBeCalled} + showConversation={shouldNeverBeCalled} + showUserNotFoundModal={shouldNeverBeCalled} + setIsFetchingUUID={shouldNeverBeCalled} + onSelectConversation={shouldNeverBeCalled} + renderMessageSearchResult={() => { + shouldNeverBeCalled(); + return
; + }} + rowCount={rowCount} + shouldRecomputeRowHeights={false} + showChooseGroupMembers={shouldNeverBeCalled} + theme={theme} + /> +
+ )} ) : (
diff --git a/ts/components/GroupCallRemoteParticipant.tsx b/ts/components/GroupCallRemoteParticipant.tsx index 097e92c37ad3..170d23328ea4 100644 --- a/ts/components/GroupCallRemoteParticipant.tsx +++ b/ts/components/GroupCallRemoteParticipant.tsx @@ -213,9 +213,6 @@ export const GroupCallRemoteParticipant: React.FC = React.memo( let avatarSize: number; - // TypeScript isn't smart enough to know that `isInPip` by itself disambiguates the - // types, so we have to use `props.isInPip` instead. - // eslint-disable-next-line react/destructuring-assignment if (props.isInPip) { containerStyles = canvasStyles; avatarSize = AvatarSize.FIFTY_TWO; diff --git a/ts/components/LeftPane.tsx b/ts/components/LeftPane.tsx index 5e4d41bce739..0205d18c7268 100644 --- a/ts/components/LeftPane.tsx +++ b/ts/components/LeftPane.tsx @@ -527,11 +527,6 @@ export const LeftPane: React.FC = ({ const widthBreakpoint = getConversationListWidthBreakpoint(width); - // We disable this lint rule because we're trying to capture bubbled events. See [the - // lint rule's docs][0]. - // - // [0]: https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/blob/645900a0e296ca7053dbf6cd9e12cc85849de2d5/docs/rules/no-static-element-interactions.md#case-the-event-handler-is-only-being-used-to-capture-bubbled-events - /* eslint-disable jsx-a11y/no-static-element-interactions */ return (
( - // eslint-disable-next-line max-len - // eslint-disable-next-line jsx-a11y/no-static-element-interactions, jsx-a11y/click-events-have-key-events + // eslint-disable-next-line jsx-a11y/no-static-element-interactions
ev.stopPropagation()} diff --git a/ts/components/conversation/GroupV1Migration.stories.tsx b/ts/components/conversation/GroupV1Migration.stories.tsx index 4d4547aeb636..5d578a068799 100644 --- a/ts/components/conversation/GroupV1Migration.stories.tsx +++ b/ts/components/conversation/GroupV1Migration.stories.tsx @@ -1,7 +1,6 @@ -// Copyright 2020-2021 Signal Messenger, LLC +// Copyright 2020-2022 Signal Messenger, LLC // SPDX-License-Identifier: AGPL-3.0-only -/* eslint-disable-next-line max-classes-per-file */ import * as React from 'react'; import { storiesOf } from '@storybook/react'; import { isBoolean } from 'lodash'; diff --git a/ts/components/conversation/GroupV2Change.stories.tsx b/ts/components/conversation/GroupV2Change.stories.tsx index d6f49fe4224f..e82cef9aa824 100644 --- a/ts/components/conversation/GroupV2Change.stories.tsx +++ b/ts/components/conversation/GroupV2Change.stories.tsx @@ -1,7 +1,6 @@ -// Copyright 2020-2021 Signal Messenger, LLC +// Copyright 2020-2022 Signal Messenger, LLC // SPDX-License-Identifier: AGPL-3.0-only -/* eslint-disable-next-line max-classes-per-file */ import * as React from 'react'; import { action } from '@storybook/addon-actions'; import { storiesOf } from '@storybook/react'; diff --git a/ts/components/conversation/Image.tsx b/ts/components/conversation/Image.tsx index b1dfe9b9a84b..2fc63020d1d6 100644 --- a/ts/components/conversation/Image.tsx +++ b/ts/components/conversation/Image.tsx @@ -1,4 +1,4 @@ -// Copyright 2018-2021 Signal Messenger, LLC +// Copyright 2018-2022 Signal Messenger, LLC // SPDX-License-Identifier: AGPL-3.0-only import React from 'react'; @@ -187,7 +187,6 @@ export class Image extends React.Component { const overlay = canClick ? ( // Not sure what this button does. - // eslint-disable-next-line jsx-a11y/control-has-associated-label