Disable `class-methods-use-this` lint rule

This commit is contained in:
Evan Hahn 2021-11-04 16:04:51 -05:00 committed by GitHub
parent 569a14e897
commit d6ffb08a63
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
35 changed files with 8 additions and 80 deletions

View File

@ -45,6 +45,7 @@ const rules = {
'no-continue': 'off',
'lines-between-class-members': 'off',
'class-methods-use-this': 'off',
// Prettier overrides:
'arrow-parens': 'off',

View File

@ -313,7 +313,6 @@ export class ConversationController {
return conversation;
}
// eslint-disable-next-line class-methods-use-this
areWePrimaryDevice(): boolean {
const ourDeviceId = window.textsecure.storage.user.getDeviceId();
@ -719,7 +718,6 @@ export class ConversationController {
* conversation the message belongs to OR null if a conversation isn't
* found.
*/
// eslint-disable-next-line class-methods-use-this
async getConversationForTargetMessage(
targetFromId: string,
targetTimestamp: number

View File

@ -2,7 +2,6 @@
// SPDX-License-Identifier: AGPL-3.0-only
/* eslint-disable max-classes-per-file */
/* eslint-disable class-methods-use-this */
import { isNumber } from 'lodash';

View File

@ -1,8 +1,6 @@
// Copyright 2016-2021 Signal Messenger, LLC
// SPDX-License-Identifier: AGPL-3.0-only
/* eslint-disable class-methods-use-this */
import PQueue from 'p-queue';
import { isNumber } from 'lodash';
import { z } from 'zod';

View File

@ -1,4 +1,4 @@
// Copyright 2018-2020 Signal Messenger, LLC
// Copyright 2018-2021 Signal Messenger, LLC
// SPDX-License-Identifier: AGPL-3.0-only
import React from 'react';
@ -74,7 +74,6 @@ function getLabelForAddress(
}
export class ContactDetail extends React.Component<Props> {
// eslint-disable-next-line class-methods-use-this
public renderSendMessage({
hasSignalAccount,
i18n,
@ -109,7 +108,6 @@ export class ContactDetail extends React.Component<Props> {
);
}
// eslint-disable-next-line class-methods-use-this
public renderEmail(
items: Array<Email> | undefined,
i18n: LocalizerType
@ -133,7 +131,6 @@ export class ContactDetail extends React.Component<Props> {
});
}
// eslint-disable-next-line class-methods-use-this
public renderPhone(
items: Array<Phone> | undefined,
i18n: LocalizerType
@ -157,7 +154,6 @@ export class ContactDetail extends React.Component<Props> {
});
}
// eslint-disable-next-line class-methods-use-this
public renderAddressLine(value: string | undefined): JSX.Element | undefined {
if (!value) {
return undefined;
@ -166,7 +162,6 @@ export class ContactDetail extends React.Component<Props> {
return <div>{value}</div>;
}
// eslint-disable-next-line class-methods-use-this
public renderPOBox(
poBox: string | undefined,
i18n: LocalizerType
@ -182,7 +177,6 @@ export class ContactDetail extends React.Component<Props> {
);
}
// eslint-disable-next-line class-methods-use-this
public renderAddressLineTwo(address: PostalAddress): JSX.Element | null {
if (address.city || address.region || address.postcode) {
return (

View File

@ -191,7 +191,6 @@ export class Quote extends React.Component<Props, State> {
);
}
// eslint-disable-next-line class-methods-use-this
public renderIcon(icon: string): JSX.Element {
return (
<div className="module-quote__icon-container">

View File

@ -27,8 +27,6 @@ export type LeftPaneArchivePropsType =
| LeftPaneArchiveBasePropsType
| (LeftPaneArchiveBasePropsType & LeftPaneSearchPropsType);
/* eslint-disable class-methods-use-this */
export class LeftPaneArchiveHelper extends LeftPaneHelper<LeftPaneArchivePropsType> {
private readonly archivedConversations: ReadonlyArray<ConversationListItemPropsType>;

View File

@ -32,8 +32,6 @@ export type LeftPaneChooseGroupMembersPropsType = {
selectedContacts: Array<ConversationType>;
};
/* eslint-disable class-methods-use-this */
export class LeftPaneChooseGroupMembersHelper extends LeftPaneHelper<LeftPaneChooseGroupMembersPropsType> {
private readonly candidateContacts: ReadonlyArray<ConversationType>;

View File

@ -32,8 +32,6 @@ enum TopButton {
StartNewConversation,
}
/* eslint-disable class-methods-use-this */
export class LeftPaneComposeHelper extends LeftPaneHelper<LeftPaneComposePropsType> {
private readonly composeContacts: ReadonlyArray<ContactListItemPropsType>;

View File

@ -21,8 +21,6 @@ export type ToFindType = {
unreadOnly: boolean;
};
/* eslint-disable class-methods-use-this */
export abstract class LeftPaneHelper<T> {
getHeaderContents(
_: Readonly<{

View File

@ -23,8 +23,6 @@ export type LeftPaneInboxPropsType = {
startSearchCounter: number;
};
/* eslint-disable class-methods-use-this */
export class LeftPaneInboxHelper extends LeftPaneHelper<LeftPaneInboxPropsType> {
private readonly conversations: ReadonlyArray<ConversationListItemPropsType>;

View File

@ -43,8 +43,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>;
@ -144,7 +142,6 @@ export class LeftPaneSearchHelper extends LeftPaneHelper<LeftPaneSearchPropsType
}
// This is currently unimplemented. See DESKTOP-1170.
// eslint-disable-next-line class-methods-use-this
getRowIndexToScrollTo(
_selectedConversationId: undefined | string
): undefined | number {
@ -256,7 +253,6 @@ export class LeftPaneSearchHelper extends LeftPaneHelper<LeftPaneSearchPropsType
}
// This is currently unimplemented. See DESKTOP-1170.
// eslint-disable-next-line class-methods-use-this
getConversationAndMessageAtIndex(
_conversationIndex: number
): undefined | { conversationId: string; messageId?: string } {
@ -264,7 +260,6 @@ export class LeftPaneSearchHelper extends LeftPaneHelper<LeftPaneSearchPropsType
}
// This is currently unimplemented. See DESKTOP-1170.
// eslint-disable-next-line class-methods-use-this
getConversationAndMessageInDirection(
_toFind: Readonly<ToFindType>,
_selectedConversationId: undefined | string,

View File

@ -36,8 +36,6 @@ export type LeftPaneSetGroupMetadataPropsType = {
userAvatarData: ReadonlyArray<AvatarDataType>;
};
/* eslint-disable class-methods-use-this */
export class LeftPaneSetGroupMetadataHelper extends LeftPaneHelper<LeftPaneSetGroupMetadataPropsType> {
private readonly groupAvatar: undefined | Uint8Array;

View File

@ -1,8 +1,6 @@
// Copyright 2021 Signal Messenger, LLC
// SPDX-License-Identifier: AGPL-3.0-only
/* eslint-disable class-methods-use-this */
import { Buffer } from 'buffer';
export class Bytes {

View File

@ -1,8 +1,6 @@
// Copyright 2021 Signal Messenger, LLC
// SPDX-License-Identifier: AGPL-3.0-only
/* eslint-disable class-methods-use-this */
import { Buffer } from 'buffer';
import type { Decipher } from 'crypto';
import crypto from 'crypto';

View File

@ -1,8 +1,6 @@
// Copyright 2021 Signal Messenger, LLC
// SPDX-License-Identifier: AGPL-3.0-only
/* eslint-disable class-methods-use-this */
import type PQueue from 'p-queue';
import type { LoggerType } from '../types/Logging';
import { exponentialBackoffMaxAttempts } from '../util/exponentialBackoff';

View File

@ -40,8 +40,6 @@ const reactionJobData = z.object({
export type ReactionJobData = z.infer<typeof reactionJobData>;
/* eslint-disable class-methods-use-this */
export class ReactionJobQueue extends JobQueue<ReactionJobData> {
private readonly inMemoryQueues = new InMemoryQueues();

View File

@ -1,8 +1,6 @@
// Copyright 2021 Signal Messenger, LLC
// SPDX-License-Identifier: AGPL-3.0-only
/* eslint-disable class-methods-use-this */
import * as durations from '../util/durations';
import type { LoggerType } from '../types/Logging';
import { exponentialBackoffMaxAttempts } from '../util/exponentialBackoff';

View File

@ -1,6 +1,5 @@
// Copyright 2021 Signal Messenger, LLC
// SPDX-License-Identifier: AGPL-3.0-only
/* eslint-disable class-methods-use-this */
import { z } from 'zod';

View File

@ -1,6 +1,5 @@
// Copyright 2021 Signal Messenger, LLC
// SPDX-License-Identifier: AGPL-3.0-only
/* eslint-disable class-methods-use-this */
import * as z from 'zod';
import * as durations from '../util/durations';

View File

@ -1,8 +1,6 @@
// Copyright 2021 Signal Messenger, LLC
// SPDX-License-Identifier: AGPL-3.0-only
/* eslint-disable class-methods-use-this */
import * as durations from '../util/durations';
import type { LoggerType } from '../types/Logging';
import { exponentialBackoffMaxAttempts } from '../util/exponentialBackoff';

View File

@ -1,8 +1,6 @@
// Copyright 2021 Signal Messenger, LLC
// SPDX-License-Identifier: AGPL-3.0-only
/* eslint-disable class-methods-use-this */
import { z } from 'zod';
import * as durations from '../util/durations';
import type { LoggerType } from '../types/Logging';

View File

@ -1,7 +1,6 @@
// Copyright 2020-2021 Signal Messenger, LLC
// SPDX-License-Identifier: AGPL-3.0-only
/* eslint-disable class-methods-use-this */
/* eslint-disable camelcase */
import { compact, isNumber } from 'lodash';
import { batch as batchDispatch } from 'react-redux';
@ -204,7 +203,6 @@ export class ConversationModel extends window.Backbone
private isInReduxBatch = false;
// eslint-disable-next-line class-methods-use-this
defaults(): Partial<ConversationAttributesType> {
return {
unreadCount: 0,
@ -234,7 +232,6 @@ export class ConversationModel extends window.Backbone
return this.get('uuid') || this.get('e164');
}
// eslint-disable-next-line class-methods-use-this
getContactCollection(): Backbone.Collection<ConversationModel> {
const collection = new window.Backbone.Collection<ConversationModel>();
const collator = new Intl.Collator(undefined, { sensitivity: 'base' });

View File

@ -760,7 +760,6 @@ export class MessageModel extends window.Backbone.Model<MessageAttributesType> {
return `${account}.${device} ${timestamp}`;
}
// eslint-disable-next-line class-methods-use-this
defaults(): Partial<MessageAttributesType> {
return {
timestamp: new Date().getTime(),
@ -768,7 +767,6 @@ export class MessageModel extends window.Backbone.Model<MessageAttributesType> {
};
}
// eslint-disable-next-line class-methods-use-this
validate(attributes: Record<string, unknown>): void {
const required = ['conversationId', 'received_at', 'sent_at'];
const missing = _.filter(required, attr => !attributes[attr]);
@ -782,7 +780,6 @@ export class MessageModel extends window.Backbone.Model<MessageAttributesType> {
this.set(attributes);
}
// eslint-disable-next-line class-methods-use-this
getNameForNumber(number: string): string {
const conversation = window.ConversationController.get(number);
if (!conversation) {
@ -1264,7 +1261,6 @@ export class MessageModel extends window.Backbone.Model<MessageAttributesType> {
);
}
// eslint-disable-next-line class-methods-use-this
isReplayableError(e: Error): boolean {
return (
e.name === 'MessageError' ||
@ -2071,7 +2067,6 @@ export class MessageModel extends window.Backbone.Model<MessageAttributesType> {
});
}
// eslint-disable-next-line class-methods-use-this
async copyFromQuotedMessage(
quote: ProcessedQuote | undefined,
conversationId: string
@ -2145,7 +2140,6 @@ export class MessageModel extends window.Backbone.Model<MessageAttributesType> {
return result;
}
// eslint-disable-next-line class-methods-use-this
async copyQuoteContentFromOriginal(
originalMessage: MessageModel,
quote: QuotedMessageType

View File

@ -1,8 +1,6 @@
// Copyright 2020-2021 Signal Messenger, LLC
// SPDX-License-Identifier: AGPL-3.0-only
/* eslint-disable class-methods-use-this */
import { desktopCapturer, ipcRenderer } from 'electron';
import type {
AudioDevice,

View File

@ -1,9 +1,7 @@
// Copyright 2015-2021 Signal Messenger, LLC
// SPDX-License-Identifier: AGPL-3.0-only
/* eslint-disable
class-methods-use-this,
@typescript-eslint/no-empty-function
*/
/* eslint-disable @typescript-eslint/no-empty-function */
import { assert } from 'chai';
import { v4 as getGuid } from 'uuid';

View File

@ -1,7 +1,7 @@
// Copyright 2015-2021 Signal Messenger, LLC
// SPDX-License-Identifier: AGPL-3.0-only
/* eslint-disable
class-methods-use-this,
no-new,
@typescript-eslint/no-empty-function,
@typescript-eslint/no-explicit-any

View File

@ -21,7 +21,6 @@ class FakeIPC extends EventEmitter implements MinimalIPC {
return this.state;
}
// eslint-disable-next-line class-methods-use-this
public send() {
throw new Error(
'This should not be called. It is only here to satisfy the interface'

View File

@ -1,6 +1,7 @@
// Copyright 2021 Signal Messenger, LLC
// SPDX-License-Identifier: AGPL-3.0-only
/* eslint-disable max-classes-per-file, class-methods-use-this */
/* eslint-disable max-classes-per-file */
import { assert } from 'chai';
import * as sinon from 'sinon';

View File

@ -4,7 +4,6 @@
/* eslint-disable @typescript-eslint/no-explicit-any */
/* eslint-disable @typescript-eslint/ban-types */
/* eslint-disable more/no-then */
/* eslint-disable class-methods-use-this */
/* eslint-disable @typescript-eslint/explicit-module-boundary-types */
import PQueue from 'p-queue';
import { omit } from 'lodash';

View File

@ -2,7 +2,6 @@
// SPDX-License-Identifier: AGPL-3.0-only
/* eslint-disable no-bitwise */
/* eslint-disable class-methods-use-this */
/* eslint-disable camelcase */
import { isNumber, map } from 'lodash';

View File

@ -2,7 +2,6 @@
// SPDX-License-Identifier: AGPL-3.0-only
/* eslint-disable guard-for-in */
/* eslint-disable class-methods-use-this */
/* eslint-disable @typescript-eslint/no-explicit-any */
/* eslint-disable more/no-then */
/* eslint-disable no-param-reassign */

View File

@ -2,7 +2,6 @@
// SPDX-License-Identifier: AGPL-3.0-only
/* eslint-disable no-nested-ternary */
/* eslint-disable class-methods-use-this */
/* eslint-disable more/no-then */
/* eslint-disable no-bitwise */
/* eslint-disable max-classes-per-file */

View File

@ -1,4 +1,4 @@
// Copyright 2020 Signal Messenger, LLC
// Copyright 2020-2021 Signal Messenger, LLC
// SPDX-License-Identifier: AGPL-3.0-only
import PQueue from 'p-queue';
@ -12,7 +12,6 @@ const ringtoneEventQueue = new PQueue({
class CallingTones {
private ringtone?: Sound;
// eslint-disable-next-line class-methods-use-this
async playEndCall(): Promise<void> {
const canPlayTone = window.Events.getCallRingtoneNotification();
if (!canPlayTone) {
@ -55,7 +54,6 @@ class CallingTones {
});
}
// eslint-disable-next-line class-methods-use-this
async someonePresenting() {
const canPlayTone = window.Events.getCallRingtoneNotification();
if (!canPlayTone) {

View File

@ -313,7 +313,6 @@ export class ConversationView extends window.Backbone.View<ConversationModel> {
this.updateAttachmentsView();
}
// eslint-disable-next-line class-methods-use-this
events(): Record<string, string> {
return {
drop: 'onDrop',
@ -326,7 +325,6 @@ export class ConversationView extends window.Backbone.View<ConversationModel> {
// classname wouldn't be applied when Backbone creates our el.
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore
// eslint-disable-next-line class-methods-use-this
className(): string {
return 'conversation';
}
@ -334,7 +332,6 @@ export class ConversationView extends window.Backbone.View<ConversationModel> {
// Same situation as className().
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore
// eslint-disable-next-line class-methods-use-this
id(): string {
return `conversation-${this.model.cid}`;
}
@ -1005,7 +1002,6 @@ export class ConversationView extends window.Backbone.View<ConversationModel> {
};
}
// eslint-disable-next-line class-methods-use-this
async cleanModels(
collection: MessageModelCollectionType | Array<MessageModel>
): Promise<Array<MessageModel>> {
@ -2154,7 +2150,6 @@ export class ConversationView extends window.Backbone.View<ConversationModel> {
this.downloadAttachment({ attachment, timestamp, isDangerous });
}
// eslint-disable-next-line class-methods-use-this
async downloadAttachment({
attachment,
timestamp,
@ -2753,7 +2748,6 @@ export class ConversationView extends window.Backbone.View<ConversationModel> {
this.listenBack(view);
}
// eslint-disable-next-line class-methods-use-this
async openConversation(
conversationId: string,
messageId?: string
@ -2989,7 +2983,6 @@ export class ConversationView extends window.Backbone.View<ConversationModel> {
return true;
}
// eslint-disable-next-line class-methods-use-this
showSendAnywayDialog(
contacts: Array<ConversationModel>,
confirmText?: string
@ -3427,7 +3420,6 @@ export class ConversationView extends window.Backbone.View<ConversationModel> {
window.reduxActions.linkPreviews.removeLinkPreview();
}
// eslint-disable-next-line class-methods-use-this
async getStickerPackPreview(
url: string,
abortSignal: Readonly<AbortSignal>
@ -3529,7 +3521,6 @@ export class ConversationView extends window.Backbone.View<ConversationModel> {
}
}
// eslint-disable-next-line class-methods-use-this
async getGroupPreview(
url: string,
abortSignal: Readonly<AbortSignal>