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,6 +1,4 @@
import window from 'window';
import ko from 'ko';
import $ from '$';
import { Magics, Layout, Focused, MessageSetAction, StorageResultType, Notification } from 'Common/Enums';
@ -50,6 +48,7 @@ import { getApp } from 'Helper/Apps/User';
import Remote from 'Remote/User/Ajax';
const
$ = jQuery,
$div = $('<div></div>'),
$hcont = $('<div></div>'),
getRealHeight = $el => {
@ -142,7 +141,7 @@ class MessageUserStore {
);
this.messageListPageCount = ko.computed(() => {
const page = window.Math.ceil(this.messageListCount() / SettingsStore.messagesPerPage());
const page = Math.ceil(this.messageListCount() / SettingsStore.messagesPerPage());
return 0 >= page ? 1 : page;
});
@ -798,7 +797,7 @@ class MessageUserStore {
this.messageListCount(iCount);
this.messageListSearch(isNormal(data.Result.Search) ? data.Result.Search : '');
this.messageListPage(window.Math.ceil(iOffset / SettingsStore.messagesPerPage() + 1));
this.messageListPage(Math.ceil(iOffset / SettingsStore.messagesPerPage() + 1));
this.messageListThreadUid(isNormal(data.Result.ThreadUid) ? pString(data.Result.ThreadUid) : '');
this.messageListEndFolder(isNormal(data.Result.Folder) ? data.Result.Folder : '');

View file

@ -1,4 +1,3 @@
import window from 'window';
import ko from 'ko';
import { DesktopNotification, Magics } from 'Common/Enums';
@ -136,7 +135,7 @@ class NotificationUserStore {
if (nessageData) {
notification.onclick = () => {
window.focus();
focus();
if (nessageData.Folder && nessageData.Uid) {
Events.pub('mailbox.message.show', [nessageData.Folder, nessageData.Uid]);
@ -144,7 +143,7 @@ class NotificationUserStore {
};
}
window.setTimeout(
setTimeout(
(function(localNotifications) {
return () => {
if (localNotifications.cancel) {
@ -169,7 +168,7 @@ class NotificationUserStore {
* @returns {*|null}
*/
notificationClass() {
return window.Notification && window.Notification.requestPermission ? window.Notification : null;
return window.Notification && Notification.requestPermission ? Notification : null;
}
}

View file

@ -1,8 +1,7 @@
import ko from 'ko';
import $ from '$';
import { i18n } from 'Common/Translator';
import { log, isNonEmptyArray, pString } from 'Common/Utils';
import { isNonEmptyArray, pString } from 'Common/Utils';
import AccountStore from 'Stores/User/Account';
@ -197,7 +196,7 @@ class PgpUserStore {
return true;
}
} catch (e) {
log(e);
console.log(e);
}
}
@ -239,7 +238,7 @@ class PgpUserStore {
static domControlEncryptedClickHelper(store, dom, armoredMessage, recipients) {
return function() {
let message = null;
const $this = $(this); // eslint-disable-line no-invalid-this
const $this = jQuery(this); // eslint-disable-line no-invalid-this
if ($this.hasClass('success')) {
return false;
@ -248,7 +247,7 @@ class PgpUserStore {
try {
message = store.openpgp.message.readArmored(armoredMessage);
} catch (e) {
log(e);
console.log(e);
}
if (message && message.getText && message.verify && message.decrypt) {
@ -300,7 +299,7 @@ class PgpUserStore {
static domControlSignedClickHelper(store, dom, armoredMessage) {
return function() {
let message = null;
const $this = $(this); // eslint-disable-line no-invalid-this
const $this = jQuery(this); // eslint-disable-line no-invalid-this
if ($this.hasClass('success') || $this.hasClass('error')) {
return false;
@ -309,7 +308,7 @@ class PgpUserStore {
try {
message = store.openpgp.cleartext.readArmored(armoredMessage);
} catch (e) {
log(e);
console.log(e);
}
if (message && message.getText && message.verify) {
@ -366,11 +365,11 @@ class PgpUserStore {
dom.data('openpgp-original', domText);
if (encrypted) {
verControl = $('<div class="b-openpgp-control"><i class="icon-lock"></i></div>')
verControl = jQuery('<div class="b-openpgp-control"><i class="icon-lock"></i></div>')
.attr('title', i18n('MESSAGE/PGP_ENCRYPTED_MESSAGE_DESC'))
.on('click', PgpUserStore.domControlEncryptedClickHelper(this, dom, domText, recipients));
} else if (signed) {
verControl = $('<div class="b-openpgp-control"><i class="icon-lock"></i></div>')
verControl = jQuery('<div class="b-openpgp-control"><i class="icon-lock"></i></div>')
.attr('title', i18n('MESSAGE/PGP_SIGNED_MESSAGE_DESC'))
.on('click', PgpUserStore.domControlSignedClickHelper(this, dom, domText));
}

View file

@ -1,4 +1,3 @@
import window from 'window';
import ko from 'ko';
import { Magics } from 'Common/Enums';
@ -12,7 +11,7 @@ class QuotaUserStore {
const quota = this.quota(),
usage = this.usage();
return 0 < quota ? window.Math.ceil((usage / quota) * 100) : 0;
return 0 < quota ? Math.ceil((usage / quota) * 100) : 0;
});
}

View file

@ -1,4 +1,3 @@
import window from 'window';
import ko from 'ko';
import { MESSAGES_PER_PAGE, MESSAGES_PER_PAGE_VALUES } from 'Common/Consts';
@ -67,9 +66,9 @@ class SettingsUserStore {
this.replySameFolder(!!Settings.settingsGet('ReplySameFolder'));
Events.sub('rl.auto-logout-refresh', () => {
window.clearTimeout(this.iAutoLogoutTimer);
clearTimeout(this.iAutoLogoutTimer);
if (0 < this.autoLogout() && !Settings.settingsGet('AccountSignMe')) {
this.iAutoLogoutTimer = window.setTimeout(() => {
this.iAutoLogoutTimer = setTimeout(() => {
Events.pub('rl.auto-logout');
}, this.autoLogout() * Magics.Time1m);
}