From 450528ff00879e44f1de6f86716f60a2e1037806 Mon Sep 17 00:00:00 2001 From: RainLoop Team Date: Thu, 4 Jul 2019 22:09:27 +0300 Subject: [PATCH] Add prettier --- .eslintignore | 4 + .eslintrc.js | 315 ++---------------- .gitignore | 4 - .prettierignore | 4 + .prettierrc | 26 ++ Makefile | 8 +- ...AbstracCheckbox.js => AbstractCheckbox.js} | 23 +- .../{AbstracRadio.js => AbstractRadio.js} | 22 +- dev/Component/Checkbox.js | 4 +- dev/Component/Classic/Checkbox.js | 4 +- dev/Component/MaterialDesign/Checkbox.js | 4 +- dev/Component/Radio.js | 4 +- dev/Styles/Contacts.less | 9 +- dev/View/Popup/Contacts.js | 6 +- dev/polyfills.js | 10 - gulpfile.js | 16 +- package.json | 6 +- phpunit.xml | 8 - .../js/CustomAdminSettings.js | 5 + .../js/CustomUserSettings.js | 5 + plugins/google-analytics/js/include.js | 7 +- plugins/piwik-analytics/js/include.js | 5 + plugins/recaptcha/js/recaptcha.js | 2 +- .../0.0.0/app/libraries/RainLoop/Service.php | 2 +- .../templates/Views/User/MailMessageView.html | 2 +- .../templates/Views/User/PopupsContacts.html | 13 +- .../Views/User/PopupsFolderClear.html | 2 +- .../Views/User/SettingsSecurity.html | 2 +- tasks/assets.js | 6 +- tasks/common.js | 10 +- tasks/config.js | 21 +- tasks/css.js | 53 +-- tasks/js.js | 74 ++-- tasks/owncloud.js | 46 ++- tasks/rainloop.js | 49 ++- tasks/vendors.js | 36 +- tasks/webpack.js | 7 +- tests/MailSo/Base/HtmlUtilsTest.php | 23 -- tests/MailSo/Base/LinkFinderTest.php | 96 ------ tests/MailSo/Imap/ImapClientTest.php | 85 ----- tests/MailSo/Mime/EmailCollectionTest.php | 18 - tests/MailSo/Mime/EmailTest.php | 127 ------- tests/bootstrap.php | 6 - tests/data/html/1-ok.html | 1 - tests/data/html/1.html | 11 - tests/data/html/2-ok.html | 1 - tests/data/html/2.html | 12 - tests/data/mails/uid-01.eml | 232 ------------- tests/data/mails/uid-02.eml | 16 - tests/data/mails/uid-03.eml | 18 - tests/data/mails/uid-04.eml | 55 --- tests/data/mails/uid-05.eml | 55 --- tests/e2e/.cmds | 6 - tests/e2e/codecept.conf.js | 18 - tests/e2e/configuration.js.dist | 6 - tests/e2e/output/.gitempty | 0 tests/e2e/tests/login_test.js | 30 -- tests/e2e/tests/main_test.js | 25 -- webpack.config.builder.js | 72 ++-- webpack.config.js | 1 - yarn.lock | 234 +++++++++---- 61 files changed, 516 insertions(+), 1456 deletions(-) create mode 100644 .eslintignore create mode 100644 .prettierignore create mode 100644 .prettierrc rename dev/Component/{AbstracCheckbox.js => AbstractCheckbox.js} (65%) rename dev/Component/{AbstracRadio.js => AbstractRadio.js} (53%) delete mode 100644 phpunit.xml delete mode 100644 tests/MailSo/Base/HtmlUtilsTest.php delete mode 100644 tests/MailSo/Base/LinkFinderTest.php delete mode 100644 tests/MailSo/Imap/ImapClientTest.php delete mode 100644 tests/MailSo/Mime/EmailCollectionTest.php delete mode 100644 tests/MailSo/Mime/EmailTest.php delete mode 100644 tests/bootstrap.php delete mode 100644 tests/data/html/1-ok.html delete mode 100644 tests/data/html/1.html delete mode 100644 tests/data/html/2-ok.html delete mode 100644 tests/data/html/2.html delete mode 100644 tests/data/mails/uid-01.eml delete mode 100644 tests/data/mails/uid-02.eml delete mode 100644 tests/data/mails/uid-03.eml delete mode 100644 tests/data/mails/uid-04.eml delete mode 100644 tests/data/mails/uid-05.eml delete mode 100644 tests/e2e/.cmds delete mode 100644 tests/e2e/codecept.conf.js delete mode 100644 tests/e2e/configuration.js.dist delete mode 100644 tests/e2e/output/.gitempty delete mode 100644 tests/e2e/tests/login_test.js delete mode 100644 tests/e2e/tests/main_test.js diff --git a/.eslintignore b/.eslintignore new file mode 100644 index 000000000..d2ad1e3a0 --- /dev/null +++ b/.eslintignore @@ -0,0 +1,4 @@ +*.* +!/dev/**/*.js +!/tasks/**/*.js +!/*.js \ No newline at end of file diff --git a/.eslintrc.js b/.eslintrc.js index 0e7786d15..1ca1d4a76 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -1,279 +1,36 @@ - -module.exports = { - 'extends': 'eslint:recommended', - "parser": "babel-eslint", - 'parserOptions': { - 'ecmaVersion': 6, - 'sourceType': 'module' - }, - 'env': { - 'node': true, - 'commonjs': true, - 'es6': true - }, - // 'plugins': ['compat'], - 'globals': { - 'RL_COMMUNITY': true, - 'RL_ES6': true - }, - - // http://eslint.org/docs/rules/ - 'rules': { - // plugins - // 'compat/compat': 2, - - // errors - 'no-cond-assign': [2, 'always'], - 'no-console': 0, - '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, 2, 10, 100], -// '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': 0, - 'no-void': 2, - 'no-warning-comments': 2, - 'no-with': 2, - 'radix': 2, -// 'vars-on-top': 2, - 'wrap-iife': 2, - 'yoda': [2, 'always'], - - // 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, - - // 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, - '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': ['error', 'tab', { - 'SwitchCase': 1, - 'VariableDeclarator': 1 - }], - '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, { - "max": 1, - "maxEOF": 1, - "maxBOF": 1 - }], -// 'no-negated-condition': 2, -// 'no-nested-ternary': 2, - 'no-new-object': 2, - 'no-plusplus': [2, { - 'allowForLoopAfterthoughts': true - }], - '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': 'always' -// }], - '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, - - 'prefer-rest-params': 2, - 'prefer-spread': 2, - -// 'prefer-template': 2, - 'require-yield': 2, - 'rest-spread-spacing': 2, - 'sort-imports': 0, // off - 'template-curly-spacing': 2, - 'yield-star-spacing': 2 - } -}; +module.exports = { + parser: 'babel-eslint', + extends: ['eslint:recommended', 'plugin:prettier/recommended'], + plugins: ['prettier'], + parserOptions: { + ecmaVersion: 6, + sourceType: 'module' + }, + env: { + node: true, + commonjs: true, + es6: true + }, + globals: { + 'RL_COMMUNITY': true, + 'RL_ES6': true + }, + // http://eslint.org/docs/rules/ + rules: { + // plugins + 'prettier/prettier': 'error', + + 'no-console': 'error', + 'max-len': [ + 'error', + 120, + 2, + { + ignoreComments: true, + ignoreUrls: true, + ignoreTrailingComments: true, + ignorePattern: '(^\\s*(const|let|var)\\s.+=\\s*require\\s*\\(|^import\\s.+\\sfrom\\s.+;$)' + } + ] + } +}; diff --git a/.gitignore b/.gitignore index 44d279280..4a0faab04 100644 --- a/.gitignore +++ b/.gitignore @@ -10,9 +10,6 @@ /rainloop/v/0.0.0/static/* /rainloop/v/0.0.0/app/localization/moment/* !/rainloop/v/0.0.0/app/localization/moment/.gitempty -/tests/e2e/configuration.js -/tests/e2e/output/* -!/tests/e2e/output/.gitempty /vendors/.* /node_modules /build/local @@ -26,6 +23,5 @@ /dist /data .DS_Store -/tests/fix.php /MULTIPLY /include.php diff --git a/.prettierignore b/.prettierignore new file mode 100644 index 000000000..d1fbfcb5d --- /dev/null +++ b/.prettierignore @@ -0,0 +1,4 @@ +*.* +!/dev/**/*.js +!/tasks/**/*.js +!/*.js diff --git a/.prettierrc b/.prettierrc new file mode 100644 index 000000000..8fcd715a2 --- /dev/null +++ b/.prettierrc @@ -0,0 +1,26 @@ +{ + "printWidth": 120, + "semi": true, + "singleQuote": true, + "useTabs": true, + "bracketSpacing": true, + "trailingComma": "none", + "arrowParens": "always", + "endOfLine": "lf", + "quoteProps": "preserve", + "overrides": [ + { + "files": "*.js", + "options": { + "parser": "babel" + } + }, + { + "files": "*.jsx", + "options": { + "parser": "babel" + } + } + ] + } + \ No newline at end of file diff --git a/Makefile b/Makefile index d72119ad7..aa7650a7c 100644 --- a/Makefile +++ b/Makefile @@ -49,9 +49,11 @@ logs-tx: rl-lint: @docker-compose run --no-deps --rm node gulp lint rl-dev: - @docker-compose run --no-deps --rm node gulp -rl-watch-css: - @docker-compose run --no-deps --rm node npm run watch-css + @docker-compose run --no-deps --rm node npm run watch-js +rl-compile: + @docker-compose run --no-deps --rm node gulp build +rl-compile-with-source: + @docker-compose run --no-deps --rm node gulp build --source rl-watch-js: @docker-compose run --no-deps --rm node npm run watch-js diff --git a/dev/Component/AbstracCheckbox.js b/dev/Component/AbstractCheckbox.js similarity index 65% rename from dev/Component/AbstracCheckbox.js rename to dev/Component/AbstractCheckbox.js index bc853c37a..0663dbc89 100644 --- a/dev/Component/AbstracCheckbox.js +++ b/dev/Component/AbstractCheckbox.js @@ -1,32 +1,26 @@ - import ko from 'ko'; -import {isUnd} from 'Common/Utils'; -import {AbstractComponent} from 'Component/Abstract'; +import { isUnd } from 'Common/Utils'; +import { AbstractComponent } from 'Component/Abstract'; -class AbstracCheckbox extends AbstractComponent -{ +class AbstractCheckbox extends AbstractComponent { /** * @param {Object} params = {} */ constructor(params = {}) { - super(); this.value = params.value; - if (isUnd(this.value) || !this.value.subscribe) - { + if (isUnd(this.value) || !this.value.subscribe) { this.value = ko.observable(isUnd(this.value) ? false : !!this.value); } this.enable = params.enable; - if (isUnd(this.enable) || !this.enable.subscribe) - { + if (isUnd(this.enable) || !this.enable.subscribe) { this.enable = ko.observable(isUnd(this.enable) ? true : !!this.enable); } this.disable = params.disable; - if (isUnd(this.disable) || !this.disable.subscribe) - { + if (isUnd(this.disable) || !this.disable.subscribe) { this.disable = ko.observable(isUnd(this.disable) ? false : !!this.disable); } @@ -41,11 +35,10 @@ class AbstracCheckbox extends AbstractComponent } click() { - if (!this.readOnly && this.enable() && !this.disable()) - { + if (!this.readOnly && this.enable() && !this.disable()) { this.value(!this.value()); } } } -export {AbstracCheckbox, AbstracCheckbox as default}; +export { AbstractCheckbox, AbstractCheckbox as default }; diff --git a/dev/Component/AbstracRadio.js b/dev/Component/AbstractRadio.js similarity index 53% rename from dev/Component/AbstracRadio.js rename to dev/Component/AbstractRadio.js index bd084fd5a..824618ed3 100644 --- a/dev/Component/AbstracRadio.js +++ b/dev/Component/AbstractRadio.js @@ -1,43 +1,37 @@ - import _ from '_'; import ko from 'ko'; -import {isUnd} from 'Common/Utils'; -import {AbstractComponent} from 'Component/Abstract'; +import { isUnd } from 'Common/Utils'; +import { AbstractComponent } from 'Component/Abstract'; -class AbstracRadio extends AbstractComponent -{ +class AbstractRadio extends AbstractComponent { /** * @param {Object} params */ constructor(params) { - super(); this.values = ko.observableArray([]); this.value = params.value; - if (isUnd(this.value) || !this.value.subscribe) - { + if (isUnd(this.value) || !this.value.subscribe) { this.value = ko.observable(''); } this.inline = isUnd(params.inline) ? false : params.inline; this.readOnly = isUnd(params.readOnly) ? false : !!params.readOnly; - if (params.values) - { - this.values(_.map(params.values, (label, value) => ({label: label, value: value}))); + if (params.values) { + this.values(_.map(params.values, (label, value) => ({ label: label, value: value }))); } this.click = _.bind(this.click, this); } click(value) { - if (!this.readOnly && value) - { + if (!this.readOnly && value) { this.value(value.value); } } } -export {AbstracRadio, AbstracRadio as default}; +export { AbstractRadio, AbstractRadio as default }; diff --git a/dev/Component/Checkbox.js b/dev/Component/Checkbox.js index 02a376a5b..b49a12d5d 100644 --- a/dev/Component/Checkbox.js +++ b/dev/Component/Checkbox.js @@ -1,7 +1,7 @@ import {componentExportHelper} from 'Component/Abstract'; -import {AbstracCheckbox} from 'Component/AbstracCheckbox'; +import {AbstractCheckbox} from 'Component/AbstractCheckbox'; -class CheckboxComponent extends AbstracCheckbox {} +class CheckboxComponent extends AbstractCheckbox {} export default componentExportHelper(CheckboxComponent, 'CheckboxComponent'); diff --git a/dev/Component/Classic/Checkbox.js b/dev/Component/Classic/Checkbox.js index 018b0e9e2..e4611c4d7 100644 --- a/dev/Component/Classic/Checkbox.js +++ b/dev/Component/Classic/Checkbox.js @@ -1,7 +1,7 @@ import {componentExportHelper} from 'Component/Abstract'; -import {AbstracCheckbox} from 'Component/AbstracCheckbox'; +import {AbstractCheckbox} from 'Component/AbstractCheckbox'; -class ClassicCheckboxComponent extends AbstracCheckbox {} +class ClassicCheckboxComponent extends AbstractCheckbox {} export default componentExportHelper(ClassicCheckboxComponent, 'ClassicCheckboxComponent'); diff --git a/dev/Component/MaterialDesign/Checkbox.js b/dev/Component/MaterialDesign/Checkbox.js index d727dfb18..d3a1e989c 100644 --- a/dev/Component/MaterialDesign/Checkbox.js +++ b/dev/Component/MaterialDesign/Checkbox.js @@ -2,9 +2,9 @@ import _ from '_'; import ko from 'ko'; import {componentExportHelper} from 'Component/Abstract'; -import {AbstracCheckbox} from 'Component/AbstracCheckbox'; +import {AbstractCheckbox} from 'Component/AbstractCheckbox'; -class CheckboxMaterialDesignComponent extends AbstracCheckbox +class CheckboxMaterialDesignComponent extends AbstractCheckbox { /** * @param {Object} params diff --git a/dev/Component/Radio.js b/dev/Component/Radio.js index adbb3b5c5..eaf1df911 100644 --- a/dev/Component/Radio.js +++ b/dev/Component/Radio.js @@ -1,7 +1,7 @@ import {componentExportHelper} from 'Component/Abstract'; -import {AbstracRadio} from 'Component/AbstracRadio'; +import {AbstractRadio} from 'Component/AbstractRadio'; -class RadioComponent extends AbstracRadio {} +class RadioComponent extends AbstractRadio {} export default componentExportHelper(RadioComponent, 'RadioComponent'); diff --git a/dev/Styles/Contacts.less b/dev/Styles/Contacts.less index fd63c1fd6..3fd7edbe0 100644 --- a/dev/Styles/Contacts.less +++ b/dev/Styles/Contacts.less @@ -118,9 +118,9 @@ } } - .e-contact-foreach { - border-bottom: 1px solid #ddd; - } + // .e-contact-foreach { + // border-bottom: 1px solid #ddd; + // } .e-contact-item { position: relative; @@ -133,6 +133,7 @@ margin: 0px; border: 0px solid transparent; z-index: 100; + border-bottom: 1px solid #ddd; .delimiter { position: relative; @@ -413,7 +414,7 @@ margin: 0px; border: 0px solid transparent; z-index: 100; - + border-bottom: 1px solid #ddd; } } diff --git a/dev/View/Popup/Contacts.js b/dev/View/Popup/Contacts.js index 0ab41726c..1eb9638f1 100644 --- a/dev/View/Popup/Contacts.js +++ b/dev/View/Popup/Contacts.js @@ -93,9 +93,9 @@ class ContactsPopupView extends AbstractViewNext (property) => -1 < inArray(property.type(), [ContactPropertyType.FirstName, ContactPropertyType.LastName]) ); - this.viewPropertiesOther = this.viewProperties.filter( - (property) => -1 < inArray(property.type(), [ContactPropertyType.Note]) - ); + // this.viewPropertiesOther = this.viewProperties.filter( + // (property) => -1 < inArray(property.type(), [ContactPropertyType.Note]) + // ); this.viewPropertiesOther = ko.computed(() => { const list = _.filter(this.viewProperties(), diff --git a/dev/polyfills.js b/dev/polyfills.js index 51538ad10..61fbc36b2 100644 --- a/dev/polyfills.js +++ b/dev/polyfills.js @@ -3,13 +3,3 @@ import 'core-js/features/array/includes'; import 'core-js/features/string/includes'; import 'core-js/features/promise'; import 'raf/polyfill'; - -/* eslint-disable no-undefined, consistent-return */ -const log = console && console.log ? console.log : undefined; -console.log = log ? (...props) => { - if (props && props[0] && 0 === props[0].indexOf('JQMIGRATE:')) { - return; - } - - return log(...props); -} : undefined; diff --git a/gulpfile.js b/gulpfile.js index 0ea0c5902..403080708 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -1,13 +1,13 @@ /* RainLoop Webmail (c) RainLoop Team | Licensed under AGPL 3 */ const gulp = require('gulp'); -const {cleanStatic} = require('./tasks/common'); -const {assets} = require('./tasks/assets'); -const {js, jsLint} = require('./tasks/js'); -const {css, cssLint} = require('./tasks/css'); -const {vendors} = require('./tasks/vendors'); -const {rainloop} = require('./tasks/rainloop'); -const {owncloud} = require('./tasks/owncloud'); +const { cleanStatic } = require('./tasks/common'); +const { assets } = require('./tasks/assets'); +const { js, jsLint } = require('./tasks/js'); +const { css, cssLint } = require('./tasks/css'); +const { vendors } = require('./tasks/vendors'); +const { rainloop } = require('./tasks/rainloop'); +const { owncloud } = require('./tasks/owncloud'); const clean = gulp.series(cleanStatic); @@ -18,8 +18,10 @@ const buildState2 = gulp.series(clean, assets, buildState1); const build = gulp.parallel(lint, buildState2); +exports.css = css; exports.lint = lint; exports.build = build; +exports.default = build; exports.rainloop = gulp.series(build, rainloop); exports.owncloud = gulp.series(build, owncloud); diff --git a/package.json b/package.json index 3d8bc4ce0..308d8e2c4 100644 --- a/package.json +++ b/package.json @@ -64,6 +64,8 @@ "element-dataset": "2.2.6", "emailjs-addressparser": "2.0.2", "eslint": "6.0.1", + "eslint-config-prettier": "6.0.0", + "eslint-plugin-prettier": "3.1.0", "gulp": "4.0.2", "gulp-autoprefixer": "6.1.0", "gulp-cached": "1.1.1", @@ -83,6 +85,7 @@ "gulp-replace": "1.0.0", "gulp-rimraf": "0.2.2", "gulp-size": "3.0.0", + "gulp-sourcemaps": "2.6.5", "gulp-stripbom": "1.0.4", "gulp-through": "0.4.0", "gulp-uglify": "3.0.2", @@ -109,13 +112,14 @@ "openpgp": "2.6.2", "opentip": "2.4.3", "pikaday": "1.8.0", + "prettier": "1.18.2", "raf": "3.4.1", "raw-loader": "3.0.0", "rimraf": "2.6.3", "simplestatemanager": "4.1.1", "style-loader": "0.23.1", "underscore": "1.9.1", - "webpack": "4.35.0", + "webpack": "4.35.2", "webpack-cli": "3.3.5" } } diff --git a/phpunit.xml b/phpunit.xml deleted file mode 100644 index d890f0d88..000000000 --- a/phpunit.xml +++ /dev/null @@ -1,8 +0,0 @@ - - - - - tests - - - \ No newline at end of file diff --git a/plugins/custom-admin-settings-tab/js/CustomAdminSettings.js b/plugins/custom-admin-settings-tab/js/CustomAdminSettings.js index e7ef58b5a..206051211 100644 --- a/plugins/custom-admin-settings-tab/js/CustomAdminSettings.js +++ b/plugins/custom-admin-settings-tab/js/CustomAdminSettings.js @@ -1,6 +1,11 @@ (function () { + if (!window.rl) + { + return; + } + /** * @constructor */ diff --git a/plugins/custom-settings-tab/js/CustomUserSettings.js b/plugins/custom-settings-tab/js/CustomUserSettings.js index ef904b51c..16920d40f 100644 --- a/plugins/custom-settings-tab/js/CustomUserSettings.js +++ b/plugins/custom-settings-tab/js/CustomUserSettings.js @@ -1,6 +1,11 @@ (function () { + if (!window.rl) + { + return; + } + /** * @constructor */ diff --git a/plugins/google-analytics/js/include.js b/plugins/google-analytics/js/include.js index 5f40b475d..6d73d35db 100644 --- a/plugins/google-analytics/js/include.js +++ b/plugins/google-analytics/js/include.js @@ -1,6 +1,11 @@ $(function () { - + + if (!window.rl) + { + return; + } + var sAccount = window.rl.pluginSettingsGet('google-analytics', 'account'), sDomain = window.rl.pluginSettingsGet('google-analytics', 'domain_name'), diff --git a/plugins/piwik-analytics/js/include.js b/plugins/piwik-analytics/js/include.js index df4b4dc6d..a5ab3328a 100644 --- a/plugins/piwik-analytics/js/include.js +++ b/plugins/piwik-analytics/js/include.js @@ -1,6 +1,11 @@ $(function () { + if (!window.rl) + { + return; + } + var sPiwikURL = '' + window.rl.pluginSettingsGet('piwik-analytics', 'piwik_url'), sSiteID = '' + window.rl.pluginSettingsGet('piwik-analytics', 'site_id') diff --git a/plugins/recaptcha/js/recaptcha.js b/plugins/recaptcha/js/recaptcha.js index 2a579d817..49d20bd60 100644 --- a/plugins/recaptcha/js/recaptcha.js +++ b/plugins/recaptcha/js/recaptcha.js @@ -9,7 +9,7 @@ function ShowRecaptcha() { - if (window.grecaptcha) + if (window.grecaptcha && window.rl) { if (null === nId) { diff --git a/rainloop/v/0.0.0/app/libraries/RainLoop/Service.php b/rainloop/v/0.0.0/app/libraries/RainLoop/Service.php index b6dd4a29b..a167e3ab2 100644 --- a/rainloop/v/0.0.0/app/libraries/RainLoop/Service.php +++ b/rainloop/v/0.0.0/app/libraries/RainLoop/Service.php @@ -304,7 +304,7 @@ class Service $aTemplateParameters = array( '{{BaseAppHeadScriptLink}}' => $sSentryDsn ? - '' : '', + '' : '', '{{BaseAppBodyScript}}' => $sSentryDsn ? '' : '', '{{BaseAppFaviconPngLinkTag}}' => $sFaviconPngLink ? '' : '', diff --git a/rainloop/v/0.0.0/app/templates/Views/User/MailMessageView.html b/rainloop/v/0.0.0/app/templates/Views/User/MailMessageView.html index 45b4611f0..f1c48973d 100644 --- a/rainloop/v/0.0.0/app/templates/Views/User/MailMessageView.html +++ b/rainloop/v/0.0.0/app/templates/Views/User/MailMessageView.html @@ -243,7 +243,7 @@   - + diff --git a/rainloop/v/0.0.0/app/templates/Views/User/PopupsContacts.html b/rainloop/v/0.0.0/app/templates/Views/User/PopupsContacts.html index b325dedaa..6b0c3ff4c 100644 --- a/rainloop/v/0.0.0/app/templates/Views/User/PopupsContacts.html +++ b/rainloop/v/0.0.0/app/templates/Views/User/PopupsContacts.html @@ -91,7 +91,6 @@
 
-
@@ -183,7 +182,7 @@
- + @@ -192,13 +191,13 @@
- + - + @@ -214,7 +213,7 @@
- + @@ -230,7 +229,7 @@
- + @@ -245,7 +244,7 @@
- + diff --git a/rainloop/v/0.0.0/app/templates/Views/User/PopupsFolderClear.html b/rainloop/v/0.0.0/app/templates/Views/User/PopupsFolderClear.html index ee3d4c0a0..524b935ab 100644 --- a/rainloop/v/0.0.0/app/templates/Views/User/PopupsFolderClear.html +++ b/rainloop/v/0.0.0/app/templates/Views/User/PopupsFolderClear.html @@ -10,7 +10,7 @@