diff --git a/package.json b/package.json index 00c7a2d13..38f471517 100644 --- a/package.json +++ b/package.json @@ -33,9 +33,8 @@ "test-node-coverage": "nyc --reporter=lcov --reporter=text mocha --recursive test/app test/modules ts/test", "eslint": "eslint .", "lint": "yarn format --list-different && yarn lint-windows", - "lint-windows": "yarn eslint && yarn tslint", + "lint-windows": "yarn eslint", "lint-deps": "node ts/util/lint/linter.js", - "tslint": "tslint --format stylish --project .", "format": "prettier --write \"*.{css,js,json,md,scss,ts,tsx}\" \"./**/*.{css,js,json,md,scss,ts,tsx}\"", "transpile": "tsc", "clean-transpile": "rimraf ts/**/*.js && rimraf ts/*.js", @@ -252,9 +251,6 @@ "style-loader": "1.0.0", "ts-loader": "4.1.0", "ts-node": "8.3.0", - "tslint": "6", - "tslint-microsoft-contrib": "6.2.0", - "tslint-react": "3.6.0", "typed-scss-modules": "0.0.11", "typescript": "3.7.4", "webpack": "4.39.2", diff --git a/sticker-creator/app/stages/MetaStage.tsx b/sticker-creator/app/stages/MetaStage.tsx index e58277f8d..e5aabc519 100644 --- a/sticker-creator/app/stages/MetaStage.tsx +++ b/sticker-creator/app/stages/MetaStage.tsx @@ -10,7 +10,6 @@ import { ConfirmModal } from '../../components/ConfirmModal'; import { stickersDuck } from '../../store'; import { useI18n } from '../../util/i18n'; -// tslint:disable-next-line max-func-body-length export const MetaStage: React.ComponentType = () => { const i18n = useI18n(); const actions = stickersDuck.useStickerActions(); @@ -91,7 +90,6 @@ export const MetaStage: React.ComponentType = () => { alt="Cover" /> ) : null} - {/* tslint:disable-next-line react-a11y-input-elements */} diff --git a/sticker-creator/app/stages/UploadStage.tsx b/sticker-creator/app/stages/UploadStage.tsx index bd8ba62af..d68b458eb 100644 --- a/sticker-creator/app/stages/UploadStage.tsx +++ b/sticker-creator/app/stages/UploadStage.tsx @@ -25,7 +25,6 @@ export const UploadStage: React.ComponentType = () => { const [complete, setComplete] = React.useState(0); React.useEffect(() => { - // tslint:disable-next-line: no-floating-promises (async () => { const onProgress = () => { setComplete(i => i + 1); diff --git a/sticker-creator/components/ConfirmModal.tsx b/sticker-creator/components/ConfirmModal.tsx index 4c4c7cc43..40508ce2f 100644 --- a/sticker-creator/components/ConfirmModal.tsx +++ b/sticker-creator/components/ConfirmModal.tsx @@ -5,37 +5,34 @@ import { ConfirmDialog, Props } from '../elements/ConfirmDialog'; export type Mode = 'removable' | 'pick-emoji' | 'add'; -export const ConfirmModal = React.memo( - // tslint:disable-next-line max-func-body-length - (props: Props) => { - const { onCancel } = props; - const [popperRoot, setPopperRoot] = React.useState(); +export const ConfirmModal = React.memo((props: Props) => { + const { onCancel } = props; + const [popperRoot, setPopperRoot] = React.useState(); - // Create popper root and handle outside clicks - React.useEffect(() => { - const root = document.createElement('div'); - setPopperRoot(root); - document.body.appendChild(root); - const handleOutsideClick = ({ target }: MouseEvent) => { - if (!root.contains(target as Node)) { - onCancel(); - } - }; - document.addEventListener('click', handleOutsideClick); + // Create popper root and handle outside clicks + React.useEffect(() => { + const root = document.createElement('div'); + setPopperRoot(root); + document.body.appendChild(root); + const handleOutsideClick = ({ target }: MouseEvent) => { + if (!root.contains(target as Node)) { + onCancel(); + } + }; + document.addEventListener('click', handleOutsideClick); - return () => { - document.body.removeChild(root); - document.removeEventListener('click', handleOutsideClick); - }; - }, [onCancel]); + return () => { + document.body.removeChild(root); + document.removeEventListener('click', handleOutsideClick); + }; + }, [onCancel]); - return popperRoot - ? createPortal( - - - , - popperRoot - ) - : null; - } -); + return popperRoot + ? createPortal( + + + , + popperRoot + ) + : null; +}); diff --git a/sticker-creator/components/StickerFrame.tsx b/sticker-creator/components/StickerFrame.tsx index 54022cebd..abab5da5d 100644 --- a/sticker-creator/components/StickerFrame.tsx +++ b/sticker-creator/components/StickerFrame.tsx @@ -63,7 +63,6 @@ const ImageHandle = SortableHandle((props: { src: string }) => ( )); export const StickerFrame = React.memo( - // tslint:disable-next-line max-func-body-length ({ id, emojiData, diff --git a/sticker-creator/components/StickerGrid.tsx b/sticker-creator/components/StickerGrid.tsx index 33c2ec835..819288086 100644 --- a/sticker-creator/components/StickerGrid.tsx +++ b/sticker-creator/components/StickerGrid.tsx @@ -50,7 +50,6 @@ const InnerGrid = SortableContainer( async paths => { actions.initializeStickers(paths); paths.forEach(path => { - // tslint:disable-next-line no-floating-promises queue.add(async () => { try { const webp = await convertToWebp(path); diff --git a/sticker-creator/elements/DropZone.tsx b/sticker-creator/elements/DropZone.tsx index 36b1e1de7..036e22225 100644 --- a/sticker-creator/elements/DropZone.tsx +++ b/sticker-creator/elements/DropZone.tsx @@ -45,7 +45,6 @@ export const DropZone: React.ComponentType = props => { return ( - {/* tslint:disable-next-line */} diff --git a/sticker-creator/elements/LabeledCheckbox.tsx b/sticker-creator/elements/LabeledCheckbox.tsx index 4348ce264..c65e4d646 100644 --- a/sticker-creator/elements/LabeledCheckbox.tsx +++ b/sticker-creator/elements/LabeledCheckbox.tsx @@ -26,7 +26,6 @@ export const LabeledCheckbox = React.memo( return ( - {/* tslint:disable-next-line react-a11y-input-elements */} ; export const EmojiButton = React.memo( - // tslint:disable-next-line:max-func-body-length ({ i18n, doSend, diff --git a/ts/components/emoji/EmojiPicker.tsx b/ts/components/emoji/EmojiPicker.tsx index 2e2671e00..bf82b8344 100644 --- a/ts/components/emoji/EmojiPicker.tsx +++ b/ts/components/emoji/EmojiPicker.tsx @@ -57,7 +57,6 @@ const categories = [ export const EmojiPicker = React.memo( React.forwardRef( - // tslint:disable-next-line max-func-body-length ( { i18n, diff --git a/ts/components/emoji/lib.ts b/ts/components/emoji/lib.ts index 99aae7f20..d0df46bc6 100644 --- a/ts/components/emoji/lib.ts +++ b/ts/components/emoji/lib.ts @@ -82,7 +82,6 @@ const data = (untypedData as Array) ); const ROOT_PATH = get( - // tslint:disable-next-line no-typeof-undefined typeof window !== 'undefined' ? window : null, 'ROOT_PATH', '' @@ -104,7 +103,6 @@ export const preloadImages = async (): Promise => { img.onerror = reject; img.src = src; images.add(img); - // tslint:disable-next-line no-string-based-set-timeout setTimeout(reject, 5000); }); @@ -112,12 +110,10 @@ export const preloadImages = async (): Promise => { const start = Date.now(); data.forEach(emoji => { - // tslint:disable-next-line no-floating-promises promise-function-async imageQueue.add(() => preload(makeImagePath(emoji.image))); if (emoji.skin_variations) { Object.values(emoji.skin_variations).forEach(variation => { - // tslint:disable-next-line no-floating-promises promise-function-async imageQueue.add(() => preload(makeImagePath(variation.image))); }); } diff --git a/ts/services/groupCredentialFetcher.ts b/ts/services/groupCredentialFetcher.ts index c74b6f3dd..2e913f6e1 100644 --- a/ts/services/groupCredentialFetcher.ts +++ b/ts/services/groupCredentialFetcher.ts @@ -31,7 +31,6 @@ function getTodayInEpoch() { } async function sleep(ms: number) { - // tslint:disable-next-line no-string-based-set-timeout return new Promise(resolve => setTimeout(resolve, ms)); } diff --git a/ts/services/notify.ts b/ts/services/notify.ts index 974aa14ec..94cf564b5 100644 --- a/ts/services/notify.ts +++ b/ts/services/notify.ts @@ -41,7 +41,6 @@ export function notify({ if (!silent && audioNotificationSupport === AudioNotificationSupport.Custom) { // We kick off the sound to be played. No neet to await it. - // tslint:disable-next-line no-floating-promises new Sound({ src: 'sounds/notification.ogg' }).play(); } diff --git a/ts/services/storage.ts b/ts/services/storage.ts index f9768e5b9..87f066fcd 100644 --- a/ts/services/storage.ts +++ b/ts/services/storage.ts @@ -117,7 +117,6 @@ type GeneratedManifestType = { storageManifest: StorageManifestClass; }; -/* tslint:disable-next-line max-func-body-length */ async function generateManifest( version: number, isNewManifest = false @@ -581,7 +580,6 @@ async function mergeRecord( }; } -/* tslint:disable-next-line max-func-body-length */ async function processManifest( manifest: ManifestRecordClass ): Promise { diff --git a/ts/services/storageRecordOps.ts b/ts/services/storageRecordOps.ts index 4fd643ca8..edcd77e90 100644 --- a/ts/services/storageRecordOps.ts +++ b/ts/services/storageRecordOps.ts @@ -1,4 +1,3 @@ -/* tslint:disable no-backbone-get-set-outside-model */ import { isNumber } from 'lodash'; import { @@ -405,7 +404,6 @@ export async function mergeGroupV2Record( const isFirstSync = !isNumber(window.storage.get('manifestVersion')); const dropInitialJoinMessage = isFirstSync; - // tslint:disable-next-line no-floating-promises waitThenMaybeUpdateGroup({ conversation, dropInitialJoinMessage, diff --git a/ts/sql/Client.ts b/ts/sql/Client.ts index d852146fa..52b36b759 100644 --- a/ts/sql/Client.ts +++ b/ts/sql/Client.ts @@ -273,10 +273,8 @@ function _cleanData(data: any, path = 'root') { if (isFunction(value)) { // To prepare for Electron v9 IPC, we need to take functions off of any object - // tslint:disable-next-line no-dynamic-delete delete data[key]; } else if (isFunction(value.toNumber)) { - // tslint:disable-next-line no-dynamic-delete data[key] = value.toNumber(); } else if (Array.isArray(value)) { data[key] = value.map((item, mapIndex) => @@ -398,7 +396,6 @@ function _removeJob(id: number) { return; } - // tslint:disable-next-line no-dynamic-delete delete _jobs[id]; if (_shutdownCallback) { diff --git a/ts/sql/Server.ts b/ts/sql/Server.ts index eb4211224..34299d19c 100644 --- a/ts/sql/Server.ts +++ b/ts/sql/Server.ts @@ -5,7 +5,6 @@ /* eslint-disable no-restricted-syntax */ /* eslint-disable no-console */ /* eslint-disable @typescript-eslint/no-explicit-any */ -// tslint:disable no-console no-default-export no-unnecessary-local-variable import { join } from 'path'; import mkdirp from 'mkdirp'; @@ -1340,7 +1339,6 @@ async function updateToSchemaVersion19( } } -// tslint:disable-next-line max-func-body-length async function updateToSchemaVersion20( currentVersion: number, instance: PromisifiedSQLDatabase @@ -1453,7 +1451,6 @@ async function updateToSchemaVersion20( ); // Update group conversations, point members at new conversation ids - // tslint:disable-next-line no-floating-promises migrationJobQueue.addAll( groupConverations.map(groupRow => async () => { const members = groupRow.members.split(/\s?\+/).filter(Boolean); @@ -1649,7 +1646,6 @@ let globalInstance: PromisifiedSQLDatabase | undefined; let databaseFilePath: string | undefined; let indexedDBPath: string | undefined; -// tslint:disable-next-line max-func-body-length async function initialize({ configDir, key, @@ -2418,7 +2414,6 @@ async function getMessageCount(conversationId?: string) { return row['count(*)']; } -// tslint:disable-next-line max-func-body-length async function saveMessage( data: MessageType, { forceSave }: { forceSave?: boolean } = {} @@ -3956,7 +3951,6 @@ async function removeKnownAttachments(allAttachments: Array) { forEach(messages, message => { const externalFiles = getExternalFilesForMessage(message); forEach(externalFiles, file => { - // tslint:disable-next-line no-dynamic-delete delete lookup[file]; }); }); @@ -4000,7 +3994,6 @@ async function removeKnownAttachments(allAttachments: Array) { forEach(conversations, conversation => { const externalFiles = getExternalFilesForConversation(conversation); forEach(externalFiles, file => { - // tslint:disable-next-line no-dynamic-delete delete lookup[file]; }); }); @@ -4048,7 +4041,6 @@ async function removeKnownStickers(allStickers: Array) { const files: Array = map(rows, row => row.path); forEach(files, file => { - // tslint:disable-next-line no-dynamic-delete delete lookup[file]; }); @@ -4101,7 +4093,6 @@ async function removeKnownDraftAttachments(allStickers: Array) { forEach(conversations, conversation => { const externalFiles = getExternalDraftFilesForConversation(conversation); forEach(externalFiles, file => { - // tslint:disable-next-line no-dynamic-delete delete lookup[file]; }); }); diff --git a/ts/state/createStore.ts b/ts/state/createStore.ts index e0710c037..85ae01d78 100644 --- a/ts/state/createStore.ts +++ b/ts/state/createStore.ts @@ -27,7 +27,6 @@ const directConsole = { group: console.group, groupEnd: console.groupEnd, warn: console.warn, - // tslint:disable-next-line no-console error: console.error, }; diff --git a/ts/state/ducks/calling.ts b/ts/state/ducks/calling.ts index 844289bc2..5cacbb6b3 100644 --- a/ts/state/ducks/calling.ts +++ b/ts/state/ducks/calling.ts @@ -203,7 +203,6 @@ export type CallingActionType = function acceptCall( payload: AcceptCallType ): AcceptCallActionType | NoopActionType { - // tslint:disable-next-line no-floating-promises (async () => { try { await calling.accept(payload.callId, payload.asVideoCall); @@ -317,7 +316,6 @@ function incomingCall(payload: IncomingCallType): IncomingCallActionType { } function outgoingCall(payload: OutgoingCallType): OutgoingCallActionType { - // tslint:disable-next-line no-floating-promises callingTones.playRingtone(); return { @@ -436,7 +434,6 @@ function getEmptyState(): CallingStateType { }; } -// tslint:disable-next-line max-func-body-length export function reducer( state: CallingStateType = getEmptyState(), action: CallingActionType diff --git a/ts/state/ducks/conversations.ts b/ts/state/ducks/conversations.ts index 5ae471d13..36694bca0 100644 --- a/ts/state/ducks/conversations.ts +++ b/ts/state/ducks/conversations.ts @@ -601,7 +601,6 @@ function getEmptyState(): ConversationsStateType { }; } -// tslint:disable-next-line cyclomatic-complexity function hasMessageHeightChanged( message: MessageType, previous: MessageType @@ -673,7 +672,6 @@ function hasMessageHeightChanged( return false; } -// tslint:disable-next-line cyclomatic-complexity max-func-body-length export function reducer( state: ConversationsStateType = getEmptyState(), action: ConversationActionType diff --git a/ts/state/ducks/items.ts b/ts/state/ducks/items.ts index 684ab55e9..3059c9f89 100644 --- a/ts/state/ducks/items.ts +++ b/ts/state/ducks/items.ts @@ -80,7 +80,6 @@ function putItemExternal(key: string, value: unknown): ItemPutExternalAction { } function removeItem(key: string): ItemRemoveAction { - // tslint:disable-next-line no-floating-promises storageShim.remove(key); return { diff --git a/ts/state/ducks/search.ts b/ts/state/ducks/search.ts index c7963e958..5a282a762 100644 --- a/ts/state/ducks/search.ts +++ b/ts/state/ducks/search.ts @@ -333,7 +333,6 @@ function getEmptyState(): SearchStateType { }; } -// tslint:disable-next-line cyclomatic-complexity max-func-body-length export function reducer( state: SearchStateType = getEmptyState(), action: SearchActionType diff --git a/ts/state/ducks/stickers.ts b/ts/state/ducks/stickers.ts index e10300c58..515ff210d 100644 --- a/ts/state/ducks/stickers.ts +++ b/ts/state/ducks/stickers.ts @@ -222,7 +222,6 @@ function downloadStickerPack( const { finalStatus } = options || { finalStatus: undefined }; // We're just kicking this off, since it will generate more redux events - // tslint:disable-next-line:no-floating-promises externalDownloadStickerPack(packId, packKey, { finalStatus }); return { @@ -370,7 +369,6 @@ function getEmptyState(): StickersStateType { }; } -// tslint:disable-next-line max-func-body-length export function reducer( state: StickersStateType = getEmptyState(), action: StickersActionType diff --git a/ts/state/selectors/search.ts b/ts/state/selectors/search.ts index f8c00eb9d..9e35a1a47 100644 --- a/ts/state/selectors/search.ts +++ b/ts/state/selectors/search.ts @@ -85,7 +85,6 @@ export const getSearchResults = createSelector( lookup: ConversationLookupType, selectedConversationId?: string, selectedMessageId?: string - // tslint:disable-next-line max-func-body-length ): SearchResultsPropsType | undefined => { const { contacts, diff --git a/ts/textsecure/AccountManager.ts b/ts/textsecure/AccountManager.ts index 9a6c5a9c3..accb7e284 100644 --- a/ts/textsecure/AccountManager.ts +++ b/ts/textsecure/AccountManager.ts @@ -169,7 +169,6 @@ export default class AccountManager extends EventTarget { ); } - // tslint:disable-next-line max-func-body-length async registerSecondDevice( setProvisioningUrl: Function, confirmNumber: (number?: string) => Promise, @@ -385,7 +384,6 @@ export default class AccountManager extends EventTarget { e.code <= 599 ) { const rejections = - // tslint:disable-next-line restrict-plus-operands 1 + window.textsecure.storage.get('signedKeyRotationRejected', 0); await window.textsecure.storage.put( 'signedKeyRotationRejected', @@ -476,7 +474,6 @@ export default class AccountManager extends EventTarget { }); } - // tslint:disable max-func-body-length async createAccount( number: string, verificationCode: string, diff --git a/ts/textsecure/EventTarget.ts b/ts/textsecure/EventTarget.ts index 2200936ff..7c06544c4 100644 --- a/ts/textsecure/EventTarget.ts +++ b/ts/textsecure/EventTarget.ts @@ -76,7 +76,6 @@ export default class EventTarget { extend(source: any): any { const target = this as any; - // tslint:disable-next-line forin no-for-in no-default-export for (const prop in source) { target[prop] = source[prop]; } diff --git a/ts/textsecure/Helpers.ts b/ts/textsecure/Helpers.ts index d3dd17e51..8b626498b 100644 --- a/ts/textsecure/Helpers.ts +++ b/ts/textsecure/Helpers.ts @@ -2,7 +2,6 @@ /* eslint-disable no-restricted-syntax */ /* eslint-disable no-proto */ /* eslint-disable @typescript-eslint/no-explicit-any */ -// tslint:disable no-default-export import { ByteBufferClass } from '../window.d'; diff --git a/ts/textsecure/MessageReceiver.ts b/ts/textsecure/MessageReceiver.ts index 4e1c78994..c702ab00b 100644 --- a/ts/textsecure/MessageReceiver.ts +++ b/ts/textsecure/MessageReceiver.ts @@ -197,7 +197,6 @@ class MessageReceiverInner extends EventTarget { }); if (options.retryCached) { - // tslint:disable-next-line no-floating-promises this.pendingQueue.add(async () => this.queueAllCached()); } } @@ -307,7 +306,6 @@ class MessageReceiverInner extends EventTarget { } async dispatchAndWait(event: Event) { - // tslint:disable-next-line no-floating-promises this.appQueue.add(async () => Promise.all(this.dispatchEvent(event))); return Promise.resolve(); @@ -353,7 +351,6 @@ class MessageReceiverInner extends EventTarget { request.respond(200, 'OK'); if (request.verb === 'PUT' && request.path === '/api/v1/queue/empty') { - // tslint:disable-next-line no-floating-promises this.incomingQueue.add(() => { this.onEmpty(); }); @@ -427,7 +424,6 @@ class MessageReceiverInner extends EventTarget { } }; - // tslint:disable-next-line no-floating-promises this.incomingQueue.add(job); } @@ -496,12 +492,10 @@ class MessageReceiverInner extends EventTarget { ); // We don't await here because we don't want this to gate future message processing - // tslint:disable-next-line no-floating-promises this.appQueue.add(emitEmpty); }; const waitForIncomingQueue = () => { - // tslint:disable-next-line no-floating-promises this.addToQueue(waitForPendingQueue); // Note: this.count is used in addToQueue @@ -511,11 +505,9 @@ class MessageReceiverInner extends EventTarget { const waitForCacheAddBatcher = async () => { await this.cacheAddBatcher.onIdle(); - // tslint:disable-next-line no-floating-promises this.incomingQueue.add(waitForIncomingQueue); }; - // tslint:disable-next-line no-floating-promises waitForCacheAddBatcher(); } @@ -590,10 +582,8 @@ class MessageReceiverInner extends EventTarget { } else { throw new Error('Cached decrypted value was not a string!'); } - // tslint:disable-next-line no-floating-promises this.queueDecryptedEnvelope(envelope, payloadPlaintext); } else { - // tslint:disable-next-line no-floating-promises this.queueEnvelope(envelope); } } catch (error) { @@ -639,7 +629,6 @@ class MessageReceiverInner extends EventTarget { if (this.isEmptied) { this.clearRetryTimeout(); this.retryCachedTimeout = setTimeout(() => { - // tslint:disable-next-line no-floating-promises this.pendingQueue.add(async () => this.queueAllCached()); }, RETRY_TIMEOUT); } @@ -695,7 +684,6 @@ class MessageReceiverInner extends EventTarget { await window.textsecure.storage.unprocessed.batchAdd(dataArray); items.forEach(item => { item.request.respond(200, 'OK'); - // tslint:disable-next-line no-floating-promises this.queueEnvelope(item.envelope); }); @@ -862,7 +850,6 @@ class MessageReceiverInner extends EventTarget { } async onDeliveryReceipt(envelope: EnvelopeClass) { - // tslint:disable-next-line promise-must-complete return new Promise((resolve, reject) => { const ev = new Event('delivery'); ev.confirm = this.removeFromCache.bind(this, envelope); @@ -894,7 +881,6 @@ class MessageReceiverInner extends EventTarget { return plaintext; } - // tslint:disable-next-line max-func-body-length async decrypt( envelope: EnvelopeClass, ciphertext: any @@ -1505,7 +1491,6 @@ class MessageReceiverInner extends EventTarget { return sentMessage.destination || sentMessage.destinationUuid; } - // tslint:disable-next-line cyclomatic-complexity async handleSyncMessage( envelope: EnvelopeClass, syncMessage: SyncMessageClass @@ -1767,7 +1752,6 @@ class MessageReceiverInner extends EventTarget { // Note: we do not return here because we don't want to block the next message on // this attachment download and a lot of processing of that attachment. - // tslint:disable-next-line no-floating-promises this.handleAttachment(blob).then(async attachmentPointer => { const results = []; const contactBuffer = new ContactBuffer(attachmentPointer.data); @@ -1806,7 +1790,6 @@ class MessageReceiverInner extends EventTarget { // Note: we do not return here because we don't want to block the next message on // this attachment download and a lot of processing of that attachment. - // tslint:disable-next-line no-floating-promises this.handleAttachment(blob).then(async attachmentPointer => { const groupBuffer = new GroupBuffer(attachmentPointer.data); let groupDetails = groupBuffer.next() as any; @@ -1966,7 +1949,6 @@ class MessageReceiverInner extends EventTarget { ); } - // tslint:disable-next-line max-func-body-length cyclomatic-complexity async processDecrypted(envelope: EnvelopeClass, decrypted: DataMessageClass) { /* eslint-disable no-bitwise, no-param-reassign */ const FLAGS = window.textsecure.protobuf.DataMessage.Flags; diff --git a/ts/textsecure/OutgoingMessage.ts b/ts/textsecure/OutgoingMessage.ts index 56adc251e..5792fecbb 100644 --- a/ts/textsecure/OutgoingMessage.ts +++ b/ts/textsecure/OutgoingMessage.ts @@ -148,7 +148,6 @@ export default class OutgoingMessage { }); } - // tslint:disable-next-line max-func-body-length async getKeysForIdentifier( identifier: string, updateDevices: Array @@ -322,7 +321,6 @@ export default class OutgoingMessage { return this.plaintext; } - // tslint:disable-next-line max-func-body-length async doSendMessage( identifier: string, deviceIds: Array, @@ -357,7 +355,6 @@ export default class OutgoingMessage { const ourUuid = window.textsecure.storage.user.getUuid(); const ourDeviceId = window.textsecure.storage.user.getDeviceId(); if ((identifier === ourNumber || identifier === ourUuid) && !sealedSender) { - // tslint:disable-next-line no-parameter-reassignment deviceIds = reject( deviceIds, deviceId => diff --git a/ts/textsecure/SendMessage.ts b/ts/textsecure/SendMessage.ts index 55db0c8a2..d9fddf6b4 100644 --- a/ts/textsecure/SendMessage.ts +++ b/ts/textsecure/SendMessage.ts @@ -152,7 +152,6 @@ class Message { attachmentPointers?: Array; - // tslint:disable cyclomatic-complexity constructor(options: MessageOptionsType) { this.attachments = options.attachments || []; this.body = options.body; @@ -600,7 +599,6 @@ export default class MessageSender { ); recipients.forEach(identifier => { - // tslint:disable-next-line no-floating-promises this.queueJobForIdentifier(identifier, async () => outgoing.sendToIdentifier(identifier) ); diff --git a/ts/textsecure/TaskWithTimeout.ts b/ts/textsecure/TaskWithTimeout.ts index c87a3bb70..dd28f9843 100644 --- a/ts/textsecure/TaskWithTimeout.ts +++ b/ts/textsecure/TaskWithTimeout.ts @@ -1,5 +1,3 @@ -// tslint:disable no-default-export - export default function createTaskWithTimeout( task: () => Promise, id: string, diff --git a/ts/textsecure/WebsocketResources.ts b/ts/textsecure/WebsocketResources.ts index 52cb7e514..3a6f12114 100644 --- a/ts/textsecure/WebsocketResources.ts +++ b/ts/textsecure/WebsocketResources.ts @@ -134,7 +134,6 @@ export default class WebSocketResource extends EventTarget { keepalive?: KeepAlive; - // tslint:disable-next-line max-func-body-length constructor(socket: WebSocket, opts: any = {}) { super(); diff --git a/ts/textsecure/index.ts b/ts/textsecure/index.ts index 1cc8a7ae9..c29a7a013 100644 --- a/ts/textsecure/index.ts +++ b/ts/textsecure/index.ts @@ -1,5 +1,3 @@ -// tslint:disable no-default-export - import EventTarget from './EventTarget'; import AccountManager from './AccountManager'; import MessageReceiver from './MessageReceiver'; diff --git a/ts/util/batcher.ts b/ts/util/batcher.ts index e005b261d..cfb827ca6 100644 --- a/ts/util/batcher.ts +++ b/ts/util/batcher.ts @@ -29,7 +29,6 @@ export type BatcherType = { }; async function sleep(ms: number): Promise { - // tslint:disable-next-line:no-string-based-set-timeout await new Promise(resolve => setTimeout(resolve, ms)); } @@ -44,7 +43,6 @@ export function createBatcher( function _kickBatchOff() { const itemsRef = items; items = []; - // tslint:disable-next-line:no-floating-promises queue.add(async () => { await options.processBatch(itemsRef); }); diff --git a/ts/util/combineNames.ts b/ts/util/combineNames.ts index 4fc382b8e..6cbf2104b 100644 --- a/ts/util/combineNames.ts +++ b/ts/util/combineNames.ts @@ -4,8 +4,6 @@ // From https://github.com/mathiasbynens/unicode-12.1.0/tree/master/Block -// tslint:disable variable-name - const CJK_Compatibility = /[\u3300-\u33FF]/; const CJK_Compatibility_Forms = /[\uFE30-\uFE4F]/; const CJK_Compatibility_Ideographs = /[\uF900-\uFAFF]/; diff --git a/ts/util/lint/linter.ts b/ts/util/lint/linter.ts index 61967ca11..2acd2627e 100644 --- a/ts/util/lint/linter.ts +++ b/ts/util/lint/linter.ts @@ -1,5 +1,4 @@ /* eslint-disable no-console */ -// tslint:disable no-console import * as fs from 'fs'; import { join, relative } from 'path'; import normalizePath from 'normalize-path'; @@ -236,7 +235,6 @@ const excludedFilesRegexps = [ '^node_modules/trough/.+', '^node_modules/ts-loader/.+', '^node_modules/ts-node/.+', - '^node_modules/tslint.+', '^node_modules/tweetnacl/.+', '^node_modules/typed-scss-modules/.+', '^node_modules/typescript/.+', @@ -362,7 +360,6 @@ async function main(): Promise { const exception = exceptionsLookup[exceptionKey]; if (exception && (!exception.line || exception.line === line)) { - // tslint:disable-next-line no-dynamic-delete delete exceptionsLookup[exceptionKey]; return; diff --git a/ts/util/waitBatcher.ts b/ts/util/waitBatcher.ts index 76ad7f97d..7bec92286 100644 --- a/ts/util/waitBatcher.ts +++ b/ts/util/waitBatcher.ts @@ -40,7 +40,6 @@ type BatcherType = { }; async function sleep(ms: number): Promise { - // tslint:disable-next-line:no-string-based-set-timeout await new Promise(resolve => setTimeout(resolve, ms)); } @@ -55,7 +54,6 @@ export function createWaitBatcher( function _kickBatchOff() { const itemsRef = items; items = []; - // tslint:disable-next-line:no-floating-promises queue.add(async () => { try { await options.processBatch(itemsRef.map(item => item.item)); diff --git a/ts/util/windowsZoneIdentifier.ts b/ts/util/windowsZoneIdentifier.ts index 9c48594a8..5772e20f1 100644 --- a/ts/util/windowsZoneIdentifier.ts +++ b/ts/util/windowsZoneIdentifier.ts @@ -28,7 +28,6 @@ export async function writeWindowsZoneIdentifier( throw new Error('writeWindowsZoneIdentifier should only run on Windows'); } - // tslint:disable-next-line non-literal-fs-path if (!fs.existsSync(filePath)) { throw new Error( 'writeWindowsZoneIdentifier could not find the original file' diff --git a/tslint.json b/tslint.json deleted file mode 100644 index d4a09c2d2..000000000 --- a/tslint.json +++ /dev/null @@ -1,206 +0,0 @@ -{ - "defaultSeverity": "error", - "extends": ["tslint:recommended", "tslint-react", "tslint-microsoft-contrib"], - "jsRules": {}, - "rules": { - // prettier is handling this - "align": false, - "newline-per-chained-call": false, - "array-type": [true, "generic"], - "number-literal-format": false, - - // Preferred by Prettier: - "arrow-parens": [true, "ban-single-arg-parens"], - - // Breaks when we use .extend() to create a Backbone subclass - "no-invalid-this": false, - - "import-spacing": false, - "indent": [true, "spaces", 2], - "interface-name": [true, "never-prefix"], - "member-access": false, - "member-ordering": false, - "newline-before-return": false, - "prefer-for-of": false, - "no-this-assignment": false, - "binary-expression-operand-order": false, - "no-backbone-get-set-outside-model": false, - - // Allows us to write inline `style`s. Revisit when we have a more sophisticated - // CSS-in-JS solution: - "jsx-no-multiline-js": false, - - // We'll make tradeoffs where appropriate - "jsx-no-lambda": false, - "react-this-binding-issue": false, - - "linebreak-style": [true, "LF"], - - // Prettier handles this for us - "max-line-length": false, - - "mocha-avoid-only": true, - // Disabled until we can allow dynamically generated tests: - // https://github.com/Microsoft/tslint-microsoft-contrib/issues/85#issuecomment-371749352 - "mocha-no-side-effect-code": false, - "mocha-unneeded-done": true, - - // We always want 'as Type' - "no-angle-bracket-type-assertion": true, - - // mostly always a false positive - "no-backbone-get-set-outside-model": false, - - "no-consecutive-blank-lines": [true, 2], - "object-literal-key-quotes": [true, "as-needed"], - "object-literal-sort-keys": false, - - // Ignore import sources order until we can specify that we want ordering - // based on import name vs module name: - "ordered-imports": [ - true, - { - "import-sources-order": "any", - "named-imports-order": "case-insensitive-legacy" - } - ], - - "quotemark": [ - true, - "single", - "jsx-double", - "avoid-template", - "avoid-escape" - ], - - // Preferred by Prettier: - "semicolon": [true, "always", "ignore-bound-class-methods"], - - // Preferred by Prettier: - "trailing-comma": [ - true, - { - "singleline": "never", - "multiline": { - "objects": "always", - "arrays": "always", - "functions": "never", - "typeLiterals": "always" - }, - "esSpecCompliant": true - } - ], - - // Crashing! - "use-default-type-parameter": false, - - // Disabling a large set of Microsoft-recommended rules - - // Modifying: - - // React components and namespaces are Pascal case - "variable-name": [true, "allow-pascal-case"], - "variable-name": [ - true, - "check-format", - "allow-leading-underscore", - "allow-pascal-case" - ], - - "function-name": [ - true, - { - "function-regex": "^_?[A-Za-z][\\w\\d]+$", - "method-regex": "^_?[a-z][\\w\\d]+$", - "static-method-regex": "^_?[a-z][\\w\\d]+$" - } - ], - - // Adding select dev dependencies here for now, may turn on all in the future - "no-implicit-dependencies": [ - true, - [ - "dashdash", - "electron", - "@storybook/react", - "@storybook/addon-actions", - "@storybook/addon-knobs" - ] - ], - - // So things like "autoplay" on work - "jsx-boolean-value": false, - - // Maybe will turn on: - - // We're not trying to be comprehensive with JSDoc right now. We have the style guide. - "completed-docs": false, - // Today we have files with a single named export which isn't the filename. Eventually. - "export-name": false, - // We have a lot of 'any' in our code today - "no-any": false, - // We use this today, could get rid of it - "no-increment-decrement": false, - // This seems to detect false positives: any multi-level object literal, for example - "no-object-literal-type-assertion": false, - // I like relative references to the current dir, or absolute. Maybe can do this? - "no-relative-imports": false, - // We have a lot of 'any' in our code today - "no-unsafe-any": false, - // Not everything needs to be typed right now - "typedef": false, - - // Probably won't turn on: - - "possible-timing-attack": false, - // We use null - "no-null-keyword": false, - // We want to import a capitalized React, for example - "import-name": false, - // We have the styleguide for better docs - "missing-jsdoc": false, - // 'type' and 'number' are just too common - "no-reserved-keywords": false, - // The style guide needs JSDoc-style block comments to extract proptype documentation - "no-single-line-block-comment": false, - // Out-of-order functions can improve readability - "no-use-before-declare": false, - // We use Array syntax - "prefer-array-literal": false, - // We prefer key: () => void syntax, because it suggests an object instead of a class - "prefer-method-signature": false, - // 'as' is nicer than angle brackets. - "prefer-type-cast": false, - // We use || and && shortcutting because we're javascript programmers - "strict-boolean-expressions": false - }, - "rulesDirectory": ["node_modules/tslint-microsoft-contrib"], - "linterOptions": { - "exclude": [ - "sticker-creator/**/*.ts", - "sticker-creator/**/*.tsx", - "ts/*.ts", - "ts/backbone/**", - "ts/build/**", - "ts/components/*.ts[x]", - "ts/components/conversation/**", - "ts/components/emoji/**", - "ts/components/stickers/**", - "ts/models/**", - "ts/notifications/**", - "ts/protobuf/**", - "ts/scripts/**", - "ts/services/**", - "ts/shims/**", - "ts/sql/**", - "ts/state/**", - "ts/storybook/**", - "ts/test/**", - "ts/textsecure/**", - "ts/types/**", - "ts/updater/**", - "ts/util/**", - "ts/views/**" - ] - } -} diff --git a/webpack.config.ts b/webpack.config.ts index 3e5520650..b793d4e94 100644 --- a/webpack.config.ts +++ b/webpack.config.ts @@ -1,7 +1,6 @@ import { resolve } from 'path'; // eslint-disable-next-line import/no-extraneous-dependencies import { Configuration, EnvironmentPlugin } from 'webpack'; -// tslint:disable-next-line no-require-imports import HtmlWebpackPlugin = require('html-webpack-plugin'); const context = __dirname; @@ -86,5 +85,4 @@ const stickerCreatorConfig: Configuration = { }, }; -// tslint:disable-next-line no-default-export export default [stickerCreatorConfig]; diff --git a/yarn.lock b/yarn.lock index 8c2a22360..0cb246648 100644 --- a/yarn.lock +++ b/yarn.lock @@ -4369,7 +4369,7 @@ builder-util@22.3.6, builder-util@~22.3.6: stat-mode "^1.0.0" temp-file "^3.3.7" -builtin-modules@^1.0.0, builtin-modules@^1.1.1: +builtin-modules@^1.0.0: version "1.1.1" resolved "https://registry.yarnpkg.com/builtin-modules/-/builtin-modules-1.1.1.tgz#270f076c5a72c02f5b65a47df94c5fe3a278892f" @@ -4982,10 +4982,6 @@ commander@2.17.x: resolved "https://registry.yarnpkg.com/commander/-/commander-2.17.1.tgz#bd77ab7de6de94205ceacc72f1716d29f20a77bf" integrity sha512-wPMUt6FnH2yzG95SA6mzjQOEKUU3aLaDEmzs1ti+1E9h+CsrZghRlqEM/EJ4KscsQVG8uNN4uVreUeT8+drlgg== -commander@^2.12.1: - version "2.15.1" - resolved "https://registry.yarnpkg.com/commander/-/commander-2.15.1.tgz#df46e867d0fc2aec66a34662b406a9ccafff5b0f" - commander@^2.19.0, commander@^2.20.0, commander@~2.20.0: version "2.20.0" resolved "https://registry.yarnpkg.com/commander/-/commander-2.20.0.tgz#d58bb2b5c1ee8f87b0d340027e9e94e222c5a422" @@ -10859,7 +10855,7 @@ mkdirp@0.5.2: dependencies: minimist "^1.2.5" -mkdirp@0.5.x, "mkdirp@>=0.5 0", mkdirp@^0.5.0, mkdirp@^0.5.1, mkdirp@^0.5.3, mkdirp@~0.5.1: +mkdirp@0.5.x, "mkdirp@>=0.5 0", mkdirp@^0.5.0, mkdirp@^0.5.1, mkdirp@~0.5.1: version "0.5.5" resolved "https://registry.yarnpkg.com/mkdirp/-/mkdirp-0.5.5.tgz#d91cefd62d1436ca0f41620e251288d420099def" integrity sha512-NKmAlESf6jMGym1++R0Ra7wvhV+wFW63FaSOFPwRahvea0gMUcGUhVeAg/0BC0wiv9ih5NYPB1Wn1UEI1/L+xQ== @@ -16073,11 +16069,6 @@ tslib@1.11.1, tslib@^1, tslib@^1.10.0, tslib@^1.11.1, tslib@^1.9.3: resolved "https://registry.yarnpkg.com/tslib/-/tslib-1.11.1.tgz#eb15d128827fbee2841549e171f45ed338ac7e35" integrity sha512-aZW88SY8kQbU7gpV19lN24LtXh/yD4ZZg6qieAJDDg+YBsJcSmLGK9QpnUjAKVG/xefmvJGd1WUmfpT/g6AJGA== -tslib@^1.13.0: - version "1.13.0" - resolved "https://registry.yarnpkg.com/tslib/-/tslib-1.13.0.tgz#c881e13cc7015894ed914862d276436fa9a47043" - integrity sha512-i/6DQjL8Xf3be4K/E6Wgpekn5Qasl1usyw++dAA35Ue5orEn65VIxOA+YvNNl9HV3qv70T7CNwjODHZrLwvd1Q== - tslib@^1.8.1: version "1.9.0" resolved "https://registry.yarnpkg.com/tslib/-/tslib-1.9.0.tgz#e37a86fda8cbbaf23a057f473c9f4dc64e5fc2e8" @@ -16087,59 +16078,6 @@ tslib@^1.9.0: resolved "https://registry.yarnpkg.com/tslib/-/tslib-1.10.0.tgz#c3c19f95973fb0a62973fb09d90d961ee43e5c8a" integrity sha512-qOebF53frne81cf0S9B41ByenJ3/IuH8yJKngAX35CmiZySA0khhkovshKK+jGCaMnVomla7gVlIcc3EvKPbTQ== -tslint-microsoft-contrib@6.2.0: - version "6.2.0" - resolved "https://registry.yarnpkg.com/tslint-microsoft-contrib/-/tslint-microsoft-contrib-6.2.0.tgz#8aa0f40584d066d05e6a5e7988da5163b85f2ad4" - integrity sha512-6tfi/2tHqV/3CL77pULBcK+foty11Rr0idRDxKnteTaKm6gWF9qmaCNU17HVssOuwlYNyOmd9Jsmjd+1t3a3qw== - dependencies: - tsutils "^2.27.2 <2.29.0" - -tslint-react@3.6.0: - version "3.6.0" - resolved "https://registry.yarnpkg.com/tslint-react/-/tslint-react-3.6.0.tgz#7f462c95c4a0afaae82507f06517ff02942196a1" - integrity sha512-AIv1QcsSnj7e9pFir6cJ6vIncTqxfqeFF3Lzh8SuuBljueYzEAtByuB6zMaD27BL0xhMEqsZ9s5eHuCONydjBw== - dependencies: - tsutils "^2.13.1" - -tslint@6: - version "6.1.3" - resolved "https://registry.yarnpkg.com/tslint/-/tslint-6.1.3.tgz#5c23b2eccc32487d5523bd3a470e9aa31789d904" - integrity sha512-IbR4nkT96EQOvKE2PW/djGz8iGNeJ4rF2mBfiYaR/nvUWYKJhLwimoJKgjIFEIDibBtOevj7BqCRL4oHeWWUCg== - dependencies: - "@babel/code-frame" "^7.0.0" - builtin-modules "^1.1.1" - chalk "^2.3.0" - commander "^2.12.1" - diff "^4.0.1" - glob "^7.1.1" - js-yaml "^3.13.1" - minimatch "^3.0.4" - mkdirp "^0.5.3" - resolve "^1.3.2" - semver "^5.3.0" - tslib "^1.13.0" - tsutils "^2.29.0" - -tsutils@^2.13.1: - version "2.25.1" - resolved "https://registry.yarnpkg.com/tsutils/-/tsutils-2.25.1.tgz#24a46342ab8b174a3fbde632e60dcd11b64982f9" - dependencies: - tslib "^1.8.1" - -"tsutils@^2.27.2 <2.29.0": - version "2.28.0" - resolved "https://registry.yarnpkg.com/tsutils/-/tsutils-2.28.0.tgz#6bd71e160828f9d019b6f4e844742228f85169a1" - integrity sha512-bh5nAtW0tuhvOJnx1GLRn5ScraRLICGyJV5wJhtRWOLsxW70Kk5tZtpK3O/hW6LDnqKS9mlUMPZj9fEMJ0gxqA== - dependencies: - tslib "^1.8.1" - -tsutils@^2.29.0: - version "2.29.0" - resolved "https://registry.yarnpkg.com/tsutils/-/tsutils-2.29.0.tgz#32b488501467acbedd4b85498673a0812aca0b99" - integrity sha512-g5JVHCIJwzfISaXpXE1qvNalca5Jwob6FjI4AoPlqMusJ6ftFE7IkkFoMhVLRgK+4Kx3gkzb8UZK5t5yTTvEmA== - dependencies: - tslib "^1.8.1" - tsutils@^3.17.1: version "3.17.1" resolved "https://registry.yarnpkg.com/tsutils/-/tsutils-3.17.1.tgz#ed719917f11ca0dee586272b2ac49e015a2dd759"