diff --git a/.eslintrc.js b/.eslintrc.js
index ea646c8e3..66f76a94f 100644
--- a/.eslintrc.js
+++ b/.eslintrc.js
@@ -1,236 +1,287 @@
module.exports = {
- "extends": "eslint:recommended",
- "ecmaFeatures": {
- "modules": true
+ 'extends': 'eslint:recommended',
+ 'ecmaFeatures': {
+ 'modules': true
},
- "parserOptions": {
- "ecmaVersion": 6,
- "sourceType": "module"
+ 'parserOptions': {
+ 'ecmaVersion': 6,
+ 'sourceType': 'module'
},
- "env": {
- "node": true,
- "commonjs": true,
- "es6": true,
- "browser": true
+ 'env': {
+ 'node': true,
+ 'commonjs': true,
+ 'es6': true,
+ 'browser': true
},
- "globals": {
- "RL_COMMUNITY": true,
- "ko": true,
- "ssm": true,
- "moment": true,
- "ifvisible": true,
- "crossroads": true,
- "hasher": true,
- "key": true,
- "Jua": true,
- "_": true,
- "$": true,
- "Dropbox": true
+ 'globals': {
+ 'RL_COMMUNITY': true,
+ 'ko': true,
+ 'ssm': true,
+ 'moment': true,
+ 'ifvisible': true,
+ 'crossroads': true,
+ 'hasher': true,
+ 'key': true,
+ 'Jua': true,
+ '_': true,
+ '$': true,
+ 'Dropbox': true
},
- "rules": {
-
- "strict": 2, // require or disallow strict mode directives
+ // http://eslint.org/docs/rules/
+ 'rules': {
// errors
-
- "comma-dangle": [2, "never"], // disallow or enforce trailing commas
- "no-cond-assign": [2, "always"], // disallow assignment in conditional expressions
- "no-console": 2, // disallow use of console (off by default in the node environment)
- "no-constant-condition": 2, // disallow use of constant expressions in conditions
- "no-control-regex": 2, // disallow control characters in regular expressions
- "no-debugger": 2, // disallow use of debugger
- "no-dupe-args": 2, // disallow duplicate arguments in functions
- "no-dupe-keys": 2, // disallow duplicate keys when creating object literals
- "no-duplicate-case": 2, // disallow a duplicate case label.
- "no-empty": 2, // disallow empty statements
- "no-empty-character-class": 2, // disallow the use of empty character classes in regular expressions
- "no-ex-assign": 2, // disallow assigning to the exception in a catch block
- "no-extra-boolean-cast": 2, // disallow double-negation boolean casts in a boolean context
-// "no-extra-parens": 2, // disallow unnecessary parentheses (off by default)
- "no-extra-semi": 2, // disallow unnecessary semicolons
- "no-func-assign": 2, // disallow overwriting functions written as function declarations
- "no-inner-declarations": 2, // disallow function or variable declarations in nested blocks
- "no-invalid-regexp": 2, // disallow invalid regular expression strings in the RegExp constructor
- "no-irregular-whitespace": 2, // disallow irregular whitespace outside of strings and comments
- "no-negated-in-lhs": 2, // disallow negation of the left operand of an in expression
- "no-obj-calls": 2, // disallow the use of object properties of the global object (Math and JSON) as functions
- "no-regex-spaces": 2, // disallow multiple spaces in a regular expression literal
- "no-sparse-arrays": 2, // disallow sparse arrays
- "no-unexpected-multiline": 2, // disallow confusing multiline expressions
- "no-unreachable": 2, // disallow unreachable statements after a return, throw, continue, or break statement
- "use-isnan": 2, // disallow comparisons with the value NaN
- "valid-typeof": 2, // Ensure that the results of typeof are compared against a valid string
-
-// "valid-jsdoc": [2, { // Ensure JSDoc comments are valid (off by default)
-// "requireParamDescription": false,
-// "requireReturnDescription": false
+ 'no-cond-assign': [2, 'always'],
+ 'no-console': 2,
+ 'no-constant-condition': 2,
+ 'no-control-regex': 2,
+ 'no-debugger': 2,
+ 'no-dupe-args': 2,
+ 'no-dupe-keys': 2,
+ 'no-duplicate-case': 2,
+ 'no-empty': 2,
+ 'no-empty-character-class': 2,
+ 'no-ex-assign': 2,
+ 'no-extra-boolean-cast': 2,
+// 'no-extra-parens': 2,
+ '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-prototype-builtins': 2,
+ 'no-regex-spaces': 2,
+ 'no-sparse-arrays': 2,
+ 'no-unexpected-multiline': 2,
+ 'no-unreachable': 2,
+ 'no-unsafe-finally': 2,
+ 'use-isnan': 2,
+// 'valid-jsdoc': [2, {
+// 'requireParamDescription': false,
+// 'requireReturnDescription': false
// }],
+ 'valid-typeof': 2,
// best practices
+ 'accessor-pairs': 2,
+ 'array-callback-return': 2,
+ 'block-scoped-var': 2,
+// 'complexity': 2,
+ 'consistent-return': 2,
+ 'curly': 2,
+ 'default-case': 2,
+ 'dot-location': [2, 'property'],
+ 'dot-notation': 2,
+ 'eqeqeq': 2,
+ 'guard-for-in': 2,
+ 'no-alert': 2,
+ 'no-caller': 2,
+ 'no-case-declarations': 2,
+ 'no-div-regex': 2,
+ 'no-else-return': 2,
+ 'no-empty-function': 2,
+ 'no-empty-pattern': 2,
+ 'no-eq-null': 2,
+ 'no-eval': 2,
+ 'no-extend-native': 2,
+ 'no-extra-bind': 2,
+ 'no-extra-label': 2,
+ 'no-fallthrough': 2,
+ 'no-floating-decimal': 2,
+ 'no-implicit-coercion': [2, {'allow': ['!!', '+']}],
+ 'no-implicit-globals': 2,
+ 'no-implied-eval': 2,
+// 'no-invalid-this': 2,
+ 'no-iterator': 2,
+ 'no-labels': 2,
+ 'no-lone-blocks': 2,
+ 'no-loop-func': 2,
+// 'no-magic-numbers': [2, {
+// 'ignore': [-1, 0, 1],
+// 'ignoreArrayIndexes': true
+// }],
+ 'no-multi-spaces': 2,
+ 'no-multi-str': 2,
+ 'no-native-reassign': 2,
+ 'no-new': 2,
+ 'no-new-func': 2,
+ 'no-new-wrappers': 2,
+ 'no-octal': 2,
+ 'no-octal-escape': 2,
+// 'no-param-reassign': 2,
+ 'no-proto': 2,
+ 'no-redeclare': 2,
+ 'no-return-assign': 2,
+ 'no-script-url': 2,
+ 'no-self-assign': 2,
+ 'no-self-compare': 2,
+ 'no-sequences': 2,
+ 'no-throw-literal': 2,
+ 'no-unmodified-loop-condition': 2,
+ 'no-unused-expressions': 2,
+ 'no-unused-labels': 2,
+ 'no-useless-call': 2,
+ 'no-useless-concat': 2,
+ 'no-useless-escape': 2,
+ 'no-void': 2,
+ 'no-warning-comments': 2,
+ 'no-with': 2,
+ 'radix': 2,
+// 'vars-on-top': 2,
+ 'wrap-iife': 2,
+ 'yoda': [2, 'always'],
- "accessor-pairs": 2, // enforce getter and setter pairs in objects
- "block-scoped-var": 2, // treat var statements as if they were block scoped (off by default). 0: deep destructuring is not compatible https://github.com/eslint/eslint/issues/1863
-// "complexity": 2, // specify the maximum cyclomatic complexity allowed in a program (off by default)
- "consistent-return": 2, // require return statements to either always or never specify values
- "curly": 2, // specify curly brace conventions for allphpuni control statements
- "default-case": 2, // require default case in switch statements (off by default)
- "dot-location": [2, "property"], // enforce consistent newlines before and after dots
- "dot-notation": 2, // encourages use of dot notation whenever possible
- "eqeqeq": 2, // require the use of === and !==
- "guard-for-in": 2, // make sure for-in loops have an if statement (off by default)
- "no-alert": 2, // disallow the use of alert, confirm, and prompt
- "no-caller": 2, // disallow use of arguments.caller or arguments.callee
- "no-div-regex": 2, // disallow division operators explicitly at beginning of regular expression (off by default)
- "no-else-return": 2, // disallow else after a return in an if (off by default)
- "no-eq-null": 2, // disallow comparisons to null without a type-checking operator (off by default)
- "no-eval": 2, // disallow use of eval()
- "no-extend-native": 2, // disallow adding to native types
- "no-extra-bind": 2, // disallow unnecessary function binding
- "no-fallthrough": 2, // disallow fallthrough of case statements
- "no-floating-decimal": 2, // disallow the use of leading or trailing decimal points in numeric literals (off by default)
- "no-implied-eval": 2, // disallow use of eval()-like methods
- "no-iterator": 2, // disallow usage of __iterator__ property
- "no-labels": 2, // disallow use of labeled statements
- "no-lone-blocks": 2, // disallow unnecessary nested blocks
- "no-loop-func": 2, // disallow creation of functions within loops
- "no-multi-spaces": 2, // disallow use of multiple spaces
- "no-multi-str": 2, // disallow use of multiline strings
- "no-native-reassign": 2, // disallow reassignments of native objects
- "no-new": 2, // disallow use of new operator when not part of the assignment or comparison
- "no-new-func": 2, // disallow use of new operator for Function object
- "no-new-wrappers": 2, // disallows creating new instances of String,Number, and Boolean
- "no-octal": 2, // disallow use of octal literals
- "no-octal-escape": 2, // disallow use of octal escape sequences in string literals, such as var foo = "Copyright \251";
-// "no-param-reassign": 2, // disallow reassignment of function parameters (off by default)
- "no-process-env": 2, // disallow use of process.env (off by default)
- "no-proto": 2, // disallow usage of __proto__ property
- "no-redeclare": 2, // disallow declaring the same variable more then once
- "no-return-assign": 2, // disallow use of assignment in return statement
- "no-script-url": 2, // disallow use of javascript: urls.
- "no-self-compare": 2, // disallow comparisons where both sides are exactly the same (off by default)
- "no-sequences": 2, // disallow use of comma operator
- "no-throw-literal": 2, // restrict what can be thrown as an exception (off by default)
- "no-unused-expressions": 2, // disallow usage of expressions in statement position
- "no-void": 2, // disallow use of void operator (off by default)
- "no-warning-comments": 2, // disallow usage of configurable warning terms in comments": 2, // e.g. TODO or FIXME (off by default)
- "no-with": 2, // disallow use of the with statement
- "radix": 2, // require use of the second argument for parseInt() (off by default)
-// "vars-on-top": 2, // requires to declare all vars on top of their containing scope (off by default)
- "wrap-iife": 2, // require immediate function invocation to be wrapped in parentheses (off by default)
- "yoda": [2, "always"], // require or disallow Yoda conditions
+ // strict mode
+ 'strict': 2,
// variables
+ 'init-declarations': 2,
+ 'no-catch-shadow': 2,
+ 'no-delete-var': 2,
+ 'no-label-var': 2,
+ 'no-restricted-globals': 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,
- "no-catch-shadow": 2, // disallow the catch clause parameter name being the same as a variable in the outer scope (off by default in the node environment)
- "no-delete-var": 2, // disallow deletion of variables
- "no-label-var": 2, // disallow labels that share a name with a variable
- "no-shadow": 2, // disallow declaration of variables already declared in the outer scope
- "no-shadow-restricted-names": 2, // disallow shadowing of names such as arguments
- "no-undef": 2, // disallow use of undeclared variables unless mentioned in a /*global */ block
- "no-undef-init": 2, // disallow use of undefined when initializing variables
- "no-undefined": 2, // disallow use of undefined variable (off by default)
- "no-unused-vars": 2, // disallow declaration of variables that are not used in the code
- "no-use-before-define": 2, // disallow use of variables before they are defined
+ // node.js and commonjs
+ 'callback-return': 2,
+// 'global-require': 2,
+ 'handle-callback-err': 2,
+// 'no-mixed-requires': 2,
+ 'no-new-require': 2,
+ 'no-path-concat': 2,
+ 'no-process-env': 2,
+ 'no-process-exit': 2,
+ 'no-restricted-modules': 2,
+// 'no-sync': 2,
// stylistic issues
-
- "array-bracket-spacing": 2, // enforce consistent spacing inside array brackets
- "block-spacing": [2, "never"], // enforce consistent spacing inside single-line blocks
-
-// "brace-style": [2, "1tbs"], // enforce consistent brace style for blocks
-
-// "camelcase": 2, // enforce camelcase naming convention
- "comma-spacing": 2, // enforce consistent spacing before and after commas
- "comma-style": 2, // enforce consistent comma style
- "computed-property-spacing": 2, // enforce consistent spacing inside computed property brackets
- "consistent-this": [2, "self"], // enforce consistent naming when capturing the current execution context
- "eol-last": 2, // enforce at least one newline at the end of files
- "id-match": 2, // require identifiers to match a specified regular expression
-
- "indent": [2, "tab", { // enforce consistent indentation
- "SwitchCase": 1,
- "VariableDeclarator": {
- "var": 1,
- "let": 1,
- "const": 1
+ 'array-bracket-spacing': 2,
+ 'block-spacing': [2, 'never'],
+// 'brace-style': [2, 'allman'],
+// 'camelcase': 2,
+ 'comma-dangle': [2, 'never'],
+ 'comma-spacing': 2,
+ 'comma-style': 2,
+ 'computed-property-spacing': 2,
+ 'consistent-this': [2, 'self'],
+ 'eol-last': 2,
+ 'func-names': [2, 'never'],
+// 'func-style': 2,
+ 'id-blacklist': [2, 'x'],
+ 'id-length': [2, {'min': 1, 'max': 50}],
+ 'id-match': 2,
+ 'indent': [2, 'tab', {
+ 'SwitchCase': 1,
+ 'VariableDeclarator': {
+ 'var': 1,
+ 'let': 1,
+ 'const': 1
}
}],
-
- "key-spacing": 2, // enforce consistent spacing between keys and values in object literal properties
- "linebreak-style": [2, "unix"], // enforce consistent linebreak style
-// "lines-around-comment": 2, // require empty lines around comments
-// "max-depth": 2, // enforce a maximum depth that blocks can be nested
- "max-len": [2, 200], // enforce a maximum line length
-// "max-lines": 2, // enforce a maximum file length
- "max-nested-callbacks": [2, 5], // enforce a maximum depth that callbacks can be nested
-// "max-params": 2, // enforce a maximum number of parameters in function definitions
-// "max-statements": 2, // enforce a maximum number of statements allowed in function blocks
- "max-statements-per-line": 2, // enforce a maximum number of statements allowed per line
- "new-cap": 2, // require constructor function names to begin with a capital letter
- "new-parens": 2, // require parentheses when invoking a constructor with no arguments
-// "newline-after-var": 2, // require or disallow an empty line after var declarations
-// "newline-before-return": 2, // require an empty line before return statements
-// "newline-per-chained-call": 2, // require a newline after each call in a method chain
- "no-array-constructor": 2, // disallow Array constructors
- "no-bitwise": 2, // disallow bitwise operators
- "no-continue": 2, // disallow continue statements
-// "no-inline-comments": 2, // disallow inline comments after code
-// "no-lonely-if": 2, // disallow if statements as the only statement in else blocks
-// "no-mixed-operators": 2, // disallow mixes of different operators
- "no-mixed-spaces-and-tabs": 2, // disallow mixed spaces and tabs for indentation
- "no-multiple-empty-lines": 2, // disallow multiple empty lines
-// "no-negated-condition": 2, // disallow negated conditions
-// "no-nested-ternary": 2, // disallow nested ternary expressions
- "no-new-object": 2, // disallow Object constructors
- "no-plusplus": [2, { // disallow the unary operators ++ and --
- "allowForLoopAfterthoughts": true
+ 'jsx-quotes': 2,
+ 'key-spacing': 2,
+ 'keyword-spacing': 2,
+ 'linebreak-style': [2, 'unix'],
+// 'lines-around-comment': 2,
+ 'max-depth': [2, 10],
+ 'max-len': [2, 200],
+// 'max-lines': 2,
+ 'max-nested-callbacks': [2, 5],
+// 'max-params': 2,
+// 'max-statements': [2, {'max': 10}, {'ignoreTopLevelFunctions': true}],
+ 'max-statements-per-line': 2,
+ 'new-cap': 2,
+ 'new-parens': 2,
+// 'newline-after-var': 2,
+// 'newline-before-return': 2,
+// 'newline-per-chained-call': 2,
+ 'no-array-constructor': 2,
+ 'no-bitwise': 2,
+ 'no-continue': 2,
+// 'no-inline-comments': 2,
+// 'no-lonely-if': 2,
+// 'no-mixed-operators': 2,
+ 'no-mixed-spaces-and-tabs': 2,
+ 'no-multiple-empty-lines': 2,
+// 'no-negated-condition': 2,
+// 'no-nested-ternary': 2,
+ 'no-new-object': 2,
+ 'no-plusplus': [2, {
+ 'allowForLoopAfterthoughts': true
}],
- "no-restricted-syntax": 2, // disallow specified syntax
- "no-spaced-func": 2, // disallow spacing between function identifiers and their applications
- "no-ternary": 0, // disallow ternary operators
- "no-trailing-spaces": 2, // disallow trailing whitespace at the end of lines
-// "no-underscore-dangle": 2, // disallow dangling underscores in identifiers
- "no-unneeded-ternary": 2, // disallow ternary operators when simpler alternatives exist
-// "no-whitespace-before-property": 2, // disallow whitespace before properties
-// "object-curly-newline": 2, // enforce consistent line breaks inside braces
- "object-curly-spacing": [2, "never"], // enforce consistent spacing inside braces
-
-// "object-property-newline": [2, { // enforce placing object properties on separate lines
-// "allowMultiplePropertiesPerLine": false
+ 'no-restricted-syntax': 2,
+ 'no-spaced-func': 2,
+ 'no-ternary': 0,
+ 'no-trailing-spaces': 2, // disallow trailing whitespace at the end of lines
+// 'no-underscore-dangle': 2, // disallow dangling underscores in identifiers
+ 'no-unneeded-ternary': 2, // disallow ternary operators when simpler alternatives exist
+ 'no-whitespace-before-property': 2,
+// 'object-curly-newline': 2,
+ 'object-curly-spacing': [2, 'never'],
+ 'object-property-newline': [2, {'allowMultiplePropertiesPerLine': true}],
+// 'one-var': [2, {
+// 'var': 'always',
+// 'let': 'always',
+// 'const': 'never'
// }],
-
-// "one-var": [2, { // enforce variables to be declared either together or separately in functions
-// "var": "always",
-// "let": "always",
-// "const": "never"
-// }],
-
-// "one-var-declaration-per-line": [2, "always"], // require or disallow newlines around var declarations
- "operator-assignment": 2, // require or disallow assignment operator shorthand where possible
- "operator-linebreak": [2, "after"], // enforce consistent linebreak style for operators
-// "padded-blocks": [2, "never"], // require or disallow padding within blocks
-// "quote-props": [2, "as-needed"], // require quotes around object literal property names
- "quotes": [2, "single"], // enforce the consistent use of either backticks, double, or single quotes
- "require-jsdoc": 2, // require JSDoc comments
- "semi": [2, "always"], // require or disallow semicolons instead of ASI
- "semi-spacing": 2, // enforce consistent spacing before and after semicolons
-// "sort-vars": 2, // require variables within the same declaration block to be sorted
- "space-before-blocks": 2, // enforce consistent spacing before blocks
- "space-before-function-paren": [2, "never"], // enforce consistent spacing before function definition opening parenthesis
- "space-in-parens": 2, // enforce consistent spacing inside parentheses
- "space-infix-ops": 2, // require spacing around operators
- "space-unary-ops": 2, // enforce consistent spacing before or after unary operators
- "spaced-comment": 2, // enforce consistent spacing after the // or /* in a comment
-// "unicode-bom": [2, "never"], // require or disallow the Unicode BOM
- "wrap-regex": 2, // require parenthesis around regex literals
+// 'one-var-declaration-per-line': [2, 'always'],
+ 'operator-assignment': 2,
+ 'operator-linebreak': [2, 'after'],
+// 'padded-blocks': [2, 'never'],
+// 'quote-props': [2, 'as-needed'],
+ 'quotes': [2, 'single'],
+ 'require-jsdoc': 2,
+ 'semi': [2, 'always'],
+ 'semi-spacing': 2,
+// 'sort-vars': 2,
+ 'space-before-blocks': 2,
+ 'space-before-function-paren': [2, 'never'],
+ 'space-in-parens': 2,
+ 'space-infix-ops': 2,
+ 'space-unary-ops': 2,
+ 'spaced-comment': 2,
+ 'unicode-bom': [2, 'never'],
+ 'wrap-regex': 2,
// es6
+ 'arrow-body-style': [2, 'as-needed'],
+ 'arrow-parens': 2,
+ 'arrow-spacing': 2,
+ 'constructor-super': 2,
+ 'generator-star-spacing': 2,
+ 'no-class-assign': 2,
+ 'no-confusing-arrow': [2, {'allowParens': true}],
+ 'no-const-assign': 2,
+ 'no-dupe-class-members': 2,
+ 'no-duplicate-imports': 2,
+ 'no-new-symbol': 2,
+ 'no-restricted-imports': 2,
+ 'no-this-before-super': 2,
+ 'no-useless-computed-key': 2,
+ 'no-useless-constructor': 2,
+ 'no-useless-rename': 2,
+// 'no-var': 2,
+// 'object-shorthand': 2,
+// 'prefer-arrow-callback': 2,
+ 'prefer-const': 2,
+// 'prefer-reflect': 2,
- "constructor-super": 2, // require super() calls in constructors
- "no-class-assign": 2, // disallow reassigning class members
- "no-const-assign": 2, // disallow reassigning const variables
- "no-dupe-class-members": 2, // disallow duplicate class members
- "no-this-before-super": 2, // disallow this/super before calling super() in constructors
- "prefer-const": 2 // require const declarations for variables that are never reassigned after declared
+ 'prefer-rest-params': 2,
+ 'prefer-spread': 2,
+
+// 'prefer-template': 2,
+ 'require-yield': 2,
+ 'rest-spread-spacing': 2,
+ 'sort-imports': 0,
+ 'template-curly-spacing': 2,
+ 'yield-star-spacing': 2
}
};
diff --git a/dev/App/Abstract.jsx b/dev/App/Abstract.jsx
index eceee4b8e..14f21d3c1 100644
--- a/dev/App/Abstract.jsx
+++ b/dev/App/Abstract.jsx
@@ -1,5 +1,8 @@
-import {window, _, $, key} from 'common';
+import window from 'window';
+import $ from '$';
+import _ from '_';
+import key from 'key';
import {
$win, $html, $doc,
diff --git a/dev/App/Admin.jsx b/dev/App/Admin.jsx
index 7e117ac7b..c28378dfd 100644
--- a/dev/App/Admin.jsx
+++ b/dev/App/Admin.jsx
@@ -1,5 +1,6 @@
-import {window, _} from 'common';
+import window from 'window';
+import _ from '_';
import ko from 'ko';
import progressJs from 'progressJs';
@@ -39,14 +40,12 @@ class AdminApp extends AbstractApp
DomainStore.domains.loading(false);
if (StorageResultType.Success === result && data && data.Result)
{
- DomainStore.domains(_.map(data.Result, ([enabled, alias], name) => {
- return {
- name: name,
- disabled: ko.observable(!enabled),
- alias: alias,
- deleteAccess: ko.observable(false)
- };
- }));
+ DomainStore.domains(_.map(data.Result, ([enabled, alias], name) => ({
+ name: name,
+ disabled: ko.observable(!enabled),
+ alias: alias,
+ deleteAccess: ko.observable(false)
+ })));
}
});
}
@@ -57,13 +56,11 @@ class AdminApp extends AbstractApp
PluginStore.plugins.loading(false);
if (StorageResultType.Success === result && data && data.Result)
{
- PluginStore.plugins(_.map(data.Result, (item) => {
- return {
- name: item.Name,
- disabled: ko.observable(!item.Enabled),
- configured: ko.observable(!!item.Configured)
- };
- }));
+ PluginStore.plugins(_.map(data.Result, (item) => ({
+ name: item.Name,
+ disabled: ko.observable(!item.Enabled),
+ configured: ko.observable(!!item.Configured)
+ })));
}
});
}
@@ -203,15 +200,15 @@ class AdminApp extends AbstractApp
}, force);
}
- bootend(callback = null) {
+ bootend(bootendCallback = null) {
if (progressJs)
{
progressJs.end();
}
- if (callback)
+ if (bootendCallback)
{
- callback();
+ bootendCallback();
}
}
diff --git a/dev/App/User.jsx b/dev/App/User.jsx
index 47e7388fa..c112aece2 100644
--- a/dev/App/User.jsx
+++ b/dev/App/User.jsx
@@ -1,10 +1,12 @@
-import {window, _, $} from 'common';
+import window from 'window';
+import _ from '_';
+import $ from '$';
import progressJs from 'progressJs';
import Tinycon from 'Tinycon';
import {
- noop, trim, log, isArray, inArray, isUnd, isNormal, isPosNumeric, isNonEmptyArray,
+ noop, trim, log, has, isArray, inArray, isUnd, isNormal, isPosNumeric, isNonEmptyArray,
pInt, pString, delegateRunOnDestroy, mailToHelper, windowResize
} from 'Common/Utils';
@@ -411,18 +413,17 @@ class AppUser extends AbstractApp
* @param {Function=} callback = null
*/
foldersReload(callback = null) {
-
- Promises.foldersReload(FolderStore.foldersLoading).then((value) => {
- if (callback)
- {
+ const prom = Promises.foldersReload(FolderStore.foldersLoading);
+ if (callback)
+ {
+ prom.then((value) => {
callback(!!value);
- }
- }).catch(() => {
- if (callback)
- {
- _.delay(() => callback(false), 1);
- }
- });
+ }).catch(() => {
+ _.delay(() => {
+ callback(false);
+ }, 1);
+ });
+ }
}
foldersPromisesActionHelper(promise, errorDefCode) {
@@ -481,7 +482,9 @@ class AppUser extends AbstractApp
iIndex,
oItem.primaryKey.getFingerprint(),
oItem.primaryKey.getKeyId().toHex().toLowerCase(),
- _.uniq(_.compact(_.map(oItem.getKeyIds(), (item) => item && item.toHex ? item.toHex() : null))),
+ _.uniq(_.compact(_.map(
+ oItem.getKeyIds(), (item) => (item && item.toHex ? item.toHex() : null)
+ ))),
aUsers,
aEmails,
oItem.isPrivate(),
@@ -672,7 +675,7 @@ class AppUser extends AbstractApp
{
for (uid in data.Result.Flags)
{
- if (data.Result.Flags.hasOwnProperty(uid))
+ if (has(data.Result.Flags, uid))
{
check = true;
const flags = data.Result.Flags[uid];
@@ -808,7 +811,7 @@ class AppUser extends AbstractApp
aMessages = MessageStore.messageListChecked();
}
- aRootUids = _.uniq(_.compact(_.map(aMessages, (oMessage) => (oMessage && oMessage.uid) ? oMessage.uid : null)));
+ aRootUids = _.uniq(_.compact(_.map(aMessages, (oMessage) => (oMessage && oMessage.uid ? oMessage.uid : null))));
if ('' !== sFolderFullNameRaw && 0 < aRootUids.length)
{
@@ -934,18 +937,17 @@ class AppUser extends AbstractApp
/**
* @param {string} query
- * @param {Function} callback
+ * @param {Function} autocompleteCallback
*/
- getAutocomplete(query, callback) {
+ getAutocomplete(query, autocompleteCallback) {
Remote.suggestions((result, data) => {
if (StorageResultType.Success === result && data && isArray(data.Result))
{
- callback(_.compact(_.map(data.Result,
- (item) => item && item[0] ? new EmailModel(item[0], item[1]) : null)));
+ autocompleteCallback(_.compact(_.map(data.Result, (item) => (item && item[0] ? new EmailModel(item[0], item[1]) : null))));
}
else if (StorageResultType.Abort !== result)
{
- callback([]);
+ autocompleteCallback([]);
}
}, query);
}
@@ -1407,7 +1409,7 @@ class AppUser extends AbstractApp
window.location.protocol + '//' + window.location.host + window.location.pathname + '?mailto&to=%s',
'' + (Settings.settingsGet('Title') || 'RainLoop'));
}
- catch (e) {/* eslint-disable-line no-empty */}
+ catch (e) {} // eslint-disable-line no-empty
if (Settings.settingsGet('MailToEmail'))
{
diff --git a/dev/Common/Audio.jsx b/dev/Common/Audio.jsx
index 31dde0f4b..e9b73cee4 100644
--- a/dev/Common/Audio.jsx
+++ b/dev/Common/Audio.jsx
@@ -1,5 +1,6 @@
-import {window, $} from 'common';
+import window from 'window';
+import $ from '$';
import {bMobileDevice, bSafari} from 'Common/Globals';
import * as Links from 'Common/Links';
import * as Events from 'Common/Events';
diff --git a/dev/Common/Booter.jsx b/dev/Common/Booter.jsx
index dfa5bef01..246a4fcb2 100644
--- a/dev/Common/Booter.jsx
+++ b/dev/Common/Booter.jsx
@@ -1,6 +1,7 @@
import window from 'window';
import progressJs from 'progressJs';
+import Promise from 'Promise';
import STYLES_CSS from 'Styles/@Boot.css';
import LAYOUT_HTML from 'Html/Layout.html';
@@ -32,7 +33,7 @@ function getComputedStyle(id, name)
*/
function includeStyle(styles)
{
- window.document.write(unescape('%3Csty' + 'le%3E' + styles + '"%3E%3C/' + 'sty' + 'le%3E'));
+ window.document.write(unescape('%3Csty' + 'le%3E' + styles + '"%3E%3C/' + 'sty' + 'le%3E')); // eslint-disable-line no-useless-concat
}
/**
@@ -41,7 +42,7 @@ function includeStyle(styles)
*/
function includeScr(src)
{
- window.document.write(unescape('%3Csc' + 'ript type="text/jav' + 'ascr' + 'ipt" data-cfasync="false" sr' + 'c="' + src + '"%3E%3C/' + 'scr' + 'ipt%3E'));
+ window.document.write(unescape('%3Csc' + 'ript type="text/jav' + 'ascr' + 'ipt" data-cfasync="false" sr' + 'c="' + src + '"%3E%3C/' + 'scr' + 'ipt%3E')); // eslint-disable-line no-useless-concat
}
/**
@@ -203,27 +204,30 @@ function runApp()
}
}
}),
- common = window.Promise.all([
+ common = Promise.all([
window.jassl(appData.TemplatesLink),
window.jassl(appData.LangLink)
]);
- window.Promise.all([libs, common])
+ Promise.all([libs, common])
.then(() => {
p.set(30);
return window.jassl(appData.StaticAppJsLink);
- }).then(() => {
+ })
+ .then(() => {
p.set(50);
return appData.PluginsLink ? window.jassl(appData.PluginsLink) : window.Promise.resolve();
- }).then(() => {
+ })
+ .then(() => {
p.set(70);
runMainBoot(false);
- }).catch((e) => {
+ })
+ .catch((e) => {
runMainBoot(true);
throw e;
- }).then(() => {
- return window.jassl(appData.StaticEditorJsLink);
- }).then(() => {
+ })
+ .then(() => window.jassl(appData.StaticEditorJsLink))
+ .then(() => {
if (window.CKEDITOR && window.__initEditor) {
window.__initEditor();
window.__initEditor = null;
diff --git a/dev/Common/Cache.jsx b/dev/Common/Cache.jsx
index 5f2fa34fc..763ae3186 100644
--- a/dev/Common/Cache.jsx
+++ b/dev/Common/Cache.jsx
@@ -1,5 +1,5 @@
-import {_} from 'common';
+import _ from '_';
import {Capa, MessageSetAction} from 'Common/Enums';
import {trim, pInt, isArray} from 'Common/Utils';
import * as Links from 'Common/Links';
diff --git a/dev/Common/ClientStorageDriver/Cookie.jsx b/dev/Common/ClientStorageDriver/Cookie.jsx
index 7cbbde645..b7e097ba4 100644
--- a/dev/Common/ClientStorageDriver/Cookie.jsx
+++ b/dev/Common/ClientStorageDriver/Cookie.jsx
@@ -1,5 +1,7 @@
-import {window, JSON, $} from 'common';
+import window from 'window';
+import $ from '$';
+import JSON from 'JSON';
import {isUnd} from 'Common/Utils';
import {CLIENT_SIDE_STORAGE_INDEX_NAME} from 'Common/Consts';
@@ -21,7 +23,7 @@ class CookieDriver
const storageValue = $.cookie(CLIENT_SIDE_STORAGE_INDEX_NAME);
storageResult = null === storageValue ? null : JSON.parse(storageValue);
}
- catch (e) {/* eslint-disable-line no-empty */}
+ catch (e) {} // eslint-disable-line no-empty
(storageResult || (storageResult = {}))[key] = data;
@@ -33,7 +35,7 @@ class CookieDriver
result = true;
}
- catch (e) {/* eslint-disable-line no-empty */}
+ catch (e) {} // eslint-disable-line no-empty
return result;
}
@@ -54,7 +56,7 @@ class CookieDriver
result = (storageResult && !isUnd(storageResult[key])) ? storageResult[key] : null;
}
- catch (e) {/* eslint-disable-line no-empty */}
+ catch (e) {} // eslint-disable-line no-empty
return result;
}
diff --git a/dev/Common/ClientStorageDriver/LocalStorage.jsx b/dev/Common/ClientStorageDriver/LocalStorage.jsx
index 714719dc9..b99431971 100644
--- a/dev/Common/ClientStorageDriver/LocalStorage.jsx
+++ b/dev/Common/ClientStorageDriver/LocalStorage.jsx
@@ -1,5 +1,6 @@
-import {window, JSON} from 'common';
+import window from 'window';
+import JSON from 'JSON';
import {isUnd} from 'Common/Utils';
import {CLIENT_SIDE_STORAGE_INDEX_NAME} from 'Common/Consts';
@@ -21,7 +22,7 @@ class LocalStorageDriver
const storageValue = window.localStorage[CLIENT_SIDE_STORAGE_INDEX_NAME] || null;
storageResult = null === storageValue ? null : JSON.parse(storageValue);
}
- catch (e) {/* eslint-disable-line no-empty */}
+ catch (e) {} // eslint-disable-line no-empty
(storageResult || (storageResult = {}))[key] = data;
@@ -30,7 +31,7 @@ class LocalStorageDriver
window.localStorage[CLIENT_SIDE_STORAGE_INDEX_NAME] = JSON.stringify(storageResult);
result = true;
}
- catch (e) {/* eslint-disable-line no-empty */}
+ catch (e) {} // eslint-disable-line no-empty
return result;
}
@@ -51,7 +52,7 @@ class LocalStorageDriver
result = (storageResult && !isUnd(storageResult[key])) ? storageResult[key] : null;
}
- catch (e) {/* eslint-disable-line no-empty */}
+ catch (e) {} // eslint-disable-line no-empty
return result;
}
diff --git a/dev/Common/Events.jsx b/dev/Common/Events.jsx
index 3ce55f349..749745e08 100644
--- a/dev/Common/Events.jsx
+++ b/dev/Common/Events.jsx
@@ -1,5 +1,5 @@
-import {_} from 'common';
+import _ from '_';
import {isObject, isUnd} from 'Common/Utils';
import * as Plugins from 'Common/Plugins';
diff --git a/dev/Common/Globals.jsx b/dev/Common/Globals.jsx
index fe714c6e8..98e221fb3 100644
--- a/dev/Common/Globals.jsx
+++ b/dev/Common/Globals.jsx
@@ -1,6 +1,9 @@
/* global RL_COMMUNITY */
-import {window, _, $, key} from 'common';
+import window from 'window';
+import _ from '_';
+import $ from '$';
+import key from 'key';
import ko from 'ko';
import {KeyState} from 'Common/Enums';
@@ -182,9 +185,7 @@ export const leftPanelWidth = ko.observable(0);
// popups
export const popupVisibilityNames = ko.observableArray([]);
-export const popupVisibility = ko.computed(() => {
- return 0 < popupVisibilityNames().length;
-});
+export const popupVisibility = ko.computed(() => 0 < popupVisibilityNames().length);
popupVisibility.subscribe((bValue) => {
$html.toggleClass('rl-modal', bValue);
@@ -196,9 +197,7 @@ export const keyScopeFake = ko.observable(KeyState.All);
export const keyScope = ko.computed({
owner: this,
- read: () => {
- return keyScopeFake();
- },
+ read: () => keyScopeFake(),
write: function(sValue) {
if (KeyState.Menu !== sValue)
diff --git a/dev/Common/HtmlEditor.jsx b/dev/Common/HtmlEditor.jsx
index 26770d95c..3165c9a81 100644
--- a/dev/Common/HtmlEditor.jsx
+++ b/dev/Common/HtmlEditor.jsx
@@ -1,5 +1,7 @@
-import {window, _, $} from 'common';
+import window from 'window';
+import _ from '_';
+import $ from '$';
import {oHtmlEditorDefaultConfig, oHtmlEditorLangsMap} from 'Common/Globals';
import * as Settings from 'Storage/Settings';
@@ -115,7 +117,7 @@ class HtmlEditor
this.editor.getData() + '' : this.editor.getData();
}
}
- catch (e) {/* eslint-disable-line no-empty */}
+ catch (e) {} // eslint-disable-line no-empty
if (clearSignatureSigns)
{
@@ -154,7 +156,7 @@ class HtmlEditor
}
}
}
- catch (e) {/* eslint-disable-line no-empty */}
+ catch (e) {} // eslint-disable-line no-empty
if (resize)
{
@@ -184,7 +186,7 @@ class HtmlEditor
try {
this.editor.setData(html);
}
- catch (e) {/* eslint-disable-line no-empty */}
+ catch (e) {} // eslint-disable-line no-empty
if (focus)
{
@@ -200,7 +202,7 @@ class HtmlEditor
this.editor.setData(
this.editor.getData().replace(find, replaceHtml));
}
- catch (e) {/* eslint-disable-line no-empty */}
+ catch (e) {} // eslint-disable-line no-empty
}
}
@@ -217,7 +219,7 @@ class HtmlEditor
try {
this.editor.setData(plain);
}
- catch (e) {/* eslint-disable-line no-empty */}
+ catch (e) {} // eslint-disable-line no-empty
}
if (focus)
@@ -358,7 +360,7 @@ class HtmlEditor
try {
this.editor.focus();
}
- catch (e) {/* eslint-disable-line no-empty */}
+ catch (e) {} // eslint-disable-line no-empty
}
}
@@ -368,7 +370,7 @@ class HtmlEditor
try {
return !!this.editor.focusManager.hasFocus;
}
- catch (e) {/* eslint-disable-line no-empty */}
+ catch (e) {} // eslint-disable-line no-empty
}
return false;
@@ -380,7 +382,7 @@ class HtmlEditor
try {
this.editor.focusManager.blur(true);
}
- catch (e) {/* eslint-disable-line no-empty */}
+ catch (e) {} // eslint-disable-line no-empty
}
}
@@ -390,7 +392,7 @@ class HtmlEditor
try {
this.editor.resize(this.$element.width(), this.$element.innerHeight());
}
- catch (e) {/* eslint-disable-line no-empty */}
+ catch (e) {} // eslint-disable-line no-empty
}
}
@@ -400,7 +402,7 @@ class HtmlEditor
try {
this.editor.setReadOnly(!!value);
}
- catch (e) {/* eslint-disable-line no-empty */}
+ catch (e) {} // eslint-disable-line no-empty
}
}
diff --git a/dev/Common/Links.jsx b/dev/Common/Links.jsx
index 71dd8ef9e..e0a639bf3 100644
--- a/dev/Common/Links.jsx
+++ b/dev/Common/Links.jsx
@@ -1,5 +1,5 @@
-import {window} from 'common';
+import window from 'window';
import {pString, pInt, isUnd, isNormal, trim, encodeURIComponent} from 'Common/Utils';
import * as Settings from 'Storage/Settings';
diff --git a/dev/Common/Momentor.jsx b/dev/Common/Momentor.jsx
index 3e34df243..33665b3ff 100644
--- a/dev/Common/Momentor.jsx
+++ b/dev/Common/Momentor.jsx
@@ -1,5 +1,8 @@
-import {window, $, _, moment} from 'common';
+import window from 'window';
+import _ from '_';
+import $ from '$';
+import moment from 'moment';
import {i18n} from 'Common/Translator';
let _moment = null;
diff --git a/dev/Common/Plugins.jsx b/dev/Common/Plugins.jsx
index 7750d3015..89f202220 100644
--- a/dev/Common/Plugins.jsx
+++ b/dev/Common/Plugins.jsx
@@ -1,12 +1,13 @@
-import {_} from 'common';
+import _ from '_';
import {isFunc, isArray, isUnd} from 'Common/Utils';
import {data as GlobalsData} from 'Common/Globals';
import * as Settings from 'Storage/Settings';
-const SIMPLE_HOOKS = {};
-const USER_VIEW_MODELS_HOOKS = [];
-const ADMIN_VIEW_MODELS_HOOKS = [];
+const
+ SIMPLE_HOOKS = {},
+ USER_VIEW_MODELS_HOOKS = [],
+ ADMIN_VIEW_MODELS_HOOKS = [];
/**
* @param {string} name
@@ -34,7 +35,7 @@ export function runHook(name, args = [])
if (isArray(SIMPLE_HOOKS[name]))
{
_.each(SIMPLE_HOOKS[name], (callback) => {
- callback.apply(null, args);
+ callback(...args);
});
}
}
diff --git a/dev/Common/Selector.jsx b/dev/Common/Selector.jsx
index ab33151c8..33baa8cd9 100644
--- a/dev/Common/Selector.jsx
+++ b/dev/Common/Selector.jsx
@@ -1,5 +1,7 @@
-import {$, _, key} from 'common';
+import $ from '$';
+import _ from '_';
+import key from 'key';
import ko from 'ko';
import {EventKeyCode} from 'Common/Enums';
import {isArray, inArray, noop, noopTrue} from 'Common/Utils';
@@ -21,10 +23,7 @@ class Selector
{
this.list = koList;
- this.listChecked = ko.computed(() => {
- return _.filter(this.list(), (item) => item.checked());
- }, this).extend({rateLimit: 0});
-
+ this.listChecked = ko.computed(() => _.filter(this.list(), (item) => item.checked())).extend({rateLimit: 0});
this.isListChecked = ko.computed(() => 0 < this.listChecked().length);
this.focusedItem = koFocusedItem || ko.observable(null);
diff --git a/dev/Common/Translator.jsx b/dev/Common/Translator.jsx
index 564855e26..03c0124d1 100644
--- a/dev/Common/Translator.jsx
+++ b/dev/Common/Translator.jsx
@@ -1,5 +1,7 @@
-import {window, $, _} from 'common';
+import window from 'window';
+import _ from '_';
+import $ from '$';
import ko from 'ko';
import {Notification, UploadErrorCode} from 'Common/Enums';
import {pInt, isUnd, isNull, has, microtime, inArray} from 'Common/Utils';
diff --git a/dev/Common/Utils.jsx b/dev/Common/Utils.jsx
index cdb344692..563dd09ec 100644
--- a/dev/Common/Utils.jsx
+++ b/dev/Common/Utils.jsx
@@ -19,21 +19,21 @@ const isUnd = _.isUndefined;
const isNull = _.isNull;
const has = _.has;
const bind = _.bind;
-const noop = () => {};
+const noop = () => {}; // eslint-disable-line no-empty-function
const noopTrue = () => true;
const noopFalse = () => false;
export {trim, inArray, isArray, isObject, isFunc, isUnd, isNull, has, bind, noop, noopTrue, noopFalse};
/**
- * @param {Function} callback
+ * @param {Function} func
*/
-export function silentTryCatch(callback)
+export function silentTryCatch(func)
{
try {
- callback();
+ func();
}
- catch (e) {/* eslint-disable-line no-empty */}
+ catch (e) {} // eslint-disable-line no-empty
}
/**
@@ -314,7 +314,7 @@ export function removeInFocus(force)
window.document.activeElement.blur();
}
}
- catch (e) {/* eslint-disable-line no-empty */}
+ catch (e) {} // eslint-disable-line no-empty
}
}
@@ -337,7 +337,7 @@ export function removeSelection()
window.document.selection.empty();
}
}
- catch (e) {/* eslint-disable-line no-empty */}
+ catch (e) {} // eslint-disable-line no-empty
}
/**
@@ -453,14 +453,16 @@ export function delegateRun(object, methodName, params, delay = 0)
if (object && object[methodName])
{
delay = pInt(delay);
+ params = isArray(params) ? params : [];
+
if (0 >= delay)
{
- object[methodName].apply(object, isArray(params) ? params : []);
+ object[methodName](...params);
}
else
{
_.delay(() => {
- object[methodName].apply(object, isArray(params) ? params : []);
+ object[methodName](...params);
}, delay);
}
}
@@ -511,7 +513,6 @@ export function kill_CtrlA_CtrlS(event)
*/
export function createCommand(context, fExecute, fCanExecute = true)
{
-
let fResult = null;
const fNonEmpty = (...args) => {
if (fResult && fResult.canExecute && fResult.canExecute())
@@ -526,15 +527,11 @@ export function createCommand(context, fExecute, fCanExecute = true)
if (isFunc(fCanExecute))
{
- fResult.canExecute = ko.computed(() => {
- return fResult.enabled() && fCanExecute.call(context);
- });
+ fResult.canExecute = ko.computed(() => fResult.enabled() && fCanExecute.call(context));
}
else
{
- fResult.canExecute = ko.computed(() => {
- return fResult.enabled() && !!fCanExecute;
- });
+ fResult.canExecute = ko.computed(() => fResult.enabled() && !!fCanExecute);
}
return fResult;
@@ -848,14 +845,11 @@ export function htmlToPlain(html)
text = '';
const
-
convertBlockquote = (blockquoteText) => {
blockquoteText = '> ' + trim(blockquoteText).replace(/\n/gm, '\n> ');
- return blockquoteText.replace(/(^|\n)([> ]+)/gm, (...args) => {
- return (args && 2 < args.length) ? args[1] + trim(args[2].replace(/[\s]/g, '')) + ' ' : '';
- });
+ return blockquoteText.replace(/(^|\n)([> ]+)/gm,
+ (...args) => (args && 2 < args.length ? args[1] + trim(args[2].replace(/[\s]/g, '')) + ' ' : ''));
},
-
convertDivs = (...args) => {
if (args && 1 < args.length)
{
@@ -871,19 +865,9 @@ export function htmlToPlain(html)
return '';
},
-
- convertPre = (...args) => {
- return (args && 1 < args.length) ?
- args[1].toString().replace(/[\n]/gm, '
').replace(/[\r]/gm, '') : '';
- },
-
- fixAttibuteValue = (...args) => {
- return (args && 1 < args.length) ? '' + args[1] + _.escape(args[2]) : '';
- },
-
- convertLinks = (...args) => {
- return (args && 1 < args.length) ? trim(args[1]) : '';
- };
+ convertPre = (...args) => (args && 1 < args.length ? args[1].toString().replace(/[\n]/gm, '
').replace(/[\r]/gm, '') : ''),
+ fixAttibuteValue = (...args) => (args && 1 < args.length ? '' + args[1] + _.escape(args[2]) : ''),
+ convertLinks = (...args) => (args && 1 < args.length ? trim(args[1]) : '');
text = html
.replace(/\u0002([\s\S]*)\u0002/gm, '\u200C$1\u200C')
@@ -971,10 +955,7 @@ export function htmlToPlain(html)
export function plainToHtml(plain, findEmailAndLinksInText = false)
{
plain = plain.toString().replace(/\r/g, '');
-
- plain = plain.replace(/^>[> ]>+/gm, ([match]) => {
- return match ? match.replace(/[ ]+/g, '') : match;
- });
+ plain = plain.replace(/^>[> ]>+/gm, ([match]) => (match ? match.replace(/[ ]+/g, '') : match));
let
bIn = false,
@@ -1110,7 +1091,7 @@ export function folderListOptionsBuilder(aSystem, aList, aDisabled, aHeaderLines
for (iIndex = 0, iLen = aSystem.length; iIndex < iLen; iIndex++)
{
oItem = aSystem[iIndex];
- if (fVisibleCallback ? fVisibleCallback.call(null, oItem) : true)
+ if (fVisibleCallback ? fVisibleCallback(oItem) : true)
{
if (bSep && 0 < aResult.length)
{
@@ -1126,11 +1107,11 @@ export function folderListOptionsBuilder(aSystem, aList, aDisabled, aHeaderLines
bSep = false;
aResult.push({
id: oItem.fullNameRaw,
- name: fRenameCallback ? fRenameCallback.call(null, oItem) : oItem.name(),
+ name: fRenameCallback ? fRenameCallback(oItem) : oItem.name(),
system: true,
seporator: false,
disabled: !oItem.selectable || -1 < inArray(oItem.fullNameRaw, aDisabled) ||
- (fDisableCallback ? fDisableCallback.call(null, oItem) : false)
+ (fDisableCallback ? fDisableCallback(oItem) : false)
});
}
}
@@ -1142,7 +1123,7 @@ export function folderListOptionsBuilder(aSystem, aList, aDisabled, aHeaderLines
// if (oItem.subScribed() || !oItem.existen || bBuildUnvisible)
if ((oItem.subScribed() || !oItem.existen || bBuildUnvisible) && (oItem.selectable || oItem.hasSubScribedSubfolders()))
{
- if (fVisibleCallback ? fVisibleCallback.call(null, oItem) : true)
+ if (fVisibleCallback ? fVisibleCallback(oItem) : true)
{
if (FolderType.User === oItem.type() || !bSystem || oItem.hasSubScribedSubfolders())
{
@@ -1161,11 +1142,11 @@ export function folderListOptionsBuilder(aSystem, aList, aDisabled, aHeaderLines
aResult.push({
id: oItem.fullNameRaw,
name: (new window.Array(oItem.deep + 1 - iUnDeep)).join(sDeepPrefix) +
- (fRenameCallback ? fRenameCallback.call(null, oItem) : oItem.name()),
+ (fRenameCallback ? fRenameCallback(oItem) : oItem.name()),
system: false,
seporator: false,
disabled: !oItem.selectable || -1 < inArray(oItem.fullNameRaw, aDisabled) ||
- (fDisableCallback ? fDisableCallback.call(null, oItem) : false)
+ (fDisableCallback ? fDisableCallback(oItem) : false)
});
}
}
@@ -1187,7 +1168,7 @@ export function folderListOptionsBuilder(aSystem, aList, aDisabled, aHeaderLines
*/
export function selectElement(element)
{
- let sel, range;
+ let sel = null, range = null;
if (window.getSelection)
{
sel = window.getSelection();
@@ -1205,9 +1186,7 @@ export function selectElement(element)
}
export const detectDropdownVisibility = _.debounce(() => {
- dropdownVisibility(!!_.find(GlobalsData.aBootstrapDropdowns, (item) => {
- return item.hasClass('open');
- }));
+ dropdownVisibility(!!_.find(GlobalsData.aBootstrapDropdowns, (item) => item.hasClass('open')));
}, 50);
/**
@@ -1246,7 +1225,7 @@ export function getConfigurationFromScriptTag(configuration)
{
return JSON.parse(configurationScriptTagCache[configuration].text());
}
- catch (e) {/* eslint-disable-line no-empty */}
+ catch (e) {} // eslint-disable-line no-empty
return {};
}
@@ -1615,13 +1594,12 @@ export function mailToHelper(mailToUrl, PopupComposeVoreModel)
email = mailToUrl.replace(/\?.+$/, ''),
query = mailToUrl.replace(/^[^\?]*\?/, ''),
EmailModel = require('Model/Email'),
- fParseEmailLine = (line) => {
- return line ? _.compact(_.map(decodeURIComponent(line).split(/[,]/), (item) => {
- const emailObj = new EmailModel();
- emailObj.mailsoParse(item);
- return '' !== emailObj.email ? emailObj : null;
- })) : null;
- };
+ emailObj = new EmailModel(),
+ fParseEmailLine = (line) => (line ? _.compact(_.map(decodeURIComponent(line).split(/[,]/), (item) => {
+ emailObj.clear();
+ emailObj.mailsoParse(item);
+ return '' !== emailObj.email ? emailObj : null;
+ })) : null);
to = fParseEmailLine(email);
params = simpleQueryParser(query);
diff --git a/dev/Component/AbstracRadio.jsx b/dev/Component/AbstracRadio.jsx
index c2e69b529..49be11e24 100644
--- a/dev/Component/AbstracRadio.jsx
+++ b/dev/Component/AbstracRadio.jsx
@@ -1,5 +1,5 @@
-import {_} from 'common';
+import _ from '_';
import ko from 'ko';
import {isUnd} from 'Common/Utils';
import {AbstractComponent} from 'Component/Abstract';
@@ -27,9 +27,7 @@ class AbstracRadio extends AbstractComponent
if (params.values)
{
- this.values(_.map(params.values, (label, value) => {
- return {label: label, value: value};
- }));
+ this.values(_.map(params.values, (label, value) => ({label: label, value: value})));
}
this.click = _.bind(this.click, this);
diff --git a/dev/Component/Abstract.jsx b/dev/Component/Abstract.jsx
index 3690313af..ae8fd6e97 100644
--- a/dev/Component/Abstract.jsx
+++ b/dev/Component/Abstract.jsx
@@ -1,7 +1,7 @@
-import {$} from 'common';
-import {isUnd} from 'Common/Utils';
+import $ from '$';
import ko from 'ko';
+import {isUnd} from 'Common/Utils';
class AbstractComponent
{
@@ -24,32 +24,30 @@ class AbstractComponent
* @param {string} templateID = ''
* @returns {Object}
*/
-const componentExportHelper = (ClassObject, templateID = '') => {
- return {
- template: templateID ? {element: templateID} : '',
- viewModel: {
- createViewModel: (params, componentInfo) => {
+const componentExportHelper = (ClassObject, templateID = '') => ({
+ template: templateID ? {element: templateID} : '',
+ viewModel: {
+ createViewModel: (params, componentInfo) => {
- params = params || {};
- params.element = null;
+ params = params || {};
+ params.element = null;
- if (componentInfo && componentInfo.element)
+ if (componentInfo && componentInfo.element)
+ {
+ params.component = componentInfo;
+ params.element = $(componentInfo.element);
+
+ require('Common/Translator').i18nToNodes(params.element);
+
+ if (!isUnd(params.inline) && ko.unwrap(params.inline))
{
- params.component = componentInfo;
- params.element = $(componentInfo.element);
-
- require('Common/Translator').i18nToNodes(params.element);
-
- if (!isUnd(params.inline) && ko.unwrap(params.inline))
- {
- params.element.css('display', 'inline-block');
- }
+ params.element.css('display', 'inline-block');
}
-
- return new ClassObject(params);
}
+
+ return new ClassObject(params);
}
- };
-};
+ }
+});
export {AbstractComponent, componentExportHelper};
diff --git a/dev/Component/MaterialDesign/Checkbox.jsx b/dev/Component/MaterialDesign/Checkbox.jsx
index 0c15ddbe8..e975a04e2 100644
--- a/dev/Component/MaterialDesign/Checkbox.jsx
+++ b/dev/Component/MaterialDesign/Checkbox.jsx
@@ -1,5 +1,5 @@
-import {_} from 'common';
+import _ from '_';
import ko from 'ko';
import {componentExportHelper} from 'Component/Abstract';
import {AbstracCheckbox} from 'Component/AbstracCheckbox';
diff --git a/dev/Component/Script.jsx b/dev/Component/Script.jsx
index da673c90c..d70e2d28b 100644
--- a/dev/Component/Script.jsx
+++ b/dev/Component/Script.jsx
@@ -1,5 +1,5 @@
-import {$} from 'common';
+import $ from '$';
import {AbstractComponent, componentExportHelper} from 'Component/Abstract';
class ScriptComponent extends AbstractComponent
diff --git a/dev/Component/SvgIcon.jsx b/dev/Component/SvgIcon.jsx
index 3646f5c81..104e1967f 100644
--- a/dev/Component/SvgIcon.jsx
+++ b/dev/Component/SvgIcon.jsx
@@ -1,5 +1,5 @@
-import {$} from 'common';
+import $ from '$';
let cachedUrl = null;
const getUrl = () => {
diff --git a/dev/External/ko.js b/dev/External/ko.js
index 232b7d4c9..75fa3a634 100644
--- a/dev/External/ko.js
+++ b/dev/External/ko.js
@@ -120,7 +120,8 @@ ko.bindingHandlers.scrollerShadows = {
ko.bindingHandlers.pikaday = {
init: function(oElement, fValueAccessor, fAllBindingsAccessor, oViewModel) {
- ko.bindingHandlers.textInput.init.apply(oViewModel, Array.prototype.slice.call(arguments));
+ ko.bindingHandlers.textInput
+ .init.apply(oViewModel, Array.prototype.slice.call(arguments)); // eslint-disable-line prefer-rest-params
if (Pikaday)
{
@@ -971,7 +972,7 @@ ko.bindingHandlers.command = {
jqElement.addClass('command');
ko.bindingHandlers[jqElement.is('form') ? 'submit' : 'click']
- .init.apply(oViewModel, Array.prototype.slice.call(arguments));
+ .init.apply(oViewModel, Array.prototype.slice.call(arguments)); // eslint-disable-line prefer-rest-params
},
update: function(oElement, fValueAccessor) {
diff --git a/dev/Helper/Message.jsx b/dev/Helper/Message.jsx
index 73ee2e480..64177146b 100644
--- a/dev/Helper/Message.jsx
+++ b/dev/Helper/Message.jsx
@@ -4,11 +4,6 @@ import EmailModel from 'Model/Email';
class MessageHelper
{
- /**
- * @constructor
- */
- constructor() {}
-
/**
* @param {Array.} emails
* @param {boolean=} friendlyView = false
diff --git a/dev/Knoin/AbstractView.js b/dev/Knoin/AbstractView.js
index 781e23148..d6511ba1e 100644
--- a/dev/Knoin/AbstractView.js
+++ b/dev/Knoin/AbstractView.js
@@ -84,8 +84,8 @@ AbstractView.prototype.viewModelPosition = function()
return this.sPosition;
};
-AbstractView.prototype.cancelCommand = function() {};
-AbstractView.prototype.closeCommand = function() {};
+AbstractView.prototype.cancelCommand = Utils.noop;
+AbstractView.prototype.closeCommand = Utils.noop;
AbstractView.prototype.storeAndSetKeyScope = function()
{
diff --git a/dev/Knoin/Knoin.js b/dev/Knoin/Knoin.js
index 08336cdac..a8b639bc3 100644
--- a/dev/Knoin/Knoin.js
+++ b/dev/Knoin/Knoin.js
@@ -37,7 +37,7 @@ Knoin.prototype.constructorEnd = function(context)
{
if (Utils.isFunc(context.__constructor_end))
{
- context.__constructor_end.call(context);
+ context.__constructor_end();
}
};
diff --git a/dev/Model/Email.js b/dev/Model/Email.js
index f5943ff75..cdf58c701 100644
--- a/dev/Model/Email.js
+++ b/dev/Model/Email.js
@@ -250,10 +250,11 @@ EmailModel.prototype.mailsoParse = function($sEmailAddress)
var
substr = function(str, start, len) {
- str += '';
+ str = Utils.pString(str);
var end = str.length;
- if (0 > start) {
+ if (0 > start)
+ {
start += end;
}
@@ -263,11 +264,15 @@ EmailModel.prototype.mailsoParse = function($sEmailAddress)
},
substrReplace = function(str, replace, start, length) {
- if (0 > start) {
+ str = Utils.pString(str);
+ if (0 > start)
+ {
start += str.length;
}
- length = 'undefined' === typeof length ? length : str.length;
- if (0 > length) {
+
+ length = 'undefined' !== typeof length ? length : str.length;
+ if (0 > length)
+ {
length = length + str.length - start;
}
return str.slice(0, start) + replace.substr(0, length) + replace.slice(length) + str.slice(start + length);
diff --git a/dev/Storage/Client.jsx b/dev/Storage/Client.jsx
index 49634e784..47d629630 100644
--- a/dev/Storage/Client.jsx
+++ b/dev/Storage/Client.jsx
@@ -1,5 +1,5 @@
-import {_} from 'common';
+import _ from '_';
import {CookieDriver} from 'Common/ClientStorageDriver/Cookie';
import {LocalStorageDriver} from 'Common/ClientStorageDriver/LocalStorage';
diff --git a/dev/Storage/Settings.jsx b/dev/Storage/Settings.jsx
index 5b048b23f..b80b315dc 100644
--- a/dev/Storage/Settings.jsx
+++ b/dev/Storage/Settings.jsx
@@ -1,5 +1,5 @@
-import {window} from 'common';
+import window from 'window';
import {isUnd, isNormal, isArray, inArray} from 'Common/Utils';
let SETTINGS = window.__rlah_data() || null;
diff --git a/dev/Stores/User/Identity.jsx b/dev/Stores/User/Identity.jsx
index a966f3471..b0d6cf4de 100644
--- a/dev/Stores/User/Identity.jsx
+++ b/dev/Stores/User/Identity.jsx
@@ -1,5 +1,5 @@
-import {_} from 'common';
+import _ from '_';
import ko from 'ko';
class IdentityUserStore
@@ -9,9 +9,7 @@ class IdentityUserStore
this.identities = ko.observableArray([]);
this.identities.loading = ko.observable(false).extend({throttle: 100});
- this.identitiesIDS = ko.computed(() => {
- return _.compact(_.map(this.identities(), (item) => item ? item.id : null));
- }, this);
+ this.identitiesIDS = ko.computed(() => _.compact(_.map(this.identities(), (item) => (item ? item.id : null))));
}
}
diff --git a/dev/View/Popup/Compose.js b/dev/View/Popup/Compose.js
index d44e615b2..41ef6bf99 100644
--- a/dev/View/Popup/Compose.js
+++ b/dev/View/Popup/Compose.js
@@ -916,7 +916,7 @@ ComposePopupView.prototype.converSignature = function(sSignature)
sSignature = sSignature.replace(/{{MOMENT:[^}]+}}/g, '');
}
- catch (e) {/* eslint-disable-line no-empty */}
+ catch (e) {} // eslint-disable-line no-empty
}
return sSignature;
@@ -1324,7 +1324,7 @@ ComposePopupView.prototype.onMessageUploadAttachments = function(sResult, oData)
{
for (sTempName in oData.Result)
{
- if (oData.Result.hasOwnProperty(sTempName))
+ if (Utils.has(oData.Result, oData.Result))
{
oAttachment = this.getAttachmentById(oData.Result[sTempName]);
if (oAttachment)
diff --git a/dev/View/User/MailBox/MessageView.js b/dev/View/User/MailBox/MessageView.js
index b91de145b..8146040af 100644
--- a/dev/View/User/MailBox/MessageView.js
+++ b/dev/View/User/MailBox/MessageView.js
@@ -695,8 +695,9 @@ MessageViewMailBoxUserView.prototype.onBuild = function(oDom)
oDom
.on('click', 'a', function(oEvent) {
// setup maito protocol
- return !(!!oEvent && 3 !== oEvent.which && Utils.mailToHelper($(this).attr('href'),
- Settings.capa(Enums.Capa.Composer) ? require('View/Popup/Compose') : null));
+ return !(!!oEvent && 3 !== oEvent.which && Utils.mailToHelper(
+ $(this).attr('href'), Settings.capa(Enums.Capa.Composer) ? require('View/Popup/Compose') : null
+ ));
})
// .on('mouseover', 'a', _.debounce(function(oEvent) {
//
diff --git a/dev/View/User/Settings/Menu.js b/dev/View/User/Settings/Menu.js
index c5dbfd238..6b437f2ab 100644
--- a/dev/View/User/Settings/Menu.js
+++ b/dev/View/User/Settings/Menu.js
@@ -35,11 +35,6 @@ _.extend(MenuSettingsUserView.prototype, AbstractView.prototype);
MenuSettingsUserView.prototype.onBuild = function(oDom)
{
-// var self = this;
-// key('esc', Enums.KeyState.Settings, function() {
-// self.backToMailBoxClick();
-// });
-
if (this.mobile)
{
oDom
@@ -75,7 +70,7 @@ MenuSettingsUserView.prototype.onBuild = function(oDom)
}
}
- }, 200));
+ }, 200)); // eslint-disable-line no-magic-numbers
};
MenuSettingsUserView.prototype.link = function(sRoute)
diff --git a/dev/common.jsx b/dev/common.jsx
deleted file mode 100644
index 9cb888c82..000000000
--- a/dev/common.jsx
+++ /dev/null
@@ -1,10 +0,0 @@
-
-import window from 'window';
-import $ from '$';
-import JSON from 'JSON';
-import _ from '_';
-import Promise from 'Promise';
-import moment from 'moment';
-import key from 'key';
-
-export {window, $, JSON, _, Promise, moment, key};
diff --git a/gulpfile.js b/gulpfile.js
index 00986479c..966eda3fd 100644
--- a/gulpfile.js
+++ b/gulpfile.js
@@ -45,6 +45,8 @@ var
gulpif = require('gulp-if'),
eol = require('gulp-eol'),
livereload = require('gulp-livereload'),
+ eslint = require('gulp-eslint'),
+ cache = require('gulp-cached'),
gutil = require('gulp-util')
;
@@ -414,9 +416,10 @@ gulp.task('js:min', ['js:app', 'js:admin', 'js:validate'], function() {
// lint
gulp.task('js:eslint', function() {
- var eslint = require('gulp-eslint');
return gulp.src(cfg.paths.globjsall)
+ .pipe(cache('eslint'))
.pipe(eslint())
+ .pipe(gulpif(cfg.watch, plumber({errorHandler: notify.onError("Error: <%= error.message %>")})))
.pipe(eslint.format())
.pipe(eslint.failAfterError());
});
@@ -662,6 +665,7 @@ gulp.task('watch', ['fast'], function() {
cfg.watch = true;
livereload.listen();
gulp.watch(cfg.paths.globjs, {interval: cfg.watchInterval}, ['js:app', 'js:admin']);
+ gulp.watch(cfg.paths.globjsall, {interval: cfg.watchInterval}, ['js:validate']);
gulp.watch(cfg.paths.less.main.watch, {interval: cfg.watchInterval}, ['css:main']);
});
@@ -669,6 +673,7 @@ gulp.task('watch+', ['fast+'], function() {
cfg.watch = true;
livereload.listen();
gulp.watch(cfg.paths.globjs, {interval: cfg.watchInterval}, ['js:app', 'js:admin']);
+ gulp.watch(cfg.paths.globjsall, {interval: cfg.watchInterval}, ['js:validate']);
gulp.watch(cfg.paths.less.main.watch, {interval: cfg.watchInterval}, ['css:main']);
});
diff --git a/npm-shrinkwrap.json b/npm-shrinkwrap.json
index fee0c0172..949fd36a1 100644
--- a/npm-shrinkwrap.json
+++ b/npm-shrinkwrap.json
@@ -1472,6 +1472,28 @@
"from": "gulp-beautify@*",
"resolved": "https://registry.npmjs.org/gulp-beautify/-/gulp-beautify-2.0.0.tgz"
},
+ "gulp-cached": {
+ "version": "1.1.0",
+ "from": "gulp-cached@*",
+ "resolved": "https://registry.npmjs.org/gulp-cached/-/gulp-cached-1.1.0.tgz",
+ "dependencies": {
+ "readable-stream": {
+ "version": "1.0.34",
+ "from": "readable-stream@>=1.0.17 <1.1.0",
+ "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-1.0.34.tgz"
+ },
+ "through2": {
+ "version": "0.5.1",
+ "from": "through2@>=0.5.1 <0.6.0",
+ "resolved": "https://registry.npmjs.org/through2/-/through2-0.5.1.tgz"
+ },
+ "xtend": {
+ "version": "3.0.0",
+ "from": "xtend@>=3.0.0 <3.1.0",
+ "resolved": "https://registry.npmjs.org/xtend/-/xtend-3.0.0.tgz"
+ }
+ }
+ },
"gulp-clean-css": {
"version": "2.0.10",
"from": "gulp-clean-css@>=2.0.7 <3.0.0",
diff --git a/package.json b/package.json
index bec6cd7d1..591b03c36 100644
--- a/package.json
+++ b/package.json
@@ -2,7 +2,7 @@
"name": "RainLoop",
"title": "RainLoop Webmail",
"version": "1.10.2",
- "release": "136",
+ "release": "137",
"private": true,
"ownCloudPackageVersion": "4.19",
"description": "Simple, modern & fast web-based email client",
@@ -59,6 +59,7 @@
"gulp": "~3.9.0",
"gulp-autoprefixer": "*",
"gulp-beautify": "*",
+ "gulp-cached": "^1.1.0",
"gulp-clean-css": "^2.0.7",
"gulp-concat-util": "*",
"gulp-eol": "*",