diff --git a/.eslintrc.js b/.eslintrc.js index b14d306b33..0acac950b2 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -95,11 +95,6 @@ const rules = { message: 'for..in loops iterate over the entire prototype chain, which is virtually never what you want. Use Object.{keys,values,entries}, and iterate over the resulting array.', }, - { - selector: 'ForOfStatement', - message: - 'iterators/generators require regenerator-runtime, which is too heavyweight for this guide to allow them. Separately, loops should be avoided in favor of array iterations.', - }, { selector: 'LabeledStatement', message: diff --git a/js/modules/types/message.js b/js/modules/types/message.js index 44e663915c..9499b208b1 100644 --- a/js/modules/types/message.js +++ b/js/modules/types/message.js @@ -1,4 +1,4 @@ -// Copyright 2018-2020 Signal Messenger, LLC +// Copyright 2018-2021 Signal Messenger, LLC // SPDX-License-Identifier: AGPL-3.0-only const { isFunction, isObject, isString, omit } = require('lodash'); @@ -392,7 +392,6 @@ exports.upgradeSchema = async ( } let message = rawMessage; - // eslint-disable-next-line no-restricted-syntax for (let index = 0, max = VERSIONS.length; index < max; index += 1) { if (maxVersion < index) { break; diff --git a/ts/SignalProtocolStore.ts b/ts/SignalProtocolStore.ts index c6aebc53bd..afcaa6d5cd 100644 --- a/ts/SignalProtocolStore.ts +++ b/ts/SignalProtocolStore.ts @@ -2,7 +2,6 @@ // SPDX-License-Identifier: AGPL-3.0-only /* eslint-disable class-methods-use-this */ -/* eslint-disable no-restricted-syntax */ import PQueue from 'p-queue'; import { isNumber } from 'lodash'; diff --git a/ts/challenge.ts b/ts/challenge.ts index 9437d0de6a..d3fb54b446 100644 --- a/ts/challenge.ts +++ b/ts/challenge.ts @@ -1,6 +1,5 @@ // Copyright 2021 Signal Messenger, LLC // SPDX-License-Identifier: AGPL-3.0-only -/* eslint-disable no-restricted-syntax */ // `ChallengeHandler` is responsible for: // 1. tracking the messages that failed to send with 428 error and could be diff --git a/ts/components/DisappearingTimeDialog.tsx b/ts/components/DisappearingTimeDialog.tsx index d92e4fb196..7c3228bdd6 100644 --- a/ts/components/DisappearingTimeDialog.tsx +++ b/ts/components/DisappearingTimeDialog.tsx @@ -1,6 +1,5 @@ // Copyright 2021 Signal Messenger, LLC // SPDX-License-Identifier: AGPL-3.0-only -/* eslint-disable no-restricted-syntax */ import React, { useState } from 'react'; diff --git a/ts/jobs/JobQueue.ts b/ts/jobs/JobQueue.ts index 474c2b18aa..d3a2575b4c 100644 --- a/ts/jobs/JobQueue.ts +++ b/ts/jobs/JobQueue.ts @@ -125,9 +125,6 @@ export abstract class JobQueue { log.info(`${this.logPrefix} starting to stream jobs`); const stream = this.store.stream(this.queueType); - // We want to enqueue the jobs in sequence, not in parallel. `for await ... of` is a - // good way to do that. - // eslint-disable-next-line no-restricted-syntax for await (const storedJob of stream) { this.enqueueStoredJob(storedJob); } diff --git a/ts/linkPreviews/linkPreviewFetch.ts b/ts/linkPreviews/linkPreviewFetch.ts index cb5a200689..e267def028 100644 --- a/ts/linkPreviews/linkPreviewFetch.ts +++ b/ts/linkPreviews/linkPreviewFetch.ts @@ -293,8 +293,6 @@ const getHtmlDocument = async ( let bytesLoadedSoFar = 0; try { - // `for ... of` is much cleaner here, so we allow it. - /* eslint-disable no-restricted-syntax */ for await (let chunk of body) { if (abortSignal.aborted) { break; @@ -322,7 +320,6 @@ const getHtmlDocument = async ( break; } } - /* eslint-enable no-restricted-syntax */ } catch (err) { window.log.warn( 'getHtmlDocument: error when reading body; continuing with what we got' diff --git a/ts/main/NativeThemeNotifier.ts b/ts/main/NativeThemeNotifier.ts index 77e66adcb6..a92b6f8705 100644 --- a/ts/main/NativeThemeNotifier.ts +++ b/ts/main/NativeThemeNotifier.ts @@ -1,6 +1,5 @@ // Copyright 2021 Signal Messenger, LLC // SPDX-License-Identifier: AGPL-3.0-only -/* eslint-disable no-restricted-syntax */ import { ipcMain as ipc, nativeTheme, BrowserWindow } from 'electron'; diff --git a/ts/main/challengeMain.ts b/ts/main/challengeMain.ts index 6cb77c9550..f01d917948 100644 --- a/ts/main/challengeMain.ts +++ b/ts/main/challengeMain.ts @@ -1,6 +1,6 @@ // Copyright 2021 Signal Messenger, LLC // SPDX-License-Identifier: AGPL-3.0-only -/* eslint-disable no-restricted-syntax, no-console */ +/* eslint-disable no-console */ import { ipcMain as ipc, IpcMainEvent } from 'electron'; diff --git a/ts/messages/migrateLegacySendAttributes.ts b/ts/messages/migrateLegacySendAttributes.ts index 8bcaa13af9..7d82f26424 100644 --- a/ts/messages/migrateLegacySendAttributes.ts +++ b/ts/messages/migrateLegacySendAttributes.ts @@ -45,7 +45,6 @@ export function migrateLegacySendAttributes( return undefined; } - /* eslint-disable no-restricted-syntax */ const pendingSendState: SendState = { status: SendStatus.Pending, updatedAt: message.sent_at, @@ -129,7 +128,6 @@ export function migrateLegacySendAttributes( } return sendStateByConversationId; - /* eslint-enable no-restricted-syntax */ } function getConversationIdsFromErrors( diff --git a/ts/models/messages.ts b/ts/models/messages.ts index 813e47d28f..4f88b68856 100644 --- a/ts/models/messages.ts +++ b/ts/models/messages.ts @@ -1237,7 +1237,6 @@ export class MessageModel extends window.Backbone.Model { const recipients: Array = []; const newSendStateByConversationId = { ...oldSendStateByConversationId }; - // eslint-disable-next-line no-restricted-syntax for (const [conversationId, sendState] of Object.entries( oldSendStateByConversationId )) { diff --git a/ts/routineProfileRefresh.ts b/ts/routineProfileRefresh.ts index 04067324b3..61b3594abd 100644 --- a/ts/routineProfileRefresh.ts +++ b/ts/routineProfileRefresh.ts @@ -1,9 +1,6 @@ // Copyright 2021 Signal Messenger, LLC // SPDX-License-Identifier: AGPL-3.0-only -// We use `for ... of` to deal with iterables in several places in this file. -/* eslint-disable no-restricted-syntax */ - import { isNil, sortBy } from 'lodash'; import PQueue from 'p-queue'; diff --git a/ts/sql/Client.ts b/ts/sql/Client.ts index 7138dfee47..9a307e5b7b 100644 --- a/ts/sql/Client.ts +++ b/ts/sql/Client.ts @@ -7,7 +7,6 @@ /* eslint-disable @typescript-eslint/explicit-module-boundary-types */ /* eslint-disable @typescript-eslint/no-explicit-any */ /* eslint-disable @typescript-eslint/ban-types */ -/* eslint-disable no-restricted-syntax */ import { ipcRenderer } from 'electron'; import { diff --git a/ts/sql/Server.ts b/ts/sql/Server.ts index c17b05db43..0fa30a1b6e 100644 --- a/ts/sql/Server.ts +++ b/ts/sql/Server.ts @@ -4,7 +4,6 @@ /* eslint-disable no-nested-ternary */ /* eslint-disable camelcase */ /* eslint-disable @typescript-eslint/explicit-module-boundary-types */ -/* eslint-disable no-restricted-syntax */ /* eslint-disable no-console */ /* eslint-disable @typescript-eslint/no-explicit-any */ diff --git a/ts/sql/cleanDataForIpc.ts b/ts/sql/cleanDataForIpc.ts index e154dcf0cf..8b3a382946 100644 --- a/ts/sql/cleanDataForIpc.ts +++ b/ts/sql/cleanDataForIpc.ts @@ -129,9 +129,6 @@ function cleanDataInner( const result: CleanedArray = []; let index = 0; pathsChanged.push(path); - // `for ... of` is the cleanest way to go through "generic" iterables without - // a helper library. - // eslint-disable-next-line no-restricted-syntax for (const value of dataAsRecord) { result.push( cleanDataInner( diff --git a/ts/test-both/AsyncQueue_test.ts b/ts/test-both/AsyncQueue_test.ts index c20a411f4a..2d1d159be9 100644 --- a/ts/test-both/AsyncQueue_test.ts +++ b/ts/test-both/AsyncQueue_test.ts @@ -1,8 +1,6 @@ // Copyright 2021 Signal Messenger, LLC // SPDX-License-Identifier: AGPL-3.0-only -/* eslint-disable no-restricted-syntax */ - import { assert } from 'chai'; import { AsyncQueue } from '../util/AsyncQueue'; diff --git a/ts/test-both/challenge_test.ts b/ts/test-both/challenge_test.ts index 14b11cce8b..b573221e16 100644 --- a/ts/test-both/challenge_test.ts +++ b/ts/test-both/challenge_test.ts @@ -1,6 +1,6 @@ // Copyright 2021 Signal Messenger, LLC // SPDX-License-Identifier: AGPL-3.0-only -/* eslint-disable no-await-in-loop, no-restricted-syntax */ +/* eslint-disable no-await-in-loop */ /* eslint-disable @typescript-eslint/no-explicit-any */ import { assert } from 'chai'; diff --git a/ts/test-both/processDataMessage_test.ts b/ts/test-both/processDataMessage_test.ts index 91226a3800..c04f74082a 100644 --- a/ts/test-both/processDataMessage_test.ts +++ b/ts/test-both/processDataMessage_test.ts @@ -1,6 +1,5 @@ // Copyright 2021 Signal Messenger, LLC // SPDX-License-Identifier: AGPL-3.0-only -/* eslint-disable no-restricted-syntax */ import { assert } from 'chai'; import Long from 'long'; diff --git a/ts/test-both/util/asyncIterables_test.ts b/ts/test-both/util/asyncIterables_test.ts index b52d4917e3..f04678876d 100644 --- a/ts/test-both/util/asyncIterables_test.ts +++ b/ts/test-both/util/asyncIterables_test.ts @@ -2,7 +2,6 @@ // SPDX-License-Identifier: AGPL-3.0-only /* eslint-disable no-await-in-loop */ -/* eslint-disable no-restricted-syntax */ import { assert } from 'chai'; diff --git a/ts/test-both/util/explodePromise_test.ts b/ts/test-both/util/explodePromise_test.ts index 151fa0971a..5863988540 100644 --- a/ts/test-both/util/explodePromise_test.ts +++ b/ts/test-both/util/explodePromise_test.ts @@ -1,8 +1,6 @@ // Copyright 2021 Signal Messenger, LLC // SPDX-License-Identifier: AGPL-3.0-only -/* eslint-disable no-restricted-syntax */ - import { assert } from 'chai'; import { explodePromise } from '../../util/explodePromise'; diff --git a/ts/test-node/jobs/JobQueueDatabaseStore_test.ts b/ts/test-node/jobs/JobQueueDatabaseStore_test.ts index 89a2bbffb2..5923d9015c 100644 --- a/ts/test-node/jobs/JobQueueDatabaseStore_test.ts +++ b/ts/test-node/jobs/JobQueueDatabaseStore_test.ts @@ -1,8 +1,6 @@ // Copyright 2021 Signal Messenger, LLC // SPDX-License-Identifier: AGPL-3.0-only -/* eslint-disable no-restricted-syntax */ - import { assert } from 'chai'; import * as sinon from 'sinon'; import { noop } from 'lodash'; diff --git a/ts/test-node/jobs/TestJobQueueStore.ts b/ts/test-node/jobs/TestJobQueueStore.ts index 1fc3703103..8f4980a70c 100644 --- a/ts/test-node/jobs/TestJobQueueStore.ts +++ b/ts/test-node/jobs/TestJobQueueStore.ts @@ -2,7 +2,6 @@ // SPDX-License-Identifier: AGPL-3.0-only /* eslint-disable max-classes-per-file */ -/* eslint-disable no-restricted-syntax */ /* eslint-disable no-await-in-loop */ import EventEmitter, { once } from 'events'; diff --git a/ts/test-node/logging/uploadDebugLogs_test.ts b/ts/test-node/logging/uploadDebugLogs_test.ts index 1ad52607e9..d2bc26cb0a 100644 --- a/ts/test-node/logging/uploadDebugLogs_test.ts +++ b/ts/test-node/logging/uploadDebugLogs_test.ts @@ -95,9 +95,6 @@ describe('uploadDebugLogs', () => { { fields: { key: '123' }, url: 'not a valid URL' }, ]; - // We want to make sure these run serially, so we can't use `Promise.all`. They're - // async, so we can't use `forEach`. `for ... of` is a reasonable option here. - // eslint-disable-next-line no-restricted-syntax for (const body of bodies) { this.fakeGet.resolves({ body }); diff --git a/ts/textsecure/MessageReceiver.ts b/ts/textsecure/MessageReceiver.ts index 4cb1d86f2b..c9749206ad 100644 --- a/ts/textsecure/MessageReceiver.ts +++ b/ts/textsecure/MessageReceiver.ts @@ -4,7 +4,6 @@ /* eslint-disable no-bitwise */ /* eslint-disable class-methods-use-this */ /* eslint-disable camelcase */ -/* eslint-disable no-restricted-syntax */ import { isNumber, map } from 'lodash'; import PQueue from 'p-queue'; diff --git a/ts/textsecure/OutgoingMessage.ts b/ts/textsecure/OutgoingMessage.ts index 3bfd2d950e..7aeb1875ef 100644 --- a/ts/textsecure/OutgoingMessage.ts +++ b/ts/textsecure/OutgoingMessage.ts @@ -2,7 +2,6 @@ // SPDX-License-Identifier: AGPL-3.0-only /* eslint-disable guard-for-in */ -/* eslint-disable no-restricted-syntax */ /* eslint-disable class-methods-use-this */ /* eslint-disable @typescript-eslint/no-explicit-any */ /* eslint-disable more/no-then */ diff --git a/ts/textsecure/SocketManager.ts b/ts/textsecure/SocketManager.ts index 89b97a0939..8531769073 100644 --- a/ts/textsecure/SocketManager.ts +++ b/ts/textsecure/SocketManager.ts @@ -1,6 +1,5 @@ // Copyright 2021 Signal Messenger, LLC // SPDX-License-Identifier: AGPL-3.0-only -/* eslint-disable no-restricted-syntax */ import URL from 'url'; import ProxyAgent from 'proxy-agent'; diff --git a/ts/textsecure/Storage.ts b/ts/textsecure/Storage.ts index 15d63f2fd1..58f411393c 100644 --- a/ts/textsecure/Storage.ts +++ b/ts/textsecure/Storage.ts @@ -1,6 +1,5 @@ // Copyright 2020-2021 Signal Messenger, LLC // SPDX-License-Identifier: AGPL-3.0-only -/* eslint-disable no-restricted-syntax */ import { StorageAccessType as Access, diff --git a/ts/textsecure/WebsocketResources.ts b/ts/textsecure/WebsocketResources.ts index f8db3f4f10..f510e2b7f8 100644 --- a/ts/textsecure/WebsocketResources.ts +++ b/ts/textsecure/WebsocketResources.ts @@ -1,7 +1,7 @@ -// Copyright 2020 Signal Messenger, LLC +// Copyright 2020-2021 Signal Messenger, LLC // SPDX-License-Identifier: AGPL-3.0-only -/* eslint-disable max-classes-per-file, no-restricted-syntax */ +/* eslint-disable max-classes-per-file */ /* * WebSocket-Resources * diff --git a/ts/types/Stickers.ts b/ts/types/Stickers.ts index f2caffcf74..ff93f22459 100644 --- a/ts/types/Stickers.ts +++ b/ts/types/Stickers.ts @@ -1,6 +1,5 @@ // Copyright 2019-2021 Signal Messenger, LLC // SPDX-License-Identifier: AGPL-3.0-only -/* eslint-disable no-restricted-syntax */ import { isNumber, pick, reject, groupBy, values } from 'lodash'; import pMap from 'p-map'; diff --git a/ts/util/StartupQueue.ts b/ts/util/StartupQueue.ts index aec3a775f3..3c7ce6e8ef 100644 --- a/ts/util/StartupQueue.ts +++ b/ts/util/StartupQueue.ts @@ -1,6 +1,5 @@ // Copyright 2021 Signal Messenger, LLC // SPDX-License-Identifier: AGPL-3.0-only -/* eslint-disable no-restricted-syntax */ import * as Errors from '../types/errors'; diff --git a/ts/util/asyncIterables.ts b/ts/util/asyncIterables.ts index cd00128baa..4a62c09b37 100644 --- a/ts/util/asyncIterables.ts +++ b/ts/util/asyncIterables.ts @@ -3,7 +3,6 @@ /* eslint-disable max-classes-per-file */ /* eslint-disable no-await-in-loop */ -/* eslint-disable no-restricted-syntax */ export type MaybeAsyncIterable = Iterable | AsyncIterable; diff --git a/ts/util/awaitObject.ts b/ts/util/awaitObject.ts index 31dad716f9..0740781df3 100644 --- a/ts/util/awaitObject.ts +++ b/ts/util/awaitObject.ts @@ -1,6 +1,5 @@ // Copyright 2021 Signal Messenger, LLC // SPDX-License-Identifier: AGPL-3.0-only -/* eslint-disable no-restricted-syntax */ export async function awaitObject( settings: { diff --git a/ts/util/combineNames.ts b/ts/util/combineNames.ts index 86d7134bd3..122d88ea98 100644 --- a/ts/util/combineNames.ts +++ b/ts/util/combineNames.ts @@ -1,4 +1,4 @@ -// Copyright 2020 Signal Messenger, LLC +// Copyright 2020-2021 Signal Messenger, LLC // SPDX-License-Identifier: AGPL-3.0-only /* eslint-disable camelcase */ @@ -56,7 +56,6 @@ export function combineNames( } function isAllCKJV(name: string): boolean { - // eslint-disable-next-line no-restricted-syntax for (const codePoint of name) { if (!isCKJV(codePoint)) { return false; diff --git a/ts/util/dropNull.ts b/ts/util/dropNull.ts index b68b4a4141..7f9f85f208 100644 --- a/ts/util/dropNull.ts +++ b/ts/util/dropNull.ts @@ -1,6 +1,5 @@ // Copyright 2021 Signal Messenger, LLC // SPDX-License-Identifier: AGPL-3.0-only -/* eslint-disable no-restricted-syntax */ export type NullToUndefined = Extract extends never ? T diff --git a/ts/util/emoji.ts b/ts/util/emoji.ts index 45fabf7118..bf0d044370 100644 --- a/ts/util/emoji.ts +++ b/ts/util/emoji.ts @@ -1,6 +1,5 @@ // Copyright 2021 Signal Messenger, LLC // SPDX-License-Identifier: AGPL-3.0-only -/* eslint-disable no-restricted-syntax */ import emojiRegex from 'emoji-regex/es2015/RGI_Emoji'; diff --git a/ts/util/iterables.ts b/ts/util/iterables.ts index 7b8fe404a6..64e1ba98b1 100644 --- a/ts/util/iterables.ts +++ b/ts/util/iterables.ts @@ -2,7 +2,6 @@ // SPDX-License-Identifier: AGPL-3.0-only /* eslint-disable max-classes-per-file */ -/* eslint-disable no-restricted-syntax */ import { getOwn } from './getOwn';