Update TypeScript, Prettier and typescript-eslint for new TypeScript 3.8 syntax

This commit is contained in:
Scott Nonnenberg 2020-11-18 07:15:42 -08:00 committed by Josh Perez
parent 5758ed44ac
commit 26884432a2
65 changed files with 286 additions and 185 deletions

View file

@ -4,7 +4,7 @@
/* global Whisper: false */
// eslint-disable-next-line func-names
(function() {
(function () {
window.Whisper = window.Whisper || {};
window.Whisper.Database = window.Whisper.Database || {};
window.Whisper.Database.id = window.Whisper.Database.id || 'signal';

View file

@ -11,7 +11,7 @@
/* eslint-disable more/no-then */
// eslint-disable-next-line func-names
(function() {
(function () {
window.Whisper = window.Whisper || {};
Whisper.Deletes = new (Backbone.Collection.extend({
forMessage(message) {

View file

@ -12,7 +12,7 @@
/* eslint-disable more/no-then */
// eslint-disable-next-line func-names
(function() {
(function () {
window.Whisper = window.Whisper || {};
Whisper.DeliveryReceipts = new (Backbone.Collection.extend({

View file

@ -8,7 +8,7 @@
*/
// eslint-disable-next-line func-names
(function() {
(function () {
window.Whisper = window.Whisper || {};
async function destroyExpiredMessages() {

View file

@ -8,7 +8,7 @@
*/
// eslint-disable-next-line func-names
(function() {
(function () {
window.Whisper = window.Whisper || {};
async function eraseTapToViewMessages() {

View file

@ -6,7 +6,7 @@
/* eslint-disable more/no-then */
// eslint-disable-next-line func-names
(function() {
(function () {
window.Whisper = window.Whisper || {};
Whisper.KeyChangeListener = {

View file

@ -1,7 +1,7 @@
// Copyright 2014-2020 Signal Messenger, LLC
// SPDX-License-Identifier: AGPL-3.0-only
(function() {
(function () {
'use strict';
/*
@ -12,7 +12,7 @@
window.libphonenumber = window.libphonenumber || {};
window.libphonenumber.util = {
getRegionCodeForNumber: function(number) {
getRegionCodeForNumber: function (number) {
try {
var parsedNumber = libphonenumber.parse(number);
return libphonenumber.getRegionCodeForNumber(parsedNumber);
@ -21,7 +21,7 @@
}
},
splitCountryCode: function(number) {
splitCountryCode: function (number) {
var parsedNumber = libphonenumber.parse(number);
return {
country_code: parsedNumber.values_[1],
@ -29,12 +29,12 @@
};
},
getCountryCode: function(regionCode) {
getCountryCode: function (regionCode) {
var cc = libphonenumber.getCountryCodeForRegion(regionCode);
return cc !== 0 ? cc : '';
},
parseNumber: function(number, defaultRegionCode) {
parseNumber: function (number, defaultRegionCode) {
try {
var parsedNumber = libphonenumber.parse(number, defaultRegionCode);
@ -53,7 +53,7 @@
}
},
getAllRegionCodes: function() {
getAllRegionCodes: function () {
return {
AD: 'Andorra',
AE: 'United Arab Emirates',

View file

@ -2,7 +2,7 @@
// SPDX-License-Identifier: AGPL-3.0-only
// eslint-disable-next-line func-names
(function() {
(function () {
window.Whisper = window.Whisper || {};
const messageLookup = Object.create(null);

View file

@ -10,7 +10,7 @@
/* eslint-disable more/no-then */
// eslint-disable-next-line func-names
(function() {
(function () {
window.Whisper = window.Whisper || {};
Whisper.MessageRequests = new (Backbone.Collection.extend({
forConversation(conversation) {

View file

@ -4,7 +4,7 @@
/* global storage, _ */
// eslint-disable-next-line func-names
(function() {
(function () {
const BLOCKED_NUMBERS_ID = 'blocked';
const BLOCKED_UUIDS_ID = 'blocked-uuids';
const BLOCKED_GROUPS_ID = 'blocked-groups';

View file

@ -199,8 +199,9 @@ async function _runJob(job) {
logger.warn(
`_runJob: Got 404 from server for CDN ${
attachment.cdnNumber
}, marking attachment ${attachment.cdnId ||
attachment.cdnKey} from message ${message.idForLogging()} as permanent error`
}, marking attachment ${
attachment.cdnId || attachment.cdnKey
} from message ${message.idForLogging()} as permanent error`
);
await _finishJob(message, id);

View file

@ -11,7 +11,7 @@
/* global _: false */
// eslint-disable-next-line func-names
(function() {
(function () {
window.Whisper = window.Whisper || {};
// The keys and values don't match here. This is because the values correspond to old

View file

@ -11,7 +11,7 @@
/* eslint-disable more/no-then */
// eslint-disable-next-line func-names
(function() {
(function () {
window.Whisper = window.Whisper || {};
Whisper.Reactions = new (Backbone.Collection.extend({
forMessage(message) {

View file

@ -12,7 +12,7 @@
/* eslint-disable more/no-then */
// eslint-disable-next-line func-names
(function() {
(function () {
window.Whisper = window.Whisper || {};
Whisper.ReadReceipts = new (Backbone.Collection.extend({
forMessage(conversation, message) {

View file

@ -10,7 +10,7 @@
/* eslint-disable more/no-then */
// eslint-disable-next-line func-names
(function() {
(function () {
window.Whisper = window.Whisper || {};
Whisper.ReadSyncs = new (Backbone.Collection.extend({
forMessage(message) {

View file

@ -6,7 +6,7 @@
// This file was taken from Backbone and then modified. It does not conform to this
// project's standards.
(function() {
(function () {
'use strict';
// Note: this is all the code required to customize Backbone's trigger() method to make
@ -32,7 +32,7 @@
// Implement fancy features of the Events API such as multiple event
// names `"change blur"` and jQuery-style event maps `{change: action}`
// in terms of the existing API.
const eventsApi = function(obj, action, name, rest) {
const eventsApi = function (obj, action, name, rest) {
if (!name) return true;
// Handle event maps.
@ -58,14 +58,14 @@
// A difficult-to-believe, but optimized internal dispatch function for
// triggering events. Tries to keep the usual cases speedy (most internal
// Backbone events have 3 arguments).
const triggerEvents = function(events, name, args) {
const triggerEvents = function (events, name, args) {
let ev,
i = -1,
l = events.length,
a1 = args[0],
a2 = args[1],
a3 = args[2];
const logError = function(error) {
const logError = function (error) {
window.log.error(
'Model caught error triggering',
name,

View file

@ -4,7 +4,7 @@
/* global Whisper, storage, getAccountManager */
// eslint-disable-next-line func-names
(function() {
(function () {
window.Whisper = window.Whisper || {};
const ROTATION_INTERVAL = 48 * 60 * 60 * 1000;
let timeout;

View file

@ -7,7 +7,7 @@
/* eslint-disable no-proto */
// eslint-disable-next-line func-names
(function() {
(function () {
const TIMESTAMP_THRESHOLD = 5 * 1000; // 5 seconds
const Direction = {
SENDING: 1,

View file

@ -5,7 +5,7 @@
/* eslint-disable more/no-then */
// eslint-disable-next-line func-names
(function() {
(function () {
window.Whisper = window.Whisper || {};
let ready = false;

View file

@ -10,7 +10,7 @@
/* eslint-disable more/no-then */
// eslint-disable-next-line func-names
(function() {
(function () {
window.Whisper = window.Whisper || {};
Whisper.ViewSyncs = new (Backbone.Collection.extend({
forMessage(message) {

View file

@ -6,7 +6,7 @@
/* eslint-disable more/no-then */
// eslint-disable-next-line func-names
(function() {
(function () {
window.Whisper = window.Whisper || {};
function resolveTheme() {

View file

@ -4,7 +4,7 @@
/* global Whisper */
// eslint-disable-next-line func-names
(function() {
(function () {
window.Whisper = window.Whisper || {};
Whisper.BannerView = Whisper.View.extend({

View file

@ -7,7 +7,7 @@
/* eslint-disable no-new */
// eslint-disable-next-line func-names
(function() {
(function () {
window.Whisper = window.Whisper || {};
const { Logs } = window.Signal;

View file

@ -4,7 +4,7 @@
/* global Backbone, Whisper, i18n */
// eslint-disable-next-line func-names
(function() {
(function () {
window.Whisper = window.Whisper || {};
Whisper.ConfirmationDialogView = Whisper.View.extend({

View file

@ -5,7 +5,7 @@
/* global textsecure: false */
// eslint-disable-next-line func-names
(function() {
(function () {
window.Whisper = window.Whisper || {};
Whisper.ContactListView = Whisper.ListView.extend({

View file

@ -5,7 +5,7 @@
/* global Whisper: false */
// eslint-disable-next-line func-names
(function() {
(function () {
window.Whisper = window.Whisper || {};
Whisper.LinkedCopiedToast = Whisper.ToastView.extend({
@ -80,9 +80,7 @@
});
this.$('.loading').removeClass('loading');
view.render();
this.$('.link')
.focus()
.select();
this.$('.link').focus().select();
} catch (error) {
window.log.error(
'DebugLogView error:',

View file

@ -4,7 +4,7 @@
/* global Whisper, i18n */
// eslint-disable-next-line func-names
(function() {
(function () {
window.Whisper = window.Whisper || {};
// TODO: take a title string which could replace the 'members' header

View file

@ -4,7 +4,7 @@
/* global Whisper, loadImage */
// eslint-disable-next-line func-names
(function() {
(function () {
window.Whisper = window.Whisper || {};
/*

View file

@ -9,7 +9,7 @@
*/
// eslint-disable-next-line func-names
(function() {
(function () {
window.Whisper = window.Whisper || {};
Whisper.StickerPackInstallFailedToast = Whisper.ToastView.extend({

View file

@ -6,7 +6,7 @@
/* eslint-disable more/no-then */
// eslint-disable-next-line func-names
(function() {
(function () {
window.Whisper = window.Whisper || {};
const Steps = {

View file

@ -6,7 +6,7 @@
/* eslint-disable more/no-then */
// eslint-disable-next-line func-names
(function() {
(function () {
window.Whisper = window.Whisper || {};
Whisper.KeyVerificationPanelView = Whisper.View.extend({

View file

@ -4,7 +4,7 @@
/* global Backbone, Whisper, _ */
// eslint-disable-next-line func-names
(function() {
(function () {
window.Whisper = window.Whisper || {};
/*

View file

@ -4,7 +4,7 @@
/* global libphonenumber, Whisper */
// eslint-disable-next-line func-names
(function() {
(function () {
window.Whisper = window.Whisper || {};
Whisper.PhoneInputView = Whisper.View.extend({

View file

@ -7,7 +7,7 @@
/* global ReactDOM: false */
// eslint-disable-next-line func-names
(function() {
(function () {
window.Whisper = window.Whisper || {};
window.Whisper.ReactWrapperView = Backbone.View.extend({

View file

@ -6,7 +6,7 @@
/* eslint-disable more/no-then */
// eslint-disable-next-line func-names
(function() {
(function () {
window.Whisper = window.Whisper || {};
Whisper.RecorderView = Whisper.View.extend({

View file

@ -4,7 +4,7 @@
/* global Whisper, Signal */
// eslint-disable-next-line func-names
(function() {
(function () {
window.Whisper = window.Whisper || {};
Whisper.SafetyNumberChangeDialogView = Whisper.View.extend({

View file

@ -8,7 +8,7 @@
/* eslint-disable no-new */
// eslint-disable-next-line func-names
(function() {
(function () {
window.Whisper = window.Whisper || {};
const { Settings } = window.Signal.Types;

View file

@ -6,7 +6,7 @@
/* eslint-disable more/no-then */
// eslint-disable-next-line func-names
(function() {
(function () {
window.Whisper = window.Whisper || {};
Whisper.StandaloneRegistrationView = Whisper.View.extend({
@ -37,9 +37,7 @@
},
verifyCode() {
const number = this.phoneView.validateNumber();
const verificationCode = $('#code')
.val()
.replace(/\D+/g, '');
const verificationCode = $('#code').val().replace(/\D+/g, '');
this.accountManager
.registerSingleDevice(number, verificationCode)
@ -53,9 +51,7 @@
this.$('#status').text(s);
},
validateCode() {
const verificationCode = $('#code')
.val()
.replace(/\D/g, '');
const verificationCode = $('#code').val().replace(/\D/g, '');
if (verificationCode.length === 6) {
return verificationCode;
@ -64,11 +60,7 @@
return null;
},
displayError(error) {
this.$('#error')
.hide()
.text(error)
.addClass('in')
.fadeIn();
this.$('#error').hide().text(error).addClass('in').fadeIn();
},
onValidation() {
if (this.$('#number-container').hasClass('valid')) {
@ -92,9 +84,7 @@
this.accountManager
.requestVoiceVerification(number)
.catch(this.displayError.bind(this));
this.$('#step2')
.addClass('in')
.fadeIn();
this.$('#step2').addClass('in').fadeIn();
} else {
this.$('#number-container').addClass('invalid');
}
@ -107,9 +97,7 @@
this.accountManager
.requestSMSVerification(number)
.catch(this.displayError.bind(this));
this.$('#step2')
.addClass('in')
.fadeIn();
this.$('#step2').addClass('in').fadeIn();
} else {
this.$('#number-container').addClass('invalid');
}

View file

@ -4,7 +4,7 @@
/* global Whisper, Mustache, _ */
// eslint-disable-next-line func-names
(function() {
(function () {
window.Whisper = window.Whisper || {};
Whisper.ToastView = Whisper.View.extend({

View file

@ -24,7 +24,7 @@
*/
// eslint-disable-next-line func-names
(function() {
(function () {
window.Whisper = window.Whisper || {};
Whisper.View = Backbone.View.extend(

View file

@ -4,7 +4,7 @@
/* global Whisper */
// eslint-disable-next-line func-names
(function() {
(function () {
window.Whisper = window.Whisper || {};
let lastTime;