From 72ca81850084f6ef5ef85bb14a89684f45e7ee41 Mon Sep 17 00:00:00 2001 From: RainLoop Team Date: Wed, 20 Apr 2016 20:12:51 +0300 Subject: [PATCH] Fix eslint warnings --- .eslintrc | 156 +++++++++++++++ dev/App/Abstract.jsx | 68 +++---- dev/App/Admin.jsx | 28 +-- dev/App/User.jsx | 189 +++++++++--------- dev/Common/Audio.jsx | 2 +- dev/Common/Base64.jsx | 8 +- dev/Common/Cache.jsx | 15 +- dev/Common/ClientStorageDriver/Cookie.jsx | 23 ++- .../ClientStorageDriver/LocalStorage.jsx | 23 ++- dev/Common/Consts.jsx | 4 +- dev/Common/Enums.jsx | 66 +++--- dev/Common/HtmlEditor.jsx | 41 ++-- dev/Common/Links.jsx | 2 +- dev/Common/Mime.jsx | 5 +- dev/Common/Momentor.jsx | 4 +- dev/Common/Selector.jsx | 28 +-- dev/Common/Translator.jsx | 28 ++- dev/Common/Utils.js | 20 +- dev/Component/AbstracRadio.jsx | 4 +- dev/Component/Abstract.jsx | 2 +- dev/Component/AbstractInput.jsx | 2 +- dev/Component/MaterialDesign/Checkbox.jsx | 6 +- dev/Component/SaveTrigger.jsx | 2 +- dev/Component/SvgIcon.jsx | 2 +- dev/Knoin/AbstractBoot.jsx | 4 +- dev/Model/OpenPgpKey.js | 6 +- dev/Storage/Settings.jsx | 6 +- dev/Stores/Admin/App.jsx | 2 +- dev/Stores/User/App.jsx | 4 +- dev/Stores/User/Identity.jsx | 4 +- dev/Styles/_FontasticToBoot.less | 6 +- dev/View/Popup/ComposeOpenPgp.js | 20 +- dev/bootstrap.jsx | 3 +- gulpfile.js | 13 +- package.json | 4 +- 35 files changed, 510 insertions(+), 290 deletions(-) create mode 100644 .eslintrc diff --git a/.eslintrc b/.eslintrc new file mode 100644 index 000000000..d1fe6ef29 --- /dev/null +++ b/.eslintrc @@ -0,0 +1,156 @@ +{ + "parser": "babel-eslint", + "ecmaFeatures": { + "modules": true, + "arrowFunctions": true, + "blockBindings": true + }, + "env": { + "node": true, + "es6": true, + "browser": true + }, + "rules": { + "comma-dangle": [2, "never"], + "no-cond-assign": 2, + "no-console": 2, + "no-constant-condition": 2, + "no-control-regex": 2, + "no-debugger": 2, + "no-dupe-keys": 2, + "no-empty": 2, + "no-empty-character-class": 2, + "no-ex-assign": 2, + "no-extra-boolean-cast": 2, + "no-extra-parens": 0, + "no-extra-semi": 2, + "no-func-assign": 2, + "no-inner-declarations": 2, + "no-invalid-regexp": 2, + "no-irregular-whitespace": 2, + "no-negated-in-lhs": 2, + "no-obj-calls": 2, + "no-regex-spaces": 2, + "no-reserved-keys": 0, + "no-sparse-arrays": 2, + "no-unreachable": 2, + "use-isnan": 2, + "valid-jsdoc": 0, + "valid-typeof": 2, + // Best Practices + "block-scoped-var": 2, + "complexity": 0, + "consistent-return": 2, + "curly": 2, +// "default-case": 2, + "dot-notation": 2, + "eqeqeq": 2, + "guard-for-in": 2, + "no-alert": 2, + "no-caller": 2, + "no-div-regex": 2, + "no-else-return": 2, + "no-eq-null": 2, + "no-eval": 2, + "no-extend-native": 2, + "no-extra-bind": 2, + "no-fallthrough": 2, + "no-floating-decimal": 2, + "no-implied-eval": 2, + "no-iterator": 2, + "no-labels": 2, + "no-lone-blocks": 2, + "no-loop-func": 2, + "no-multi-spaces": 2, + "no-multi-str": 0, + "no-native-reassign": 2, + "no-new": 2, + "no-new-func": 2, + "no-new-wrappers": 2, + "no-octal": 2, + "no-octal-escape": 2, + "no-process-env": 2, + "no-proto": 2, + "no-redeclare": 2, + "no-return-assign": 2, + "no-script-url": 2, + "no-self-compare": 2, + "no-sequences": 2, + "no-unused-expressions": 2, + "no-void": 0, + "no-warning-comments": 2, + "no-with": 2, + "radix": 2, + "vars-on-top": 0, + "wrap-iife": 2, + "yoda": 0, + // Strict Mode + "strict": 0, + // Variables + "no-catch-shadow": 2, + "no-delete-var": 2, + "no-label-var": 2, + "no-shadow": 2, + "no-shadow-restricted-names": 2, + "no-undef": 2, + "no-undef-init": 2, + "no-undefined": 2, + "no-unused-vars": 2, + "no-use-before-define": 2, + // Stylistic Issues +// "indent": [2, "tab", { +// "SwitchCase": 1, +// "VariableDeclarator": 1 +// }], + "camelcase": 0, + "comma-spacing": 2, + "comma-style": 2, + "consistent-this": 0, + "eol-last": 2, + "func-names": 0, + "func-style": 0, + "key-spacing": [2, { + "beforeColon": false, + "afterColon": true + }], + "max-nested-callbacks": 0, + "new-cap": 2, + "new-parens": 2, + "no-array-constructor": 2, + "no-inline-comments": 0, +// "no-lonely-if": 2, + "no-mixed-spaces-and-tabs": 2, +// "no-nested-ternary": 2, + "no-new-object": 2, + "semi-spacing": [2, { + "before": false, + "after": true + }], + "no-spaced-func": 2, + "no-ternary": 0, + "no-trailing-spaces": 2, + "no-multiple-empty-lines": 2, + "no-underscore-dangle": 0, + "one-var": 0, + "operator-assignment": [2, "always"], + "padded-blocks": 0, + "quotes": [2, "single"], + "quote-props": [2, "as-needed"], + "semi": [2, "always"], +// "sort-vars": [2, {"ignoreCase": true}], + "space-before-blocks": 2, + "object-curly-spacing": [2, "never"], + "array-bracket-spacing": [2, "never"], + "space-in-parens": 2, + "space-infix-ops": 2, + "space-unary-ops": 2, + "spaced-comment": 2, + "wrap-regex": 0, + // Legacy + "max-depth": 0, + "max-len": [2, 200], + "max-params": 0, + "max-statements": 0, + "no-plusplus": 0 + } +} \ No newline at end of file diff --git a/dev/App/Abstract.jsx b/dev/App/Abstract.jsx index 3791a03b1..4e9fbbc11 100644 --- a/dev/App/Abstract.jsx +++ b/dev/App/Abstract.jsx @@ -1,7 +1,7 @@ import {window, _, $, key} from 'common'; import Globals from 'Common/Globals'; -import * as Enums from 'Common/Enums'; +import * as Enums from 'Common/Enums'; import Utils from 'Common/Utils'; import Links from 'Common/Links'; import Events from 'Common/Events'; @@ -64,7 +64,7 @@ class AbstractApp extends AbstractBoot }, 50)); - // DEBUG +// DEBUG // Events.sub({ // 'window.resize': function () { // window.console.log('window.resize'); @@ -112,15 +112,15 @@ class AbstractApp extends AbstractBoot if (Globals.sUserAgent && (Globals.sUserAgent.indexOf('chrome') > -1 || Globals.sUserAgent.indexOf('chrome') > -1)) { const oLink = window.document.createElement('a'); - oLink['href'] = link; + oLink.href = link; - if (window.document['createEvent']) + if (window.document && window.document.createEvent) { - const oE = window.document['createEvent']('MouseEvents'); - if (oE && oE['initEvent'] && oLink['dispatchEvent']) + const oE = window.document.createEvent.MouseEvents; + if (oE && oE.initEvent && oLink.dispatchEvent) { - oE['initEvent']('click', true, true); - oLink['dispatchEvent'](oE); + oE.initEvent('click', true, true); + oLink.dispatchEvent(oE); return true; } } @@ -179,14 +179,14 @@ class AbstractApp extends AbstractBoot } /** - * @param {string} key + * @param {string} token */ - setClientSideToken(key) { + setClientSideToken(token) { if (window.__rlah_set) { - window.__rlah_set(key); + window.__rlah_set(token); - require('Storage/Settings').settingsSet('AuthAccountHash', key); + require('Storage/Settings').settingsSet('AuthAccountHash', token); require('Common/Links').populateAuthSuffix(); } } @@ -203,7 +203,7 @@ class AbstractApp extends AbstractBoot inIframe = !!Settings.settingsGet('InIframe') ; - let customLogoutLink = Utils.pString(Settings.settingsGet('CustomLogoutLink')) + let customLogoutLink = Utils.pString(Settings.settingsGet('CustomLogoutLink')); if (logout) { @@ -273,7 +273,7 @@ class AbstractApp extends AbstractBoot ko.components.register('x-script', require('Component/Script')); // ko.components.register('svg-icon', require('Component/SvgIcon')); - if (/**false && /**/Settings.settingsGet('MaterialDesign') && Globals.bAnimationSupported) + if (Settings.settingsGet('MaterialDesign') && Globals.bAnimationSupported) { ko.components.register('Checkbox', require('Component/MaterialDesign/Checkbox')); ko.components.register('CheckboxSimple', require('Component/Checkbox')); @@ -291,49 +291,49 @@ class AbstractApp extends AbstractBoot _.delay(Utils.windowResizeCallback, 1000); ssm.addState({ - 'id': 'mobile', - 'maxWidth': 767, - 'onEnter': () => { + id: 'mobile', + maxWidth: 767, + onEnter: () => { Globals.$html.addClass('ssm-state-mobile'); Events.pub('ssm.mobile-enter'); }, - 'onLeave': () => { + onLeave: () => { Globals.$html.removeClass('ssm-state-mobile'); Events.pub('ssm.mobile-leave'); } }); ssm.addState({ - 'id': 'tablet', - 'minWidth': 768, - 'maxWidth': 999, - 'onEnter': function() { + id: 'tablet', + minWidth: 768, + maxWidth: 999, + onEnter: function() { Globals.$html.addClass('ssm-state-tablet'); }, - 'onLeave': function() { + onLeave: function() { Globals.$html.removeClass('ssm-state-tablet'); } }); ssm.addState({ - 'id': 'desktop', - 'minWidth': 1000, - 'maxWidth': 1400, - 'onEnter': () => { + id: 'desktop', + minWidth: 1000, + maxWidth: 1400, + onEnter: () => { Globals.$html.addClass('ssm-state-desktop'); }, - 'onLeave': () => { + onLeave: () => { Globals.$html.removeClass('ssm-state-desktop'); } }); ssm.addState({ - 'id': 'desktop-large', - 'minWidth': 1400, - 'onEnter': () => { + id: 'desktop-large', + minWidth: 1400, + onEnter: () => { Globals.$html.addClass('ssm-state-desktop-large'); }, - 'onLeave': () => { + onLeave: () => { Globals.$html.removeClass('ssm-state-desktop-large'); } }); @@ -360,7 +360,7 @@ class AbstractApp extends AbstractBoot require('Stores/Language').populate(); require('Stores/Theme').populate(); require('Stores/Social').populate(); - }; + } } -export {AbstractApp, AbstractApp as default}; \ No newline at end of file +export {AbstractApp, AbstractApp as default}; diff --git a/dev/App/Admin.jsx b/dev/App/Admin.jsx index 47ab2e34c..470fc3d51 100644 --- a/dev/App/Admin.jsx +++ b/dev/App/Admin.jsx @@ -3,7 +3,7 @@ import {window, _} from 'common'; import ko from 'ko'; import progressJs from 'progressJs'; -import * as Enums from 'Common/Enums'; +import * as Enums from 'Common/Enums'; import Utils from 'Common/Utils'; import Links from 'Common/Links'; import Translator from 'Common/Translator'; @@ -41,9 +41,9 @@ class AdminApp extends AbstractApp { DomainStore.domains(_.map(data.Result, (enabled, name) => { return { - 'name': name, - 'disabled': ko.observable(!enabled), - 'deleteAccess': ko.observable(false) + name: name, + disabled: ko.observable(!enabled), + deleteAccess: ko.observable(false) }; })); } @@ -58,9 +58,9 @@ class AdminApp extends AbstractApp { PluginStore.plugins(_.map(data.Result, (item) => { return { - 'name': item['Name'], - 'disabled': ko.observable(!item['Enabled']), - 'configured': ko.observable(!!item['Configured']) + name: item.Name, + disabled: ko.observable(!item.Enabled), + configured: ko.observable(!!item.Configured) }; })); } @@ -83,9 +83,9 @@ class AdminApp extends AbstractApp ; _.each(PackageStore.packages(), (item) => { - if (item && item['loading']()) + if (item && item.loading()) { - loading[item['file']] = item; + loading[item.file] = item; } }); @@ -94,8 +94,8 @@ class AdminApp extends AbstractApp list = _.compact(_.map(data.Result.List, (item) => { if (item) { - item['loading'] = ko.observable(!Utils.isUnd(loading[item['file']])); - return 'core' === item['type'] && !item['canBeInstalled'] ? null : item; + item.loading = ko.observable(!Utils.isUnd(loading[item.file])); + return 'core' === item.type && !item.canBeInstalled ? null : item; } return null; })); @@ -170,10 +170,10 @@ class AdminApp extends AbstractApp LicenseStore.licenseError(''); Remote.licensing((result, data) => { LicenseStore.licensingProcess(false); - if (Enums.StorageResultType.Success === result && data && data.Result && Utils.isNormal(data.Result['Expired'])) + if (Enums.StorageResultType.Success === result && data && data.Result && Utils.isNormal(data.Result.Expired)) { LicenseStore.licenseValid(true); - LicenseStore.licenseExpired(Utils.pInt(data.Result['Expired'])); + LicenseStore.licenseExpired(Utils.pInt(data.Result.Expired)); LicenseStore.licenseError(''); LicenseStore.licensing(true); AppStore.prem(true); @@ -237,7 +237,7 @@ class AdminApp extends AbstractApp } else { - if (!!Settings.settingsGet('Auth')) + if (Settings.settingsGet('Auth')) { kn.startScreens([ require('Screen/Admin/Settings') diff --git a/dev/App/User.jsx b/dev/App/User.jsx index a16792283..d080b206b 100644 --- a/dev/App/User.jsx +++ b/dev/App/User.jsx @@ -1,6 +1,5 @@ import {window, _, $} from 'common'; -import ko from 'ko'; import progressJs from 'progressJs'; import Tinycon from 'Tinycon'; @@ -86,10 +85,15 @@ class AppUser extends AbstractApp if (Settings.settingsGet('UserBackgroundHash')) { _.delay(() => { - $('#rl-bg').attr('style', 'background-image: none !important;') - .backstretch(Links.userBackground(Settings.settingsGet('UserBackgroundHash')), { - 'fade': Globals.bAnimationSupported ? 1000 : 0, 'centeredX': true, 'centeredY': true - }).removeAttr('style'); + $('#rl-bg') + .attr('style', 'background-image: none !important;') + .backstretch(Links.userBackground(Settings.settingsGet('UserBackgroundHash')), { + fade: Globals.bAnimationSupported ? 1000 : 0, + centeredX: true, + centeredY: true + }) + .removeAttr('style') + ; }, 1000); } @@ -205,12 +209,12 @@ class AppUser extends AbstractApp _.each(this.oMoveCache, (oItem) => { var - bSpam = sSpamFolder === oItem['To'], - bTrash = sTrashFolder === oItem['To'], - bHam = !bSpam && sSpamFolder === oItem['From'] && Cache.getFolderInboxName() === oItem['To'] + bSpam = sSpamFolder === oItem.To, + bTrash = sTrashFolder === oItem.To, + bHam = !bSpam && sSpamFolder === oItem.From && Cache.getFolderInboxName() === oItem.To ; - Remote.messagesMove(this.moveOrDeleteResponseHelper, oItem['From'], oItem['To'], oItem['Uid'], + Remote.messagesMove(this.moveOrDeleteResponseHelper, oItem.From, oItem.To, oItem.Uid, bSpam ? 'SPAM' : (bHam ? 'HAM' : ''), bSpam || bTrash); }); @@ -223,13 +227,13 @@ class AppUser extends AbstractApp if (!this.oMoveCache[sH]) { this.oMoveCache[sH] = { - 'From': sFromFolderFullNameRaw, - 'To': sToFolderFullNameRaw, - 'Uid': [] + From: sFromFolderFullNameRaw, + To: sToFolderFullNameRaw, + Uid: [] }; } - this.oMoveCache[sH]['Uid'] = _.union(this.oMoveCache[sH]['Uid'], aUidForMove); + this.oMoveCache[sH].Uid = _.union(this.oMoveCache[sH].Uid, aUidForMove); this.messagesMoveTrigger(); } @@ -434,13 +438,13 @@ class AppUser extends AbstractApp ; if (oItem.users) { - _.each(oItem.users, (oItem) => { + _.each(oItem.users, (item) => { oEmail.clear(); - oEmail.mailsoParse(oItem.userId.userid); + oEmail.mailsoParse(item.userId.userid); if (oEmail.validate()) { aEmails.push(oEmail.email); - aUsers.push(oItem.userId.userid); + aUsers.push(item.userId.userid); } }); } @@ -494,7 +498,7 @@ class AppUser extends AbstractApp // }); // } // }); - }; + } accountsAndIdentities(bBoot) { @@ -516,7 +520,7 @@ class AppUser extends AbstractApp sParentEmail = '' === sParentEmail ? sAccountEmail : sParentEmail; - if (Utils.isArray(oData.Result['Accounts'])) + if (Utils.isArray(oData.Result.Accounts)) { _.each(AccountStore.accounts(), (oAccount) => { aCounts[oAccount.email] = oAccount.count(); @@ -524,7 +528,7 @@ class AppUser extends AbstractApp Utils.delegateRunOnDestroy(AccountStore.accounts()); - AccountStore.accounts(_.map(oData.Result['Accounts'], + AccountStore.accounts(_.map(oData.Result.Accounts, (sValue) => new AccountModel(sValue, sValue !== sParentEmail, aCounts[sValue] || 0))); } @@ -534,23 +538,23 @@ class AppUser extends AbstractApp Events.sub('interval.10m-after5m', () => this.accountsCounts()); } - if (Utils.isArray(oData.Result['Identities'])) + if (Utils.isArray(oData.Result.Identities)) { Utils.delegateRunOnDestroy(IdentityStore.identities()); - IdentityStore.identities(_.map(oData.Result['Identities'], (oIdentityData) => { + IdentityStore.identities(_.map(oData.Result.Identities, (oIdentityData) => { const - sId = Utils.pString(oIdentityData['Id']), - sEmail = Utils.pString(oIdentityData['Email']), + sId = Utils.pString(oIdentityData.Id), + sEmail = Utils.pString(oIdentityData.Email), oIdentity = new IdentityModel(sId, sEmail) ; - oIdentity.name(Utils.pString(oIdentityData['Name'])); - oIdentity.replyTo(Utils.pString(oIdentityData['ReplyTo'])); - oIdentity.bcc(Utils.pString(oIdentityData['Bcc'])); - oIdentity.signature(Utils.pString(oIdentityData['Signature'])); - oIdentity.signatureInsertBefore(!!oIdentityData['SignatureInsertBefore']); + oIdentity.name(Utils.pString(oIdentityData.Name)); + oIdentity.replyTo(Utils.pString(oIdentityData.ReplyTo)); + oIdentity.bcc(Utils.pString(oIdentityData.Bcc)); + oIdentity.signature(Utils.pString(oIdentityData.Signature)); + oIdentity.signatureInsertBefore(!!oIdentityData.SignatureInsertBefore); return oIdentity; })); @@ -568,11 +572,11 @@ class AppUser extends AbstractApp TemplateStore.templates.loading(false); if (Enums.StorageResultType.Success === result && data.Result && - Utils.isArray(data.Result['Templates'])) + Utils.isArray(data.Result.Templates)) { Utils.delegateRunOnDestroy(TemplateStore.templates()); - TemplateStore.templates(_.compact(_.map(data.Result['Templates'], (templateData) => { + TemplateStore.templates(_.compact(_.map(data.Result.Templates, (templateData) => { const template = new TemplateModel(); return template.parse(templateData) ? template : null; }))); @@ -606,15 +610,14 @@ class AppUser extends AbstractApp { let uid = '', - list = [], check = false, unreadCountChange = false ; - const folder = Cache.getFolderFromCacheList(data.Result.Folder); - if (folder) + const folderFromCache = Cache.getFolderFromCacheList(data.Result.Folder); + if (folderFromCache) { - folder.interval = Momentor.momentNowUnix(); + folderFromCache.interval = Momentor.momentNowUnix(); if (data.Result.Hash) { @@ -623,22 +626,22 @@ class AppUser extends AbstractApp if (Utils.isNormal(data.Result.MessageCount)) { - folder.messageCountAll(data.Result.MessageCount); + folderFromCache.messageCountAll(data.Result.MessageCount); } if (Utils.isNormal(data.Result.MessageUnseenCount)) { - if (Utils.pInt(folder.messageCountUnread()) !== Utils.pInt(data.Result.MessageUnseenCount)) + if (Utils.pInt(folderFromCache.messageCountUnread()) !== Utils.pInt(data.Result.MessageUnseenCount)) { unreadCountChange = true; } - folder.messageCountUnread(data.Result.MessageUnseenCount); + folderFromCache.messageCountUnread(data.Result.MessageUnseenCount); } if (unreadCountChange) { - Cache.clearMessageFlagsFromCacheByFolder(folder.fullNameRaw); + Cache.clearMessageFlagsFromCacheByFolder(folderFromCache.fullNameRaw); } if (data.Result.Flags) @@ -649,8 +652,8 @@ class AppUser extends AbstractApp { check = true; const flags = data.Result.Flags[uid]; - Cache.storeMessageFlagsToCacheByFolderAndUid(folder.fullNameRaw, uid.toString(), [ - !flags['IsSeen'], !!flags['IsFlagged'], !!flags['IsAnswered'], !!flags['IsForwarded'], !!flags['IsReadReceipt'] + Cache.storeMessageFlagsToCacheByFolderAndUid(folderFromCache.fullNameRaw, uid.toString(), [ + !flags.IsSeen, !!flags.IsFlagged, !!flags.IsAnswered, !!flags.IsForwarded, !!flags.IsReadReceipt ]); } } @@ -661,16 +664,16 @@ class AppUser extends AbstractApp } } - MessageStore.initUidNextAndNewMessages(folder.fullNameRaw, data.Result.UidNext, data.Result.NewMessages); + MessageStore.initUidNextAndNewMessages(folderFromCache.fullNameRaw, data.Result.UidNext, data.Result.NewMessages); const hash = Cache.getFolderHash(data.Result.Folder); if (data.Result.Hash !== hash || '' === hash || unreadCountChange) { - if (folder.fullNameRaw === FolderStore.currentFolderFullNameRaw()) + if (folderFromCache.fullNameRaw === FolderStore.currentFolderFullNameRaw()) { this.reloadMessageList(); } - else if (Cache.getFolderInboxName() === folder.fullNameRaw) + else if (Cache.getFolderInboxName() === folderFromCache.fullNameRaw) { this.recacheInboxMessageList(); } @@ -680,7 +683,7 @@ class AppUser extends AbstractApp } }, folder, list); } - }; + } /** * @param {boolean=} boot = false @@ -762,7 +765,7 @@ class AppUser extends AbstractApp } }, folders); } - }; + } /** * @param {string} sFolderFullNameRaw @@ -873,9 +876,9 @@ class AppUser extends AbstractApp if (Enums.StorageResultType.Success === result && data && data.Result) { - SocialStore.google.userName(data.Result['Google'] || ''); - SocialStore.facebook.userName(data.Result['Facebook'] || ''); - SocialStore.twitter.userName(data.Result['Twitter'] || ''); + SocialStore.google.userName(data.Result.Google || ''); + SocialStore.facebook.userName(data.Result.Facebook || ''); + SocialStore.twitter.userName(data.Result.Twitter || ''); } else { @@ -955,6 +958,21 @@ class AppUser extends AbstractApp oTop = null, oBottom = null, + fSetHeight = (height) => { + if (height) + { + if (oTop) + { + oTop.attr('style', 'height:' + height + 'px'); + } + + if (oBottom) + { + oBottom.attr('style', 'top:' + (55 /* top toolbar */ + height) + 'px'); + } + } + }, + fResizeCreateFunction = (event) => { if (event && event.target) { @@ -992,29 +1010,14 @@ class AppUser extends AbstractApp }, oOptions = { - 'helper': 'ui-resizable-helper-h', - 'minHeight': iMinHeight, - 'maxHeight': iMaxHeight, - 'handles': 's', - 'create': fResizeCreateFunction, - 'resize': fResizeResizeFunction, - 'start': fResizeStartFunction, - 'stop': fResizeStopFunction - }, - - fSetHeight = (height) => { - if (height) - { - if (oTop) - { - oTop.attr('style', 'height:' + height + 'px'); - } - - if (oBottom) - { - oBottom.attr('style', 'top:' + (55 /* top toolbar */ + height) + 'px'); - } - } + helper: 'ui-resizable-helper-h', + minHeight: iMinHeight, + maxHeight: iMaxHeight, + handles: 's', + create: fResizeCreateFunction, + resize: fResizeResizeFunction, + start: fResizeStartFunction, + stop: fResizeStopFunction }, fDisable = (bDisable) => { @@ -1054,7 +1057,7 @@ class AppUser extends AbstractApp Events.sub('layout', (layout) => { fDisable(Enums.Layout.BottomPreview !== layout); }); - }; + } initVerticalLayoutResizer(sClientSideKeyName) { @@ -1070,11 +1073,11 @@ class AppUser extends AbstractApp if (iWidth) { oLeft.css({ - 'width': '' + iWidth + 'px' + width: '' + iWidth + 'px' }); oRight.css({ - 'left': '' + iWidth + 'px' + left: '' + iWidth + 'px' }); } }, @@ -1118,7 +1121,7 @@ class AppUser extends AbstractApp Local.set(sClientSideKeyName, oObject.size.width); oRight.css({ - 'left': '' + oObject.size.width + 'px' + left: '' + oObject.size.width + 'px' }); } } @@ -1130,14 +1133,14 @@ class AppUser extends AbstractApp } oLeft.resizable({ - 'helper': 'ui-resizable-helper-w', - 'minWidth': iMinWidth, - 'maxWidth': 350, - 'handles': 'e', - 'create': fResizeCreateFunction, - 'resize': fResizeResizeFunction, - 'start': fResizeStartFunction, - 'stop': fResizeStopFunction + helper: 'ui-resizable-helper-w', + minWidth: iMinWidth, + maxWidth: 350, + handles: 'e', + create: fResizeCreateFunction, + resize: fResizeResizeFunction, + start: fResizeStartFunction, + stop: fResizeStopFunction }); Events.sub('left-panel.off', () => { @@ -1154,7 +1157,7 @@ class AppUser extends AbstractApp this.loginAndLogoutReload(false, true, Settings.settingsGet('ParentEmail') && 0 < Settings.settingsGet('ParentEmail').length); }); - }; + } bootstartTwoFactorScreen() { kn.showScreenPopup(require('View/Popup/TwoFactorConfiguration'), [true]); @@ -1195,7 +1198,7 @@ class AppUser extends AbstractApp { kn.hideLoading(); - progressJs.onbeforeend(() => { + progressJs.onbeforeend(() => { $('.progressjs-container').hide(); _.delay(() => { $('.progressjs-container').remove(); @@ -1208,7 +1211,7 @@ class AppUser extends AbstractApp { kn.hideLoading(); } - }; + } bootstart() { @@ -1240,7 +1243,7 @@ class AppUser extends AbstractApp }); this.setWindowTitle(''); - if (!!Settings.settingsGet('Auth')) + if (Settings.settingsGet('Auth')) { Globals.$html.addClass('rl-user-auth'); @@ -1255,7 +1258,7 @@ class AppUser extends AbstractApp { this.setWindowTitle(Translator.i18n('TITLES/LOADING')); -//require.ensure([], function() { // require code splitting +// require.ensure([], function() { // require code splitting this.foldersReload((value) => { @@ -1319,8 +1322,8 @@ class AppUser extends AbstractApp kn.startScreens([ require('Screen/User/MailBox'), - Settings.capa(Enums.Capa.Settings) ? require('Screen/User/Settings') : null, - false ? require('Screen/User/About') : null + Settings.capa(Enums.Capa.Settings) ? require('Screen/User/Settings') : null +// false ? require('Screen/User/About') : null ]); if (bGoogle || bFacebook || bTwitter) @@ -1381,7 +1384,7 @@ class AppUser extends AbstractApp window.navigator.registerProtocolHandler('mailto', window.location.protocol + '//' + window.location.host + window.location.pathname + '?mailto&to=%s', '' + (Settings.settingsGet('Title') || 'RainLoop')); - } catch(e) {} + } catch (e) {/* eslint-disable-line no-empty */} if (Settings.settingsGet('MailToEmail')) { @@ -1394,7 +1397,7 @@ class AppUser extends AbstractApp { _.defer(() => this.initVerticalLayoutResizer(Enums.ClientSideKeyName.FolderListSize)); - if (Tinycon && Settings.settingsGet('FaviconStatus') && !Settings.settingsGet('Filtered') ) + if (Tinycon && Settings.settingsGet('FaviconStatus') && !Settings.settingsGet('Filtered')) { Tinycon.setOptions({ fallback: false @@ -1412,7 +1415,7 @@ class AppUser extends AbstractApp }); -//}); // require code splitting +// }); // require code splitting } } diff --git a/dev/Common/Audio.jsx b/dev/Common/Audio.jsx index a3aa20571..7a0ae10d1 100644 --- a/dev/Common/Audio.jsx +++ b/dev/Common/Audio.jsx @@ -21,7 +21,7 @@ class Audio this.player = this.createNewObject(); this.supported = !Globals.bMobileDevice && !Globals.bSafari && !!this.player && !!this.player.play; - if (this.supported && this.player.canPlayType) + if (this.supported && this.player.canPlayType) { this.supportedMp3 = '' !== this.player.canPlayType('audio/mpeg;').replace(/no/, ''); this.supportedWav = '' !== this.player.canPlayType('audio/wav; codecs="1"').replace(/no/, ''); diff --git a/dev/Common/Base64.jsx b/dev/Common/Base64.jsx index eeba0c976..eab6cad4d 100644 --- a/dev/Common/Base64.jsx +++ b/dev/Common/Base64.jsx @@ -4,7 +4,8 @@ const BASE_64_CHR = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/='; -/*jslint bitwise: true*/ +/* jslint bitwise: true */ +/* eslint-disable */ const Base64 = { // public method for urlsafe encoding @@ -13,7 +14,7 @@ const Base64 = { // public method for encoding encode: (input) => { - + let output = '', chr1, chr2, chr3, enc1, enc2, enc3, enc4, @@ -164,4 +165,5 @@ const Base64 = { }; module.exports = Base64; -/*jslint bitwise: false*/ +/* jslint bitwise: false */ +/* eslint-enable */ diff --git a/dev/Common/Cache.jsx b/dev/Common/Cache.jsx index 369c7677f..77ed2e054 100644 --- a/dev/Common/Cache.jsx +++ b/dev/Common/Cache.jsx @@ -1,5 +1,4 @@ - import {_} from 'common'; import {Capa, MessageSetAction} from 'Common/Enums'; import Utils from 'Common/Utils'; @@ -239,17 +238,17 @@ class CacheUserStorage if (0 < message.threads().length) { const unseenSubUid = _.find(message.threads(), (sSubUid) => { - if (uid !== sSubUid){ - const flags = this.getMessageFlagsFromCache(message.folderFullNameRaw, sSubUid); - return flags && 0 < flags.length && !!flags[0]; + if (uid !== sSubUid) { + const subFlags = this.getMessageFlagsFromCache(message.folderFullNameRaw, sSubUid); + return subFlags && 0 < subFlags.length && !!subFlags[0]; } return false; }); const flaggedSubUid = _.find(message.threads(), (sSubUid) => { if (uid !== sSubUid) { - const flags = this.getMessageFlagsFromCache(message.folderFullNameRaw, sSubUid); - return flags && 0 < flags.length && !!flags[1]; + const subFlags = this.getMessageFlagsFromCache(message.folderFullNameRaw, sSubUid); + return subFlags && 0 < subFlags.length && !!subFlags[1]; } return false; }); @@ -269,7 +268,7 @@ class CacheUserStorage this.setMessageFlagsToCache( message.folderFullNameRaw, message.uid, [message.unseen(), message.flagged(), message.answered(), message.forwarded(), - message.isReadReceipt(), message.deletedMark()] + message.isReadReceipt(), message.deletedMark()] ); } } @@ -293,7 +292,7 @@ class CacheUserStorage */ storeMessageFlagsToCacheBySetAction(folder, uid, setAction) { - let unread = 0; + let unread = 0; const flags = this.getMessageFlagsFromCache(folder, uid); if (Utils.isArray(flags) && 0 < flags.length) diff --git a/dev/Common/ClientStorageDriver/Cookie.jsx b/dev/Common/ClientStorageDriver/Cookie.jsx index 106021758..d7c493ede 100644 --- a/dev/Common/ClientStorageDriver/Cookie.jsx +++ b/dev/Common/ClientStorageDriver/Cookie.jsx @@ -22,19 +22,25 @@ class CookieDriver const storageValue = $.cookie(CLIENT_SIDE_STORAGE_INDEX_NAME); storageResult = null === storageValue ? null : JSON.parse(storageValue); } - catch (e) {} + catch (e) + { + // eslint-disable-line no-empty + } (storageResult || (storageResult = {}))[key] = data; try { $.cookie(CLIENT_SIDE_STORAGE_INDEX_NAME, JSON.stringify(storageResult), { - 'expires': 30 + expires: 30 }); result = true; } - catch (e) {} + catch (e) + { + // eslint-disable-line no-empty + } return result; } @@ -43,7 +49,7 @@ class CookieDriver * @param {string} key * @return {*} */ - get(sKey) { + get(key) { let result = null; @@ -56,10 +62,13 @@ class CookieDriver result = (storageResult && !Utils.isUnd(storageResult[key])) ? storageResult[key] : null; } - catch (e) {} + catch (e) + { + // eslint-disable-line no-empty + } - return mResult; - }; + return result; + } /** * @return {boolean} diff --git a/dev/Common/ClientStorageDriver/LocalStorage.jsx b/dev/Common/ClientStorageDriver/LocalStorage.jsx index 16e71fdf0..b71799644 100644 --- a/dev/Common/ClientStorageDriver/LocalStorage.jsx +++ b/dev/Common/ClientStorageDriver/LocalStorage.jsx @@ -22,7 +22,10 @@ class LocalStorageDriver const storageValue = window.localStorage[CLIENT_SIDE_STORAGE_INDEX_NAME] || null; storageResult = null === storageValue ? null : JSON.parse(storageValue); } - catch (e) {} + catch (e) + { + // eslint-disable-line no-empty + } (storageResult || (storageResult = {}))[key] = data; @@ -31,7 +34,10 @@ class LocalStorageDriver window.localStorage[CLIENT_SIDE_STORAGE_INDEX_NAME] = JSON.stringify(storageResult); result = true; } - catch (e) {} + catch (e) + { + // eslint-disable-line no-empty + } return result; } @@ -41,19 +47,22 @@ class LocalStorageDriver * @return {*} */ get(key) { - + let result = null; - + try { - const + const storageValue = window.localStorage[CLIENT_SIDE_STORAGE_INDEX_NAME] || null, storageResult = null === storageValue ? null : JSON.parse(storageValue) ; - result = (storageResult && !Utils.isUnd(storageResult[key])) ? storageResult[key] : null + result = (storageResult && !Utils.isUnd(storageResult[key])) ? storageResult[key] : null; + } + catch (e) + { + // eslint-disable-line no-empty } - catch (e) {} return result; } diff --git a/dev/Common/Consts.jsx b/dev/Common/Consts.jsx index 19fc462e1..7b150b60d 100644 --- a/dev/Common/Consts.jsx +++ b/dev/Common/Consts.jsx @@ -1,7 +1,9 @@ +/* eslint max-len: 0 */ + export const MESSAGES_PER_PAGE = 20; -export const MESSAGES_PER_PAGE_VALUES = [10, 20, 30, 50, 100/*, 150, 200, 300*/]; +export const MESSAGES_PER_PAGE_VALUES = [10, 20, 30, 50, 100]; export const CONTACTS_PER_PAGE = 50; diff --git a/dev/Common/Enums.jsx b/dev/Common/Enums.jsx index 210315dbe..f19bdaa45 100644 --- a/dev/Common/Enums.jsx +++ b/dev/Common/Enums.jsx @@ -1,4 +1,6 @@ +/* eslint quote-props: 0 */ + /** * @enum {string} */ @@ -18,7 +20,7 @@ export const FileType = { 'Certificate': 'certificate', 'CertificateBin': 'certificate-bin', 'Archive': 'archive' -} +}; /** * @enum {string} @@ -28,7 +30,7 @@ export const StorageResultType = { 'Abort': 'abort', 'Error': 'error', 'Unload': 'unload' -} +}; /** * @enum {string} @@ -38,7 +40,7 @@ export const Focused = { 'MessageList': 'message-list', 'MessageView': 'message-view', 'FolderList': 'folder-list' -} +}; /** * @enum {number} @@ -47,7 +49,7 @@ export const State = { 'Empty': 10, 'Login': 20, 'Auth': 30 -} +}; /** * @enum {number} @@ -55,7 +57,7 @@ export const State = { export const StateType = { 'Webmail': 0, 'Admin': 1 -} +}; /** * @enum {string} @@ -87,7 +89,7 @@ export const Capa = { 'AutoLogout': 'AUTOLOGOUT', 'AdditionalAccounts': 'ADDITIONAL_ACCOUNTS', 'Identities': 'IDENTITIES' -} +}; /** * @enum {string} @@ -107,7 +109,7 @@ export const KeyState = { 'PopupViewOpenPGP': 'view-open-pgp', 'PopupKeyboardShortcutsHelp': 'popup-keyboard-shortcuts-help', 'PopupAsk': 'popup-ask' -} +}; /** * @enum {number} @@ -121,7 +123,7 @@ export const FolderType = { 'Archive': 15, 'NotSpam': 80, 'User': 99 -} +}; /** * @enum {number} @@ -136,7 +138,7 @@ export const ServerFolderType = { 'IMPORTANT': 10, 'FLAGGED': 11, 'ALL': 12 -} +}; /** * @enum {string} @@ -145,7 +147,7 @@ export const LoginSignMeTypeAsString = { 'DefaultOff': 'defaultoff', 'DefaultOn': 'defaulton', 'Unused': 'unused' -} +}; /** * @enum {number} @@ -154,7 +156,7 @@ export const LoginSignMeType = { 'DefaultOff': 0, 'DefaultOn': 1, 'Unused': 2 -} +}; /** * @enum {string} @@ -167,7 +169,7 @@ export const ComposeType = { 'ForwardAsAttachment': 'forward-as-attachment', 'Draft': 'draft', 'EditAsNew': 'editasnew' -} +}; /** * @enum {number} @@ -181,7 +183,7 @@ export const UploadErrorCode = { 'FileOnSaveingError': 5, 'FileType': 98, 'Unknown': 99 -} +}; /** * @enum {number} @@ -193,7 +195,7 @@ export const SetSystemFoldersNotification = { 'Spam': 3, 'Trash': 4, 'Archive': 5 -} +}; /** * @enum {number} @@ -208,7 +210,7 @@ export const ClientSideKeyName = { 'LastReplyAction': 6, 'LastSignMe': 7, 'ComposeLastIdentityID': 8 -} +}; /** * @enum {number} @@ -231,7 +233,7 @@ export const EventKeyCode = { 'Delete': 46, 'A': 65, 'S': 83 -} +}; /** * @enum {number} @@ -241,7 +243,7 @@ export const MessageSetAction = { 'UnsetSeen': 1, 'SetFlag': 2, 'UnsetFlag': 3 -} +}; /** * @enum {number} @@ -254,7 +256,7 @@ export const MessageSelectAction = { 'Seen': 4, 'Flagged': 5, 'Unflagged': 6 -} +}; /** * @enum {number} @@ -264,7 +266,7 @@ export const DesktopNotification = { 'NotAllowed': 1, 'Denied': 2, 'NotSupported': 9 -} +}; /** * @enum {number} @@ -273,7 +275,7 @@ export const MessagePriority = { 'Low': 5, 'Normal': 3, 'High': 1 -} +}; /** * @enum {string} @@ -283,7 +285,7 @@ export const EditorDefaultType = { 'Plain': 'Plain', 'HtmlForced': 'HtmlForced', 'PlainForced': 'PlainForced' -} +}; /** * @enum {number} @@ -292,7 +294,7 @@ export const ServerSecure = { 'None': 0, 'SSL': 1, 'TLS': 2 -} +}; /** * @enum {number} @@ -302,7 +304,7 @@ export const SearchDateType = { 'Days3': 3, 'Days7': 7, 'Month': 30 -} +}; /** * @enum {number} @@ -312,7 +314,7 @@ export const SaveSettingsStep = { 'Idle': -1, 'TrueResult': 1, 'FalseResult': 0 -} +}; /** * @enum {number} @@ -322,7 +324,7 @@ export const Layout = { 'SidePreview': 1, 'BottomPreview': 2, 'Mobile': 3 -} +}; /** * @enum {string} @@ -333,7 +335,7 @@ export const FilterConditionField = { 'Subject': 'Subject', 'Header': 'Header', 'Size': 'Size' -} +}; /** * @enum {string} @@ -345,7 +347,7 @@ export const FilterConditionType = { 'NotEqualTo': 'NotEqualTo', 'Over': 'Over', 'Under': 'Under' -} +}; /** * @enum {string} @@ -357,7 +359,7 @@ export const FiltersAction = { 'Vacation': 'Vacation', 'Reject': 'Reject', 'Forward': 'Forward' -} +}; /** * @enum {string} @@ -365,7 +367,7 @@ export const FiltersAction = { export const FilterRulesType = { 'All': 'All', 'Any': 'Any' -} +}; /** * @enum {number} @@ -377,7 +379,7 @@ export const SignedVerifyStatus = { 'Error': -1, 'None': 0, 'Success': 1 -} +}; /** * @enum {number} @@ -409,7 +411,7 @@ export const ContactPropertyType = { 'Note': 110, 'Custom': 250 -} +}; /** * @enum {number} @@ -489,4 +491,4 @@ export const Notification = { 'UnknownNotification': 999, 'UnknownError': 999 -} \ No newline at end of file +}; diff --git a/dev/Common/HtmlEditor.jsx b/dev/Common/HtmlEditor.jsx index d323a0a8b..af20f2d24 100644 --- a/dev/Common/HtmlEditor.jsx +++ b/dev/Common/HtmlEditor.jsx @@ -1,5 +1,5 @@ -import {window, _} from 'common'; +import {window, _, $} from 'common'; import Globals from 'Common/Globals'; import Settings from 'Storage/Settings'; @@ -9,7 +9,7 @@ class HtmlEditor $element = null; blurTimer = 0; - + onBlur = null; onReady = null; onModeChange = null; @@ -70,9 +70,9 @@ class HtmlEditor if (this.editor) { this.editor.execCommand('insertSignature', { - 'isHtml': html, - 'insertBefore': insertBefore, - 'signature': signature + isHtml: html, + insertBefore: insertBefore, + signature: signature }); } } @@ -117,12 +117,11 @@ class HtmlEditor } else { - result = wrapIsHtml ? + result = wrapIsHtml ? '
' + this.editor.getData() + '
' : this.editor.getData(); } - } - catch (e) {} + } catch (e) {/* eslint-disable-line no-empty */} if (clearSignatureSigns) { @@ -160,7 +159,7 @@ class HtmlEditor this.editor.setMode('plain'); } } - } catch(e) {} + } catch (e) {/* eslint-disable-line no-empty */} if (resize) { @@ -189,7 +188,7 @@ class HtmlEditor try { this.editor.setData(html); - } catch (e) {} + } catch (e) {/* eslint-disable-line no-empty */} if (focus) { @@ -204,7 +203,7 @@ class HtmlEditor try { this.editor.setData( this.editor.getData().replace(find, replaceHtml)); - } catch (e) {} + } catch (e) {/* eslint-disable-line no-empty */} } } @@ -214,13 +213,13 @@ class HtmlEditor this.modeToggle(false); if ('plain' === this.editor.mode && this.editor.plugins.plain && this.editor.__plain) { - return this.editor.__plain.setRawData(plain); + this.editor.__plain.setRawData(plain); } else { try { this.editor.setData(plain); - } catch (e) {} + } catch (e) {/* eslint-disable-line no-empty */} } if (focus) @@ -254,7 +253,7 @@ class HtmlEditor if (!biti) { - config.removePlugins += (config.removePlugins ? ',' : '') + 'bidi'; + config.removePlugins += (config.removePlugins ? ',' : '') + 'bidi'; } } @@ -294,7 +293,7 @@ class HtmlEditor if (window.FileReader) { - this.editor.on('drop', (event) => { + this.editor.on('drop', (event) => { if (0 < event.data.dataTransfer.getFilesCount()) { const file = event.data.dataTransfer.getFile(0); @@ -304,7 +303,7 @@ class HtmlEditor var id = event.data.dataTransfer.id, imageId = `[img=${id}]`, - reader = new window.FileReader() + reader = new window.FileReader() ; reader.onloadend = () => { @@ -361,7 +360,7 @@ class HtmlEditor { try { this.editor.focus(); - } catch (e) {} + } catch (e) {/* eslint-disable-line no-empty */} } } @@ -370,7 +369,7 @@ class HtmlEditor { try { return !!this.editor.focusManager.hasFocus; - } catch (e) {} + } catch (e) {/* eslint-disable-line no-empty */} } return false; @@ -381,7 +380,7 @@ class HtmlEditor { try { this.editor.focusManager.blur(true); - } catch (e) {} + } catch (e) {/* eslint-disable-line no-empty */} } } @@ -390,7 +389,7 @@ class HtmlEditor { try { this.editor.resize(this.$element.width(), this.$element.innerHeight()); - } catch (e) {} + } catch (e) {/* eslint-disable-line no-empty */} } } @@ -399,7 +398,7 @@ class HtmlEditor { try { this.editor.setReadOnly(!!value); - } catch (e) {} + } catch (e) {/* eslint-disable-line no-empty */} } } diff --git a/dev/Common/Links.jsx b/dev/Common/Links.jsx index b0a5d0970..659565b48 100644 --- a/dev/Common/Links.jsx +++ b/dev/Common/Links.jsx @@ -314,7 +314,7 @@ class Links * @return {string} */ sound(fileName) { - return this.sStaticPrefix + 'sounds/' + fileName; + return this.sStaticPrefix + 'sounds/' + fileName; } /** diff --git a/dev/Common/Mime.jsx b/dev/Common/Mime.jsx index 38b1fa137..9fc1a42eb 100644 --- a/dev/Common/Mime.jsx +++ b/dev/Common/Mime.jsx @@ -1,6 +1,8 @@ +/* eslint key-spacing: 0 */ +/* eslint quote-props: 0 */ + module.exports = { - 'eml' : 'message/rfc822', 'mime' : 'message/rfc822', 'txt' : 'text/plain', @@ -159,5 +161,4 @@ module.exports = { // open office 'odt' : 'application/vnd.oasis.opendocument.text', 'ods' : 'application/vnd.oasis.opendocument.spreadsheet' - }; diff --git a/dev/Common/Momentor.jsx b/dev/Common/Momentor.jsx index 182c9fdc9..2a9a6003b 100644 --- a/dev/Common/Momentor.jsx +++ b/dev/Common/Momentor.jsx @@ -53,11 +53,11 @@ class Momentor return m.fromNow(); case now.format('L') === m.format('L'): return Translator.i18n('MESSAGE_LIST/TODAY_AT', { - 'TIME': m.format('LT') + TIME: m.format('LT') }); case now.clone().subtract('days', 1).format('L') === m.format('L'): return Translator.i18n('MESSAGE_LIST/YESTERDAY_AT', { - 'TIME': m.format('LT') + TIME: m.format('LT') }); case now.year() === m.year(): return m.format('D MMM.'); diff --git a/dev/Common/Selector.jsx b/dev/Common/Selector.jsx index ed3cd4376..d23caead1 100644 --- a/dev/Common/Selector.jsx +++ b/dev/Common/Selector.jsx @@ -23,7 +23,7 @@ class Selector this.listChecked = ko.computed(() => { return _.filter(this.list(), (item) => item.checked()); - }, this).extend({'rateLimit': 0}); + }, this).extend({rateLimit: 0}); this.isListChecked = ko.computed(() => 0 < this.listChecked().length); @@ -77,7 +77,7 @@ class Selector }, this); - this.selectedItem = this.selectedItem.extend({'toggleSubscribe': [null, + this.selectedItem = this.selectedItem.extend({toggleSubscribe: [null, (prev) => { if (prev) { @@ -91,7 +91,7 @@ class Selector } ]}); - this.focusedItem = this.focusedItem.extend({'toggleSubscribe': [null, + this.focusedItem = this.focusedItem.extend({toggleSubscribe: [null, (prev) => { if (prev) { @@ -291,14 +291,14 @@ class Selector { if (!item) { - (this.oCallbacks['onItemSelect'] || this.emptyFunction)(item || null); + (this.oCallbacks.onItemSelect || this.emptyFunction)(item || null); } } else { if (item) { - (this.oCallbacks['onItemSelect'] || this.emptyFunction)(item); + (this.oCallbacks.onItemSelect || this.emptyFunction)(item); } } } @@ -416,14 +416,14 @@ class Selector * @return {boolean} */ autoSelect() { - return !!(this.oCallbacks['onAutoSelect'] || this.emptyTrueFunction)(); + return !!(this.oCallbacks.onAutoSelect || this.emptyTrueFunction)(); } /** * @param {boolean} up */ doUpUpOrDownDown(up) { - (this.oCallbacks['onUpUpOrDownDown'] || this.emptyTrueFunction)(!!up); + (this.oCallbacks.onUpUpOrDownDown || this.emptyTrueFunction)(!!up); } /** @@ -434,7 +434,7 @@ class Selector let uid = ''; - const getItemUidCallback = this.oCallbacks['onItemGetUid'] || null; + const getItemUidCallback = this.oCallbacks.onItemGetUid || null; if (getItemUidCallback && item) { uid = getItemUidCallback(item); @@ -465,18 +465,22 @@ class Selector { if (!oFocused) { - if (EventKeyCode.Down === iEventKeyCode || EventKeyCode.Insert === iEventKeyCode || EventKeyCode.Space === iEventKeyCode || EventKeyCode.Home === iEventKeyCode || EventKeyCode.PageUp === iEventKeyCode) + if (EventKeyCode.Down === iEventKeyCode || EventKeyCode.Insert === iEventKeyCode || + EventKeyCode.Space === iEventKeyCode || EventKeyCode.Home === iEventKeyCode || + EventKeyCode.PageUp === iEventKeyCode) { oResult = aList[0]; } - else if (EventKeyCode.Up === iEventKeyCode || EventKeyCode.End === iEventKeyCode || EventKeyCode.PageDown === iEventKeyCode) + else if (EventKeyCode.Up === iEventKeyCode || EventKeyCode.End === iEventKeyCode || + EventKeyCode.PageDown === iEventKeyCode) { oResult = aList[aList.length - 1]; } } else if (oFocused) { - if (EventKeyCode.Down === iEventKeyCode || EventKeyCode.Up === iEventKeyCode || EventKeyCode.Insert === iEventKeyCode || EventKeyCode.Space === iEventKeyCode) + if (EventKeyCode.Down === iEventKeyCode || EventKeyCode.Up === iEventKeyCode || + EventKeyCode.Insert === iEventKeyCode || EventKeyCode.Space === iEventKeyCode) { _.each(aList, (item) => { if (!bStop) @@ -649,7 +653,7 @@ class Selector } else { - this.oContentScrollable.stop().animate({'scrollTop': 0}, 200); + this.oContentScrollable.stop().animate({scrollTop: 0}, 200); } return true; diff --git a/dev/Common/Translator.jsx b/dev/Common/Translator.jsx index ce8b4fe6c..4efa11c26 100644 --- a/dev/Common/Translator.jsx +++ b/dev/Common/Translator.jsx @@ -11,7 +11,7 @@ class Translator notificationI18N = {}; constructor() { - this.data = window['rainloopI18N'] || {}; + this.data = window.rainloopI18N || {}; this.trigger = ko.observable(false); this.i18n = _.bind(this.i18n, this); this.init(); @@ -27,9 +27,14 @@ class Translator let valueName = '', - result = _.isUndefined(this.data[key]) ? (_.isUndefined(defaulValue) ? key : defaulValue) : this.data[key] + result = this.data[key] ; + if (_.isUndefined(result)) + { + result = _.isUndefined(defaulValue) ? key : defaulValue; + } + if (!_.isUndefined(valueList) && !_.isNull(valueList)) { for (valueName in valueList) @@ -92,16 +97,21 @@ class Translator if (animate && Globals.bAnimationSupported) { $('.i18n-animation[data-i18n]', elements).letterfx({ - 'fx': 'fall fade', 'backwards': false, 'timing': 50, 'fx_duration': '50ms', 'letter_end': 'restore', 'element_end': 'restore' + fx: 'fall fade', + backwards: false, + timing: 50, + fx_duration: '50ms', + letter_end: 'restore', + element_end: 'restore' }); } }); } reloadData() { - if (window['rainloopI18N']) + if (window.rainloopI18N) { - this.data = window['rainloopI18N'] || {}; + this.data = window.rainloopI18N || {}; this.i18nToNodes(window.document, true); @@ -109,7 +119,7 @@ class Translator this.trigger(!this.trigger()); } - window['rainloopI18N'] = null; + window.rainloopI18N = null; } initNotificationLanguage() { @@ -299,9 +309,9 @@ class Translator Globals.$html.addClass('rl-changing-language'); $.ajax({ - 'url': require('Common/Links').langLink(language, admin), - 'dataType': 'script', - 'cache': true + url: require('Common/Links').langLink(language, admin), + dataType: 'script', + cache: true }) .fail(fail || Utils.emptyFunction) .done(function () { diff --git a/dev/Common/Utils.js b/dev/Common/Utils.js index 85a6773fd..21e190737 100644 --- a/dev/Common/Utils.js +++ b/dev/Common/Utils.js @@ -30,6 +30,21 @@ Utils.isNull = _.isNull; Utils.emptyFunction = Utils.noop = function () {}; + /** + * @param {Function} callback + */ + Utils.silentTryCatch = function (callback) + { + try + { + callback(); + } + catch (e) + { + // eslint-disable-line no-empty + } + }; + /** * @param {*} oValue * @return {boolean} @@ -576,16 +591,17 @@ Utils.createCommand = function (oContext, fExecute, fCanExecute) { var + fResult = Utils.emptyFunction, fNonEmpty = function () { if (fResult && fResult.canExecute && fResult.canExecute()) { fExecute.apply(oContext, Array.prototype.slice.call(arguments)); } return false; - }, - fResult = fExecute ? fNonEmpty : Utils.emptyFunction + } ; + fResult = fExecute ? fNonEmpty : Utils.emptyFunction; fResult.enabled = ko.observable(true); fCanExecute = Utils.isUnd(fCanExecute) ? true : fCanExecute; diff --git a/dev/Component/AbstracRadio.jsx b/dev/Component/AbstracRadio.jsx index 03cde5e5e..a44d168da 100644 --- a/dev/Component/AbstracRadio.jsx +++ b/dev/Component/AbstracRadio.jsx @@ -27,7 +27,7 @@ class AbstracRadio extends AbstractComponent if (params.values) { this.values(_.map(params.values, (label, value) => { - return {'label': label, 'value': value}; + return {label: label, value: value}; })); } @@ -39,7 +39,7 @@ class AbstracRadio extends AbstractComponent { this.value(value.value); } - }; + } } export {AbstracRadio, AbstracRadio as default}; diff --git a/dev/Component/Abstract.jsx b/dev/Component/Abstract.jsx index 637f2cc6d..a6fd5bbb0 100644 --- a/dev/Component/Abstract.jsx +++ b/dev/Component/Abstract.jsx @@ -50,6 +50,6 @@ const componentExportHelper = (ClassObject, templateID = '') => { } } }; -} +}; export {AbstractComponent, componentExportHelper}; diff --git a/dev/Component/AbstractInput.jsx b/dev/Component/AbstractInput.jsx index 6f9a45aa6..487dcca86 100644 --- a/dev/Component/AbstractInput.jsx +++ b/dev/Component/AbstractInput.jsx @@ -35,7 +35,7 @@ class AbstractInput extends AbstractComponent ' ' + Utils.trim('settings-saved-trigger-input ' + this.classForTrigger()) : '' ; - return (0 < size ? 'span' + size : '') + suffixValue; + return (size > 0 ? 'span' + size : '') + suffixValue; }, this); diff --git a/dev/Component/MaterialDesign/Checkbox.jsx b/dev/Component/MaterialDesign/Checkbox.jsx index da77e0122..2f71fb5e5 100644 --- a/dev/Component/MaterialDesign/Checkbox.jsx +++ b/dev/Component/MaterialDesign/Checkbox.jsx @@ -10,11 +10,11 @@ class CheckboxMaterialDesignComponent extends AbstracCheckbox * @param {Object} params */ constructor(params) { - + super(params); - this.animationBox = ko.observable(false).extend({'falseTimeout': 200}); - this.animationCheckmark = ko.observable(false).extend({'falseTimeout': 200}); + this.animationBox = ko.observable(false).extend({falseTimeout: 200}); + this.animationCheckmark = ko.observable(false).extend({falseTimeout: 200}); this.animationBoxSetTrue = _.bind(this.animationBoxSetTrue, this); this.animationCheckmarkSetTrue = _.bind(this.animationCheckmarkSetTrue, this); diff --git a/dev/Component/SaveTrigger.jsx b/dev/Component/SaveTrigger.jsx index 4c6a8da64..f967533a4 100644 --- a/dev/Component/SaveTrigger.jsx +++ b/dev/Component/SaveTrigger.jsx @@ -73,7 +73,7 @@ class SaveTriggerComponent extends AbstractComponent ; break; } - }; + } } module.exports = componentExportHelper(SaveTriggerComponent, 'SaveTriggerComponent'); diff --git a/dev/Component/SvgIcon.jsx b/dev/Component/SvgIcon.jsx index 47d740f14..b653056be 100644 --- a/dev/Component/SvgIcon.jsx +++ b/dev/Component/SvgIcon.jsx @@ -6,7 +6,7 @@ let getUtl = () => { if (!cachedUrl) { - const version = $('#rlAppVersion').attr('content') || '0.0.0'; // TODO + const version = $('#rlAppVersion').attr('content') || '0.0.0'; cachedUrl = `rainloop/v/${version}/static/css/svg/icons.svg`; } diff --git a/dev/Knoin/AbstractBoot.jsx b/dev/Knoin/AbstractBoot.jsx index a9c086c1b..6dad3ce41 100644 --- a/dev/Knoin/AbstractBoot.jsx +++ b/dev/Knoin/AbstractBoot.jsx @@ -1,7 +1,9 @@ class AbstractBoot { - bootstart(Remote) {} + bootstart() { + // eslint-disable-line no-empty + } } export {AbstractBoot, AbstractBoot as default}; diff --git a/dev/Model/OpenPgpKey.js b/dev/Model/OpenPgpKey.js index c68c7013d..06b93581f 100644 --- a/dev/Model/OpenPgpKey.js +++ b/dev/Model/OpenPgpKey.js @@ -86,17 +86,17 @@ this.user = this.users[index]; this.email = this.emails[index]; } - } + }; OpenPgpKeyModel.prototype.selectUser = function (sUser) { this.select(sUser, 'users'); - } + }; OpenPgpKeyModel.prototype.selectEmail = function (sEmail) { this.select(sEmail, 'emails'); - } + }; module.exports = OpenPgpKeyModel; diff --git a/dev/Storage/Settings.jsx b/dev/Storage/Settings.jsx index ba4c35aa7..502b02ab6 100644 --- a/dev/Storage/Settings.jsx +++ b/dev/Storage/Settings.jsx @@ -5,8 +5,8 @@ import Utils from 'Common/Utils'; class SettingsStorage { constructor() { - this.settings = window['rainloopAppData'] || {}; - this.settings = Utils.isNormal(this.settings) ? this.settings : {}; + this.settings = window.rainloopAppData || {}; + this.settings = Utils.isNormal(this.settings) ? this.settings : {}; } /** @@ -32,7 +32,7 @@ class SettingsStorage capa(name) { const values = this.settingsGet('Capa'); return Utils.isArray(values) && Utils.isNormal(name) && -1 < Utils.inArray(name, values); - }; + } } module.exports = new SettingsStorage(); diff --git a/dev/Stores/Admin/App.jsx b/dev/Stores/Admin/App.jsx index 26f5519dd..3fa2c8820 100644 --- a/dev/Stores/Admin/App.jsx +++ b/dev/Stores/Admin/App.jsx @@ -26,7 +26,7 @@ class AppAdminStore extends AbstractAppStore this.weakPassword(!!Settings.settingsGet('WeakPassword')); this.useLocalProxyForExternalImages(!!Settings.settingsGet('UseLocalProxyForExternalImages')); - }; + } } module.exports = new AppAdminStore(); diff --git a/dev/Stores/User/App.jsx b/dev/Stores/User/App.jsx index 05a22b4c5..f1b69355f 100644 --- a/dev/Stores/User/App.jsx +++ b/dev/Stores/User/App.jsx @@ -21,6 +21,8 @@ class AppUserStore extends AbstractAppStore switch (value) { + default: + break; case Focused.MessageList: Globals.keyScope(KeyState.MessageList); break; @@ -66,7 +68,7 @@ class AppUserStore extends AbstractAppStore this.devEmail = Settings.settingsGet('DevEmail'); this.devPassword = Settings.settingsGet('DevPassword'); - }; + } } module.exports = new AppUserStore(); diff --git a/dev/Stores/User/Identity.jsx b/dev/Stores/User/Identity.jsx index 31d840d3e..a966f3471 100644 --- a/dev/Stores/User/Identity.jsx +++ b/dev/Stores/User/Identity.jsx @@ -7,12 +7,12 @@ class IdentityUserStore constructor() { this.identities = ko.observableArray([]); - this.identities.loading = ko.observable(false).extend({'throttle': 100}); + this.identities.loading = ko.observable(false).extend({throttle: 100}); this.identitiesIDS = ko.computed(() => { return _.compact(_.map(this.identities(), (item) => item ? item.id : null)); }, this); } } - + module.exports = new IdentityUserStore(); diff --git a/dev/Styles/_FontasticToBoot.less b/dev/Styles/_FontasticToBoot.less index 8b562a34c..2bafb51cb 100644 --- a/dev/Styles/_FontasticToBoot.less +++ b/dev/Styles/_FontasticToBoot.less @@ -8,9 +8,11 @@ font-size: 16px; vertical-align: text-top; - &.disabled, - .disabled & { + .btn.disabled &, .btn[disabled] &{ color: grey; + &.icon-white { + color: #fff; + } } } diff --git a/dev/View/Popup/ComposeOpenPgp.js b/dev/View/Popup/ComposeOpenPgp.js index a6a72f9e5..80a782d45 100644 --- a/dev/View/Popup/ComposeOpenPgp.js +++ b/dev/View/Popup/ComposeOpenPgp.js @@ -31,14 +31,6 @@ var self = this; this.optionsCaption = Translator.i18n('PGP_NOTIFICATIONS/ADD_A_PUBLICK_KEY'); - this.addOptionClass = function (oDomOption, oItem) - { - self.defautOptionsAfterRender(oDomOption, oItem); - - if (oItem) { - oDomOption.classList.add(oItem['class']); - } - }; this.notification = ko.observable(''); @@ -276,6 +268,16 @@ kn.extendAsViewModel(['View/Popup/ComposeOpenPgp', 'PopupsComposeOpenPgpViewModel'], ComposeOpenPgpPopupView); _.extend(ComposeOpenPgpPopupView.prototype, AbstractView.prototype); + ComposeOpenPgpPopupView.prototype.addOptionClass = function (oDomOption, oItem) + { + this.defautOptionsAfterRender(oDomOption, oItem); + + if (oItem) + { + oDomOption.classList.add(oItem['class']); + } + }; + ComposeOpenPgpPopupView.prototype.deletePublickKey = function (oKey) { this.encryptKeys.remove(oKey); @@ -397,7 +399,7 @@ return { 'empty': !oKey, 'selected': ko.observable(!!oKey), - 'removable': oIdentity && oIdentity.email() && oIdentity.email() !== sEmail, + 'removable': oIdentity && oIdentity.email() && oIdentity.email() !== sEmail, 'users': oKey ? (oKey.users || [sEmail]) : [sEmail], 'hash': oKey ? oKey.id.substr(-8).toUpperCase() : '', 'key': oKey diff --git a/dev/bootstrap.jsx b/dev/bootstrap.jsx index 2d275e763..a82d5ce64 100644 --- a/dev/bootstrap.jsx +++ b/dev/bootstrap.jsx @@ -32,6 +32,7 @@ export default (App) => { ; // export + /* eslint dot-notation: 0 */ window['rl'] = window['rl'] || {}; window['rl']['i18n'] = _.bind(Translator.i18n, Translator); @@ -82,4 +83,4 @@ export default (App) => { }, 10)); }; -} +}; diff --git a/gulpfile.js b/gulpfile.js index 200794b1e..e21833906 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -440,7 +440,7 @@ gulp.task('js:chunks', ['js:webpack'], function() { }); // - min -gulp.task('js:min', ['js:app', 'js:admin', 'js:chunks'], function() { +gulp.task('js:min', ['js:app', 'js:admin', 'js:chunks', 'js:validate'], function() { return gulp.src(cfg.paths.staticJS + '*.js') .pipe(replace(/"rainloop\/v\/([^\/]+)\/static\/js\/"/g, '"rainloop/v/$1/static/js/min/"')) .pipe(uglify(cfg.uglify)) @@ -478,17 +478,14 @@ gulp.task('js:eslint', function() { var eslint = require('gulp-eslint'); return gulp.src(cfg.paths.globjsxonly) - .pipe(eslint({ - parser: 'babel-eslint', - rules: { - 'strict': 0 - } - })) + .pipe(eslint()) .pipe(eslint.format()) .pipe(eslint.failAfterError()) ; }); +gulp.task('js:validate', ['js:lint', 'js:eslint']); + // OTHER regOtherMinTask('other:cookie', 'vendors/jquery-cookie/', 'jquery.cookie.js', 'jquery.cookie-1.4.0.min.js', '/*! jquery.cookie v1.4.0 (c) 2013 Klaus Hartl | MIT */\n'); @@ -743,6 +740,8 @@ gulp.task('watch+', ['fast+'], function() { gulp.task('build', ['rainloop']); gulp.task('build+', ['rainloop+']); +gulp.task('js:v', ['js:validate']); + gulp.task('w', ['watch']); gulp.task('w+', ['watch+']); gulp.task('f', ['fast']); diff --git a/package.json b/package.json index 1ed96ee73..a11d2e0a1 100644 --- a/package.json +++ b/package.json @@ -2,7 +2,7 @@ "name": "RainLoop", "title": "RainLoop Webmail", "version": "1.9.4", - "release": "402", + "release": "415", "description": "Simple, modern & fast web-based email client", "homepage": "http://rainloop.net", "main": "gulpfile.js", @@ -40,7 +40,7 @@ "plugins" ], "readmeFilename": "README.md", - "ownCloudPackageVersion": "4.12", + "ownCloudPackageVersion": "4.14", "engines": { "node": ">= 0.10.0" },