Remove unused `eslint-disable`s

This commit is contained in:
Evan Hahn 2022-06-03 21:07:51 +00:00 committed by GitHub
parent 63189f3f91
commit f50a6abe36
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
41 changed files with 68 additions and 142 deletions

View File

@ -217,4 +217,6 @@ module.exports = {
],
rules,
reportUnusedDisableDirectives: true,
};

View File

@ -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 {

View File

@ -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';

View File

@ -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;

View File

@ -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);

View File

@ -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,

View File

@ -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({

View File

@ -271,7 +271,6 @@ export async function startApp(): Promise<void> {
serverTrustRoot: window.getServerTrustRoot(),
});
// eslint-disable-next-line no-inner-declarations
function queuedEventListener<Args extends Array<unknown>>(
handler: (...args: Args) => Promise<void> | void,
track = true

View File

@ -244,7 +244,6 @@ export function CompositionInput(props: Props): React.ReactElement {
};
if (inputApi) {
// eslint-disable-next-line no-param-reassign
inputApi.current = {
focus,
insertEmoji,

View File

@ -393,56 +393,46 @@ export const ForwardMessageModal: FunctionComponent<PropsType> = ({
/>
{candidateConversations.length ? (
<Measure bounds>
{({ 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 (
<div
className="module-ForwardMessageModal__list-wrapper"
ref={measureRef}
>
<ConversationList
dimensions={contentRect.bounds}
getPreferredBadge={getPreferredBadge}
getRow={getRow}
i18n={i18n}
onClickArchiveButton={shouldNeverBeCalled}
onClickContactCheckbox={(
conversationId: string,
disabledReason:
| undefined
| ContactCheckboxDisabledReason
) => {
if (
disabledReason !==
ContactCheckboxDisabledReason.MaximumContactsSelected
) {
toggleSelectedConversation(conversationId);
}
}}
lookupConversationWithoutUuid={
asyncShouldNeverBeCalled
{({ contentRect, measureRef }: MeasuredComponentProps) => (
<div
className="module-ForwardMessageModal__list-wrapper"
ref={measureRef}
>
<ConversationList
dimensions={contentRect.bounds}
getPreferredBadge={getPreferredBadge}
getRow={getRow}
i18n={i18n}
onClickArchiveButton={shouldNeverBeCalled}
onClickContactCheckbox={(
conversationId: string,
disabledReason:
| undefined
| ContactCheckboxDisabledReason
) => {
if (
disabledReason !==
ContactCheckboxDisabledReason.MaximumContactsSelected
) {
toggleSelectedConversation(conversationId);
}
showConversation={shouldNeverBeCalled}
showUserNotFoundModal={shouldNeverBeCalled}
setIsFetchingUUID={shouldNeverBeCalled}
onSelectConversation={shouldNeverBeCalled}
renderMessageSearchResult={() => {
shouldNeverBeCalled();
return <div />;
}}
rowCount={rowCount}
shouldRecomputeRowHeights={false}
showChooseGroupMembers={shouldNeverBeCalled}
theme={theme}
/>
</div>
);
/* eslint-enable jsx-a11y/no-static-element-interactions */
}}
}}
lookupConversationWithoutUuid={asyncShouldNeverBeCalled}
showConversation={shouldNeverBeCalled}
showUserNotFoundModal={shouldNeverBeCalled}
setIsFetchingUUID={shouldNeverBeCalled}
onSelectConversation={shouldNeverBeCalled}
renderMessageSearchResult={() => {
shouldNeverBeCalled();
return <div />;
}}
rowCount={rowCount}
shouldRecomputeRowHeights={false}
showChooseGroupMembers={shouldNeverBeCalled}
theme={theme}
/>
</div>
)}
</Measure>
) : (
<div className="module-ForwardMessageModal__no-candidate-contacts">

View File

@ -213,9 +213,6 @@ export const GroupCallRemoteParticipant: React.FC<PropsType> = 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;

View File

@ -527,11 +527,6 @@ export const LeftPane: React.FC<PropsType> = ({
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 (
<div
className={classNames(

View File

@ -1,4 +1,4 @@
// Copyright 2021 Signal Messenger, LLC
// Copyright 2021-2022 Signal Messenger, LLC
// SPDX-License-Identifier: AGPL-3.0-only
import type { ReactNode } from 'react';
@ -12,8 +12,7 @@ export const StopPropagation = ({
children: ReactNode;
className?: string;
}): JSX.Element => (
// 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
<div
className={className}
onClick={ev => ev.stopPropagation()}

View File

@ -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';

View File

@ -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';

View File

@ -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<Props> {
const overlay = canClick ? (
// Not sure what this button does.
// eslint-disable-next-line jsx-a11y/control-has-associated-label
<button
type="button"
className={classNames('module-image__border-overlay', {

View File

@ -48,8 +48,6 @@ const searchResultKeys: Array<
'conversationResults' | 'contactResults' | 'messageResults'
> = ['conversationResults', 'contactResults', 'messageResults'];
/* eslint-disable class-methods-use-this */
export class LeftPaneSearchHelper extends LeftPaneHelper<LeftPaneSearchPropsType> {
private readonly conversationResults: MaybeLoadedSearchResultsType<ConversationListItemPropsType>;

View File

@ -1,7 +1,6 @@
// Copyright 2020-2022 Signal Messenger, LLC
// SPDX-License-Identifier: AGPL-3.0-only
/* eslint-disable camelcase */
import { compact, isNumber, throttle, debounce } from 'lodash';
import { batch as batchDispatch } from 'react-redux';
import PQueue from 'p-queue';

View File

@ -158,7 +158,6 @@ import { isNewReactionReplacingPrevious } from '../reactions/util';
import { parseBoostBadgeListFromServer } from '../badges/parseBadgesFromServer';
import { GiftBadgeStates } from '../components/conversation/Message';
/* eslint-disable camelcase */
/* eslint-disable more/no-then */
type PropsForMessageDetail = Pick<

View File

@ -7,8 +7,6 @@ import { notarize } from 'electron-notarize';
import * as packageJson from '../../package.json';
/* eslint-disable no-console */
export async function afterAllArtifactBuild({
platformToTargets,
artifactPaths,

View File

@ -1,4 +1,4 @@
// Copyright 2019-2020 Signal Messenger, LLC
// Copyright 2019-2022 Signal Messenger, LLC
// SPDX-License-Identifier: AGPL-3.0-only
import path from 'path';
@ -8,8 +8,6 @@ import { notarize } from 'electron-notarize';
import * as packageJson from '../../package.json';
/* eslint-disable no-console */
export async function afterSign({
appOutDir,
packager,

View File

@ -1,6 +1,5 @@
// Copyright 2021 Signal Messenger, LLC
// Copyright 2021-2022 Signal Messenger, LLC
// SPDX-License-Identifier: AGPL-3.0-only
/* eslint-disable no-console */
import { execFileSync } from 'child_process';
import { join } from 'path';

View File

@ -1,6 +1,5 @@
// Copyright 2021 Signal Messenger, LLC
// Copyright 2021-2022 Signal Messenger, LLC
// SPDX-License-Identifier: AGPL-3.0-only
/* eslint-disable no-console */
import asar from 'asar';
import assert from 'assert';

View File

@ -1,9 +1,8 @@
// Copyright 2019-2020 Signal Messenger, LLC
// Copyright 2019-2022 Signal Messenger, LLC
// SPDX-License-Identifier: AGPL-3.0-only
// Matching Whisper.events.trigger API
// eslint-disable-next-line max-len
// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types, @typescript-eslint/no-explicit-any
// eslint-disable-next-line @typescript-eslint/no-explicit-any
export function trigger(name: string, ...rest: Array<any>): void {
window.Whisper.events.trigger(name, ...rest);
}

View File

@ -1,4 +1,4 @@
// Copyright 2020-2021 Signal Messenger, LLC
// Copyright 2020-2022 Signal Messenger, LLC
// SPDX-License-Identifier: AGPL-3.0-only
/* eslint-disable @typescript-eslint/ban-types */
@ -43,9 +43,7 @@ export type AttachmentDownloadJobType = {
};
export type MessageMetricsType = {
id: string;
// eslint-disable-next-line camelcase
received_at: number;
// eslint-disable-next-line camelcase
sent_at: number;
};
export type ConversationMetricsType = {
@ -143,7 +141,6 @@ export type SessionType = {
export type SessionIdType = SessionType['id'];
export type SignedPreKeyType = {
confirmed: boolean;
// eslint-disable-next-line camelcase
created_at: number;
ourUuid: UUIDStringType;
id: `${UUIDStringType}:${number}`;

View File

@ -16,7 +16,7 @@ import { dispatchItemsMiddleware } from '../shims/dispatchItemsMiddleware';
declare global {
// We want to extend `window`'s properties, so we need an interface.
// eslint-disable-next-line no-restricted-syntax, @typescript-eslint/no-unused-vars
// eslint-disable-next-line no-restricted-syntax
interface Console {
_log: Console['log'];
}

View File

@ -779,7 +779,6 @@ export function getPropsForBubble(
message: MessageWithUIFieldsType,
options: GetPropsForBubbleOptions
): TimelineItemType {
// eslint-disable-next-line camelcase
const { received_at_ms: receivedAt, timestamp: messageTimestamp } = message;
const timestamp = receivedAt || messageTimestamp;

View File

@ -1,8 +1,6 @@
// Copyright 2021 Signal Messenger, LLC
// Copyright 2021-2022 Signal Messenger, LLC
// SPDX-License-Identifier: AGPL-3.0-only
/* eslint-disable no-await-in-loop */
import { assert } from 'chai';
import type { MaybeAsyncIterable } from '../../util/asyncIterables';

View File

@ -1,6 +1,6 @@
// Copyright 2022 Signal Messenger, LLC
// SPDX-License-Identifier: AGPL-3.0-only
/* eslint-disable no-await-in-loop, no-console */
/* eslint-disable no-console */
import createDebug from 'debug';
import fs from 'fs/promises';

View File

@ -1,11 +1,10 @@
// Copyright 2020 Signal Messenger, LLC
// Copyright 2020-2022 Signal Messenger, LLC
// SPDX-License-Identifier: AGPL-3.0-only
/* eslint-disable @typescript-eslint/explicit-module-boundary-types */
/* eslint-disable @typescript-eslint/no-explicit-any */
/* eslint-disable guard-for-in */
/* eslint-disable no-restricted-syntax */
/* eslint-disable @typescript-eslint/ban-types */
/*
* Implements EventTarget

View File

@ -2,7 +2,6 @@
// SPDX-License-Identifier: AGPL-3.0-only
/* eslint-disable no-bitwise */
/* eslint-disable camelcase */
import { isNumber } from 'lodash';
import PQueue from 'p-queue';
@ -1723,7 +1722,6 @@ export default class MessageReceiver
}
let p: Promise<void> = Promise.resolve();
// eslint-disable-next-line no-bitwise
if (msg.flags && msg.flags & Proto.DataMessage.Flags.END_SESSION) {
if (destinationUuid) {
p = this.handleEndSession(new UUID(destinationUuid));
@ -1886,7 +1884,6 @@ export default class MessageReceiver
}
let p: Promise<void> = Promise.resolve();
// eslint-disable-next-line no-bitwise
const destination = envelope.sourceUuid;
if (!destination) {
throw new Error(

View File

@ -1,7 +1,6 @@
// Copyright 2020-2022 Signal Messenger, LLC
// SPDX-License-Identifier: AGPL-3.0-only
/* eslint-disable guard-for-in */
/* eslint-disable @typescript-eslint/no-explicit-any */
/* eslint-disable more/no-then */
/* eslint-disable no-param-reassign */
@ -161,7 +160,6 @@ export default class OutgoingMessage {
if (message instanceof Proto.DataMessage) {
const content = new Proto.Content();
content.dataMessage = message;
// eslint-disable-next-line no-param-reassign
this.message = content;
} else {
this.message = message;
@ -610,7 +608,6 @@ export default class OutgoingMessage {
});
}
if (error?.message?.includes('untrusted identity for address')) {
// eslint-disable-next-line no-param-reassign
error.timestamp = this.timestamp;
log.error(
'Got "key changed" error from encrypt - no identityKey for application layer',

View File

@ -1,7 +1,6 @@
// Copyright 2020 Signal Messenger, LLC
// Copyright 2020-2022 Signal Messenger, LLC
// SPDX-License-Identifier: AGPL-3.0-only
/* eslint-disable more/no-then */
/* eslint-disable max-classes-per-file */
import type { KeyPairType } from './Types.d';

View File

@ -1,7 +1,6 @@
// Copyright 2020-2022 Signal Messenger, LLC
// SPDX-License-Identifier: AGPL-3.0-only
/* eslint-disable no-nested-ternary */
/* eslint-disable no-bitwise */
/* eslint-disable max-classes-per-file */
@ -805,7 +804,6 @@ export default class MessageSender {
return;
}
// eslint-disable-next-line no-param-reassign
itemAvatar.attachmentPointer = await this.makeAttachmentPointer(
attachment
);

View File

@ -1,8 +1,6 @@
// Copyright 2020-2022 Signal Messenger, LLC
// SPDX-License-Identifier: AGPL-3.0-only
/* eslint-disable more/no-then */
/* eslint-disable @typescript-eslint/ban-types */
/* eslint-disable @typescript-eslint/no-explicit-any */
/* eslint-disable max-classes-per-file */

View File

@ -5,7 +5,6 @@
/* eslint-disable no-bitwise */
/* eslint-disable guard-for-in */
/* eslint-disable no-restricted-syntax */
/* eslint-disable no-nested-ternary */
/* eslint-disable @typescript-eslint/no-explicit-any */
import AbortController from 'abort-controller';

View File

@ -1,8 +1,6 @@
// Copyright 2018-2021 Signal Messenger, LLC
// Copyright 2018-2022 Signal Messenger, LLC
// SPDX-License-Identifier: AGPL-3.0-only
/* eslint-disable max-classes-per-file */
import { get, has } from 'lodash';
export function toLogFormat(error: unknown): string {

View File

@ -1,4 +1,4 @@
// Copyright 2020 Signal Messenger, LLC
// Copyright 2020-2022 Signal Messenger, LLC
// SPDX-License-Identifier: AGPL-3.0-only
import { has } from 'lodash';
@ -12,8 +12,6 @@ import { has } from 'lodash';
*
* See the tests for the specifics of how this works.
*/
// We want this to work with any object, so we allow `object` here.
// eslint-disable-next-line @typescript-eslint/ban-types
export function assignWithNoUnnecessaryAllocation<T extends object>(
obj: Readonly<T>,
source: Readonly<Partial<T>>

View File

@ -1,10 +1,8 @@
// Copyright 2020 Signal Messenger, LLC
// Copyright 2020-2022 Signal Messenger, LLC
// SPDX-License-Identifier: AGPL-3.0-only
import { has } from 'lodash';
// We want this to work with any object, so we allow `object` here.
// eslint-disable-next-line @typescript-eslint/ban-types
export function getOwn<TObject extends object, TKey extends keyof TObject>(
obj: TObject,
key: TKey

View File

@ -210,11 +210,8 @@ type MediaType = {
attachments: Array<AttachmentType>;
conversationId: string;
id: string;
// eslint-disable-next-line camelcase
received_at: number;
// eslint-disable-next-line camelcase
received_at_ms: number;
// eslint-disable-next-line camelcase
sent_at: number;
};
};
@ -1805,7 +1802,6 @@ export class ConversationView extends window.Backbone.View<ConversationModel> {
let conversation: undefined | ConversationModel;
if (!id && isDirectConversation(this.model.attributes)) {
// eslint-disable-next-line prefer-destructuring
conversation = this.model;
} else {
conversation = window.ConversationController.get(id);

View File

@ -1,4 +1,4 @@
// Copyright 2018-2021 Signal Messenger, LLC
// Copyright 2018-2022 Signal Messenger, LLC
// SPDX-License-Identifier: AGPL-3.0-only
import { ipcRenderer } from 'electron';
@ -23,8 +23,7 @@ type FSAttrType = {
let xattr: FSAttrType | undefined;
try {
// eslint-disable-next-line max-len
// eslint-disable-next-line global-require, import/no-extraneous-dependencies, import/no-unresolved
// eslint-disable-next-line global-require, import/no-extraneous-dependencies
xattr = require('fs-xattr');
} catch (e) {
window.SignalContext.log?.info('x-attr dependency did not load successfully');