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,4 +1,3 @@
import window from 'window';
import Cookies from 'js-cookie';
import { CLIENT_SIDE_STORAGE_INDEX_NAME } from 'Common/Consts';
@ -48,7 +47,7 @@ class CookieDriver {
* @returns {boolean}
*/
static supported() {
return !!(window.navigator && window.navigator.cookieEnabled);
return !!(navigator && navigator.cookieEnabled);
}
}

View file

@ -1,4 +1,3 @@
import window from 'window';
import { isStorageSupported } from 'Storage/RainLoop';
import { CLIENT_SIDE_STORAGE_INDEX_NAME } from 'Common/Consts';
@ -22,13 +21,13 @@ class LocalStorageDriver {
let storageResult = null;
try {
const storageValue = this.s.getItem(CLIENT_SIDE_STORAGE_INDEX_NAME) || null;
storageResult = null === storageValue ? null : window.JSON.parse(storageValue);
storageResult = null === storageValue ? null : JSON.parse(storageValue);
} catch (e) {} // eslint-disable-line no-empty
(storageResult || (storageResult = {}))[key] = data;
try {
this.s.setItem(CLIENT_SIDE_STORAGE_INDEX_NAME, window.JSON.stringify(storageResult));
this.s.setItem(CLIENT_SIDE_STORAGE_INDEX_NAME, JSON.stringify(storageResult));
return true;
} catch (e) {} // eslint-disable-line no-empty
@ -46,7 +45,7 @@ class LocalStorageDriver {
try {
const storageValue = this.s.getItem(CLIENT_SIDE_STORAGE_INDEX_NAME) || null,
storageResult = null === storageValue ? null : window.JSON.parse(storageValue);
storageResult = null === storageValue ? null : JSON.parse(storageValue);
return storageResult && undefined !== storageResult[key] ? storageResult[key] : null;
} catch (e) {} // eslint-disable-line no-empty