Made eslint using 'browser' environment and added globals, because RainLoop is used in browsers.

This also allowed to remove all webpack 'externals' overhead.
This commit is contained in:
djmaze 2020-08-12 00:25:36 +02:00
parent c3a213802d
commit e7180a86ce
81 changed files with 1857 additions and 1259 deletions

View file

@ -1,5 +1,5 @@
import ko from 'ko';
import { delegateRun, log } from 'Common/Utils';
import { delegateRun } from 'Common/Utils';
import PgpStore from 'Stores/User/Pgp';
@ -64,7 +64,7 @@ class AddOpenPgpKeyPopupView extends AbstractViewNext {
if (err) {
this.key.error(true);
this.key.errorMessage(err && err[0] ? '' + err[0] : '');
log(err);
console.log(err);
}
}

View file

@ -1,5 +1,4 @@
import ko from 'ko';
import key from 'key';
import { KeyState } from 'Common/Enums';
import { i18n } from 'Common/Translator';

View file

@ -1,7 +1,4 @@
import $ from '$';
import ko from 'ko';
import key from 'key';
import Jua from 'Jua';
import {
Capa,
@ -943,7 +940,7 @@ class ComposePopupView extends AbstractViewNext {
sSubject = message.subject();
aDraftInfo = message.aDraftInfo;
const clonedText = $(message.body).clone();
const clonedText = jQuery(message.body).clone();
if (clonedText) {
clearBqSwitcher(clonedText);

View file

@ -1,8 +1,6 @@
import $ from '$';
import ko from 'ko';
import key from 'key';
import { pString, log, defautOptionsAfterRender } from 'Common/Utils';
import { pString, defautOptionsAfterRender } from 'Common/Utils';
import { Magics, KeyState } from 'Common/Enums';
import { i18n } from 'Common/Translator';
@ -103,7 +101,7 @@ class ComposeOpenPgpPopupView extends AbstractViewNext {
this.defautOptionsAfterRender(domOption, item);
if (item && undefined !== item.class && domOption) {
$(domOption).addClass(item.class);
jQuery(domOption).addClass(item.class);
}
};
@ -203,7 +201,7 @@ class ComposeOpenPgpPopupView extends AbstractViewNext {
});
}
} catch (e) {
log(e);
console.log(e);
this.notification(
i18n('PGP_NOTIFICATIONS/PGP_ERROR', {

View file

@ -1,8 +1,4 @@
import window from 'window';
import $ from '$';
import ko from 'ko';
import key from 'key';
import Jua from 'Jua';
import {
SaveSettingsStep,
@ -80,7 +76,7 @@ class ContactsPopupView extends AbstractViewNext {
this.contactsPage = ko.observable(1);
this.contactsPageCount = ko.computed(() => {
const iPage = window.Math.ceil(this.contactsCount() / CONTACTS_PER_PAGE);
const iPage = Math.ceil(this.contactsCount() / CONTACTS_PER_PAGE);
return 0 >= iPage ? 1 : iPage;
});
@ -349,7 +345,7 @@ class ContactsPopupView extends AbstractViewNext {
syncCommand() {
getApp().contactsSync((result, data) => {
if (StorageResultType.Success !== result || !data || !data.Result) {
window.alert(getNotification(data && data.ErrorCode ? data.ErrorCode : Notification.ContactsSyncError));
alert(getNotification(data && data.ErrorCode ? data.ErrorCode : Notification.ContactsSyncError));
}
this.reloadContactList(true);
@ -441,7 +437,7 @@ class ContactsPopupView extends AbstractViewNext {
this.contacts.importing(false);
this.reloadContactList();
if (!id || !result || !data || !data.Result) {
window.alert(i18n('CONTACTS/ERROR_IMPORT_FILE'));
alert(i18n('CONTACTS/ERROR_IMPORT_FILE'));
}
});
}
@ -618,7 +614,7 @@ class ContactsPopupView extends AbstractViewNext {
}
onBuild(dom) {
this.oContentVisible = $('.b-list-content', dom);
this.oContentVisible = jQuery('.b-list-content', dom);
this.selector.init(this.oContentVisible, this.oContentVisible, KeyState.ContactList);

View file

@ -1,5 +1,3 @@
import key from 'key';
import { KeyState, Magics } from 'Common/Enums';
import { popup } from 'Knoin/Knoin';

View file

@ -1,8 +1,6 @@
import ko from 'ko';
import key from 'key';
import $ from '$';
import { pString, log } from 'Common/Utils';
import { pString } from 'Common/Utils';
import { KeyState, Magics } from 'Common/Enums';
import { popup, command } from 'Knoin/Knoin';
@ -47,19 +45,19 @@ class MessageOpenPgpPopupView extends AbstractViewNext {
if (privateKey) {
try {
if (!privateKey.decrypt(pString(this.password()))) {
log('Error: Private key cannot be decrypted');
console.log('Error: Private key cannot be decrypted');
privateKey = null;
}
} catch (e) {
log(e);
console.log(e);
privateKey = null;
}
} else {
log('Error: Private key cannot be found');
console.log('Error: Private key cannot be found');
}
}
} catch (e) {
log(e);
console.log(e);
privateKey = null;
}
@ -109,7 +107,7 @@ class MessageOpenPgpPopupView extends AbstractViewNext {
.addClass('icon-radio-unchecked')
.removeClass('icon-radio-checked');
$(this)
jQuery(this)
.find('.key-list__item__radio') // eslint-disable-line no-invalid-this
.removeClass('icon-radio-unchecked')
.addClass('icon-radio-checked');

View file

@ -1,7 +1,7 @@
import ko from 'ko';
import { Magics } from 'Common/Enums';
import { log, delegateRun, pInt } from 'Common/Utils';
import { delegateRun, pInt } from 'Common/Utils';
import PgpStore from 'Stores/User/Pgp';
@ -87,7 +87,7 @@ class NewOpenPgpKeyPopupView extends AbstractViewNext {
}
showError(e) {
log(e);
console.log(e);
if (e && e.message) {
this.submitError(e.message);
}

View file

@ -1,5 +1,4 @@
import ko from 'ko';
import key from 'key';
import { KeyState, Magics, StorageResultType, Notification } from 'Common/Enums';
import { isNonEmptyArray, delegateRun } from 'Common/Utils';

View file

@ -1,4 +1,3 @@
import window from 'window';
import ko from 'ko';
import { Capa, StorageResultType } from 'Common/Enums';
@ -137,18 +136,18 @@ class TwoFactorConfigurationPopupView extends AbstractViewNext {
onHide() {
if (this.lock()) {
window.location.reload();
location.reload();
}
}
getQr() {
return (
'otpauth://totp/' +
window.encodeURIComponent(this.viewUser()) +
encodeURIComponent(this.viewUser()) +
'?secret=' +
window.encodeURIComponent(this.viewSecret()) +
encodeURIComponent(this.viewSecret()) +
'&issuer=' +
window.encodeURIComponent('')
encodeURIComponent('')
);
}
@ -166,7 +165,7 @@ class TwoFactorConfigurationPopupView extends AbstractViewNext {
this.viewBackupCodes(pString(oData.Result.BackupCodes).replace(/[\s]+/g, ' '));
this.viewUrlTitle(pString(oData.Result.UrlTitle));
this.viewUrl(window.qr.toDataURL({ level: 'M', size: 8, value: this.getQr() }));
this.viewUrl(qr.toDataURL({ level: 'M', size: 8, value: this.getQr() }));
} else {
this.viewUser('');
this.viewEnable_(false);
@ -186,7 +185,7 @@ class TwoFactorConfigurationPopupView extends AbstractViewNext {
if (StorageResultType.Success === result && data && data.Result) {
this.viewSecret(pString(data.Result.Secret));
this.viewUrlTitle(pString(data.Result.UrlTitle));
this.viewUrl(window.qr.toDataURL({ level: 'M', size: 6, value: this.getQr() }));
this.viewUrl(qr.toDataURL({ level: 'M', size: 6, value: this.getQr() }));
} else {
this.viewSecret('');
this.viewUrlTitle('');

View file

@ -1,5 +1,4 @@
import ko from 'ko';
import key from 'key';
import { KeyState } from 'Common/Enums';
import { selectElement } from 'Common/Utils';