Migrate textsecure to eslint

Co-authored-by: Chris Svenningsen <chris@carbonfive.com>
This commit is contained in:
Sidney Keese 2020-09-24 14:53:21 -07:00 committed by Josh Perez
parent b5df9b4067
commit 7b6d8f55d6
24 changed files with 706 additions and 299 deletions

View file

@ -1,5 +1,10 @@
// tslint:disable no-default-export no-unnecessary-local-variable
/* eslint-disable no-await-in-loop */
/* eslint-disable camelcase */
/* eslint-disable no-param-reassign */
/* eslint-disable no-continue */
/* eslint-disable @typescript-eslint/explicit-module-boundary-types */
/* eslint-disable @typescript-eslint/no-explicit-any */
/* eslint-disable @typescript-eslint/ban-types */
import { ipcRenderer } from 'electron';
import {
@ -241,7 +246,7 @@ const channels: ServerInterface = channelsAsUnknown;
// When IPC arguments are prepared for the cross-process send, they are JSON.stringified.
// We can't send ArrayBuffers or BigNumbers (what we get from proto library for dates),
// We also cannot send objects with function-value keys, like what protobufjs gives us.
function _cleanData(data: any, path: string = 'root') {
function _cleanData(data: any, path = 'root') {
if (data === null || data === undefined) {
window.log.warn(`_cleanData: null or undefined value at path ${path}`);
@ -321,8 +326,6 @@ async function _shutdown() {
}
resolve();
return;
};
});
@ -1032,7 +1035,7 @@ async function getLastConversationActivity(
if (result) {
return new Message(result);
}
return;
return undefined;
}
async function getLastConversationPreview(
conversationId: string,
@ -1045,7 +1048,7 @@ async function getLastConversationPreview(
if (result) {
return new Message(result);
}
return;
return undefined;
}
async function getMessageMetricsForConversation(conversationId: string) {
const result = await channels.getMessageMetricsForConversation(
@ -1292,7 +1295,7 @@ async function getRecentStickers() {
async function updateEmojiUsage(shortName: string) {
await channels.updateEmojiUsage(shortName);
}
async function getRecentEmojis(limit: number = 32) {
async function getRecentEmojis(limit = 32) {
return channels.getRecentEmojis(limit);
}
@ -1336,8 +1339,6 @@ async function callChannel(name: string) {
}
resolve();
return;
});
setTimeout(() => {

View file

@ -1,5 +1,15 @@
/* eslint-disable @typescript-eslint/ban-types */
/* eslint-disable camelcase */
/* eslint-disable @typescript-eslint/no-explicit-any */
import { LocaleMessagesType } from '../types/I18N';
import {
ConversationModelCollectionType,
MessageModelCollectionType,
} from '../model-types.d';
import { MessageModel } from '../models/messages';
import { ConversationModel } from '../models/conversations';
export type AttachmentDownloadJobType = any;
export type ConverationMetricsType = any;
export type ConversationType = any;
@ -17,13 +27,6 @@ export type StickerPackType = any;
export type StickerType = any;
export type UnprocessedType = any;
import {
ConversationModelCollectionType,
MessageModelCollectionType,
} from '../model-types.d';
import { MessageModel } from '../models/messages';
import { ConversationModel } from '../models/conversations';
export interface DataInterface {
close: () => Promise<void>;
removeDB: () => Promise<void>;

View file

@ -1,3 +1,10 @@
/* eslint-disable no-nested-ternary */
/* eslint-disable camelcase */
/* eslint-disable @typescript-eslint/explicit-module-boundary-types */
/* eslint-disable no-await-in-loop */
/* 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';
@ -6,12 +13,6 @@ import rimraf from 'rimraf';
import PQueue from 'p-queue';
import sql from '@journeyapps/sqlcipher';
import { app, clipboard, dialog } from 'electron';
import { redactAll } from '../../js/modules/privacy';
import { remove as removeUserConfig } from '../../app/user_config';
import { combineNames } from '../util/combineNames';
import { GroupV2MemberType } from '../model-types.d';
import { LocaleMessagesType } from '../types/I18N';
import pify from 'pify';
import { v4 as generateUUID } from 'uuid';
@ -28,6 +29,13 @@ import {
pick,
} from 'lodash';
import { redactAll } from '../../js/modules/privacy';
import { remove as removeUserConfig } from '../../app/user_config';
import { combineNames } from '../util/combineNames';
import { GroupV2MemberType } from '../model-types.d';
import { LocaleMessagesType } from '../types/I18N';
import {
AttachmentDownloadJobType,
ConversationType,
@ -211,8 +219,6 @@ async function openDatabase(filePath: string): Promise<sql.Database> {
}
resolve(instance);
return;
};
instance = new sql.Database(filePath, callback);
@ -3700,7 +3706,7 @@ async function updateEmojiUsage(
}
updateEmojiUsage.needsSerial = true;
async function getRecentEmojis(limit: number = 32) {
async function getRecentEmojis(limit = 32) {
const db = getInstance();
const rows = await db.all(
'SELECT * FROM emojis ORDER BY lastUsage DESC LIMIT $limit;',