From 6f8e355fbb0f023c13ab789cce12ee4080a4a129 Mon Sep 17 00:00:00 2001 From: Justin Reynolds Date: Thu, 25 Jan 2018 12:12:31 -0600 Subject: [PATCH 01/12] Upgrade to Meteor 1.6.1 --- .meteor/packages | 4 +- .meteor/release | 2 +- .meteor/versions | 60 +++++----- package-lock.json | 113 +++++++++++------- package.json | 1 + packages/_boilerplate-generator/generator.js | 102 ---------------- packages/_boilerplate-generator/package.js | 14 --- .../template-web.browser.js | 79 ------------ .../template-web.cordova.js | 79 ------------ packages/vulcan-lib/lib/modules/settings.js | 24 +--- packages/vulcan-lib/lib/modules/utils.js | 4 +- 11 files changed, 111 insertions(+), 371 deletions(-) delete mode 100644 packages/_boilerplate-generator/generator.js delete mode 100644 packages/_boilerplate-generator/package.js delete mode 100644 packages/_boilerplate-generator/template-web.browser.js delete mode 100644 packages/_boilerplate-generator/template-web.cordova.js diff --git a/.meteor/packages b/.meteor/packages index 526f0e58f..33f75528c 100644 --- a/.meteor/packages +++ b/.meteor/packages @@ -8,7 +8,7 @@ vulcan:i18n-en-us ############ Accounts Packages ############ -accounts-password@1.4.0 +accounts-password@1.5.0 # accounts-twitter # accounts-facebook @@ -27,4 +27,4 @@ example-simple # example-interfaces # example-reactions -vulcan:debug \ No newline at end of file +vulcan:debug diff --git a/.meteor/release b/.meteor/release index 0fa8d22dd..d502dc0d9 100644 --- a/.meteor/release +++ b/.meteor/release @@ -1 +1 @@ -METEOR@1.6 +METEOR@1.6.1 diff --git a/.meteor/versions b/.meteor/versions index 90735278d..2402814c5 100644 --- a/.meteor/versions +++ b/.meteor/versions @@ -1,73 +1,77 @@ accounts-base@1.4.2 accounts-password@1.5.0 allow-deny@1.1.0 -autoupdate@1.3.12 -babel-compiler@6.24.7 -babel-runtime@1.1.1 +autoupdate@1.4.0 +babel-compiler@7.0.0 +babel-runtime@1.2.0 base64@1.0.10 binary-heap@1.0.10 -boilerplate-generator@1.3.0 +boilerplate-generator@1.4.0 buffer@0.0.0 caching-compiler@1.1.9 -callback-hook@1.0.10 -check@1.2.5 +callback-hook@1.1.0 +check@1.3.0 ddp@1.4.0 -ddp-client@2.2.0 -ddp-common@1.3.0 +ddp-client@2.3.1 +ddp-common@1.4.0 ddp-rate-limiter@1.0.7 -ddp-server@2.1.1 -diff-sequence@1.0.7 -dynamic-import@0.2.1 -ecmascript@0.9.0 +ddp-server@2.1.2 +diff-sequence@1.1.0 +dynamic-import@0.3.0 +ecmascript@0.10.0 ecmascript-runtime@0.5.0 -ecmascript-runtime-client@0.5.0 +ecmascript-runtime-client@0.6.0 ecmascript-runtime-server@0.5.0 ejson@1.1.0 email@1.2.3 +es5-shim@4.7.2 example-simple@0.0.0 fourseven:scss@4.5.4 geojson-utils@1.0.10 hot-code-push@1.0.4 -http@1.3.0 -id-map@1.0.9 +http@1.4.0 +id-map@1.1.0 livedata@1.0.18 localstorage@1.2.0 logging@1.1.19 meteor@1.8.2 -meteor-base@1.2.0 +meteor-base@1.3.0 meteorhacks:inject-initial@1.0.4 meteorhacks:picker@1.0.3 -minifier-css@1.2.16 -minifier-js@2.2.2 +minifier-css@1.3.0 +minifier-js@2.3.1 minimongo@1.4.3 -modules@0.11.2 +modules@0.11.3 modules-runtime@0.9.1 -mongo@1.3.1 +mongo@1.4.2 mongo-dev-server@1.1.0 mongo-id@1.0.6 npm-bcrypt@0.9.3 npm-mongo@2.2.33 -ordered-dict@1.0.9 +ordered-dict@1.1.0 percolatestudio:synced-cron@1.1.0 promise@0.10.1 -random@1.0.10 +random@1.1.0 rate-limit@1.0.8 reactive-dict@1.2.0 reactive-var@1.0.11 -reload@1.1.11 -retry@1.0.9 +reload@1.2.0 +retry@1.1.0 routepolicy@1.0.12 +server-render@0.3.0 service-configuration@1.0.11 session@1.1.7 sha@1.0.9 shell-server@0.3.1 +shim-common@0.1.0 +socket-stream-client@0.1.0 srp@1.0.10 -standard-minifier-css@1.3.5 -standard-minifier-js@2.2.3 +standard-minifier-css@1.4.0 +standard-minifier-js@2.3.1 standard-minifiers@1.1.0 tracker@1.1.3 underscore@1.0.10 -url@1.1.0 +url@1.2.0 vulcan:accounts@1.8.5 vulcan:core@1.8.5 vulcan:debug@1.8.5 @@ -78,5 +82,5 @@ vulcan:i18n-en-us@1.8.5 vulcan:lib@1.8.5 vulcan:routing@1.8.5 vulcan:users@1.8.5 -webapp@1.4.0 +webapp@1.5.0 webapp-hashing@1.0.9 diff --git a/package-lock.json b/package-lock.json index 44a252a80..df2d8b26a 100644 --- a/package-lock.json +++ b/package-lock.json @@ -4,6 +4,15 @@ "lockfileVersion": 1, "requires": true, "dependencies": { + "@babel/runtime": { + "version": "7.0.0-beta.38", + "resolved": "https://registry.npmjs.org/@babel/runtime/-/runtime-7.0.0-beta.38.tgz", + "integrity": "sha512-ZvPtlcvH2ZRzr1U5pkmCE7U3RIun3Nf29XHem47aScmJgMuL06ulkp+4oPBee3QrUVFErDjwNWtC67BzNuxLVw==", + "requires": { + "core-js": "2.5.1", + "regenerator-runtime": "0.11.1" + } + }, "@segment/loosely-validate-event": { "version": "1.1.2", "resolved": "https://registry.npmjs.org/@segment/loosely-validate-event/-/loosely-validate-event-1.1.2.tgz", @@ -837,6 +846,11 @@ "lazy-cache": "1.0.4" } }, + "chain-function": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/chain-function/-/chain-function-1.0.0.tgz", + "integrity": "sha1-DUqzfn4Y6tC9xHuSB2QRjOWHM9w=" + }, "chalk": { "version": "2.2.0", "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.2.0.tgz", @@ -2226,11 +2240,12 @@ } }, "formsy-react-components": { - "version": "0.10.1", - "resolved": "https://registry.npmjs.org/formsy-react-components/-/formsy-react-components-0.10.1.tgz", - "integrity": "sha1-ahFE5a2AGgLrzkxG5QM+juMFxBw=", + "version": "0.11.1", + "resolved": "https://registry.npmjs.org/formsy-react-components/-/formsy-react-components-0.11.1.tgz", + "integrity": "sha1-ucMGytfeQR92UaVsd1XY9Oabm5M=", "requires": { - "classnames": "2.2.5" + "classnames": "2.2.5", + "prop-types": "15.6.0" } }, "forwarded": { @@ -2509,7 +2524,7 @@ "he": "1.1.1", "htmlparser": "1.7.7", "optimist": "0.6.1", - "underscore": "1.8.3", + "underscore": "1.8.4", "underscore.string": "3.3.4" } }, @@ -4630,11 +4645,10 @@ } }, "react": { - "version": "15.6.2", - "resolved": "https://registry.npmjs.org/react/-/react-15.6.2.tgz", - "integrity": "sha1-26BDSrQ5z+gvEI8PURZjkIF5qnI=", + "version": "16.2.0", + "resolved": "https://registry.npmjs.org/react/-/react-16.2.0.tgz", + "integrity": "sha512-ZmIomM7EE1DvPEnSFAHZn9Vs9zJl5A9H7el0EGTE6ZbW9FKe/14IYAlPbC8iH25YarEQxZL+E8VW7Mi7kfQrDQ==", "requires": { - "create-react-class": "15.6.2", "fbjs": "0.8.16", "loose-envify": "1.3.1", "object-assign": "4.1.1", @@ -4666,9 +4680,9 @@ } }, "react-bootstrap": { - "version": "0.31.5", - "resolved": "https://registry.npmjs.org/react-bootstrap/-/react-bootstrap-0.31.5.tgz", - "integrity": "sha512-xgDihgX4QvYHmHzL87faDBMDnGfYyqcrqV0TEbWY+JizePOG1vfb8M3xJN+6MJ3kUYqDtQSZ7v/Q6Y5YDrkMdA==", + "version": "0.32.1", + "resolved": "https://registry.npmjs.org/react-bootstrap/-/react-bootstrap-0.32.1.tgz", + "integrity": "sha512-RbfzKUbsukWsToWqGHfCCyMFq9QQI0TznutdyxyJw6dih2NvIne25Mrssg8LZsprqtPpyQi8bN0L0Fx3fUsL8Q==", "requires": { "babel-runtime": "6.26.0", "classnames": "2.2.5", @@ -4677,9 +4691,26 @@ "keycode": "2.1.9", "prop-types": "15.6.0", "prop-types-extra": "1.0.1", - "react-overlays": "0.7.4", + "react-overlays": "0.8.3", + "react-prop-types": "0.4.0", + "react-transition-group": "2.2.1", "uncontrollable": "4.1.0", "warning": "3.0.0" + }, + "dependencies": { + "react-overlays": { + "version": "0.8.3", + "resolved": "https://registry.npmjs.org/react-overlays/-/react-overlays-0.8.3.tgz", + "integrity": "sha512-h6GT3jgy90PgctleP39Yu3eK1v9vaJAW73GOA/UbN9dJ7aAN4BTZD6793eI1D5U+ukMk17qiqN/wl3diK1Z5LA==", + "requires": { + "classnames": "2.2.5", + "dom-helpers": "3.3.1", + "prop-types": "15.6.0", + "prop-types-extra": "1.0.1", + "react-transition-group": "2.2.1", + "warning": "3.0.0" + } + } } }, "react-bootstrap-datetimepicker": { @@ -4734,9 +4765,9 @@ } }, "react-dom": { - "version": "15.6.2", - "resolved": "https://registry.npmjs.org/react-dom/-/react-dom-15.6.2.tgz", - "integrity": "sha1-Qc+t9pO3V/rycIRDodH9WgK+9zA=", + "version": "16.2.0", + "resolved": "https://registry.npmjs.org/react-dom/-/react-dom-16.2.0.tgz", + "integrity": "sha512-zpGAdwHVn9K0091d+hr+R0qrjoJ84cIBFL2uU60KvWBPfZ7LPSrfqviTxGHWN0sjPZb2hxWzMexwrvJdKePvjg==", "requires": { "fbjs": "0.8.16", "loose-envify": "1.3.1", @@ -4802,18 +4833,6 @@ "resolved": "https://registry.npmjs.org/react-onclickoutside/-/react-onclickoutside-6.7.0.tgz", "integrity": "sha512-IBivBP7xayM7SbbVlAnKgHgoWdfCVqnNBNgQRY5x9iFQm55tFdolR02hX1fCJJtTEKnbaL1stB72/TZc6+p2+Q==" }, - "react-overlays": { - "version": "0.7.4", - "resolved": "https://registry.npmjs.org/react-overlays/-/react-overlays-0.7.4.tgz", - "integrity": "sha512-7vsooMx3siLAuEfTs8FYeP/lAORWWFXTO8PON3KgX0Htq1Oa+po6ioSjGyO0/GO5CVSMNhpWt6V2opeexHgBuQ==", - "requires": { - "classnames": "2.2.5", - "dom-helpers": "3.3.1", - "prop-types": "15.6.0", - "prop-types-extra": "1.0.1", - "warning": "3.0.0" - } - }, "react-places-autocomplete": { "version": "5.4.3", "resolved": "https://registry.npmjs.org/react-places-autocomplete/-/react-places-autocomplete-5.4.3.tgz", @@ -4823,6 +4842,14 @@ "prop-types": "15.6.0" } }, + "react-prop-types": { + "version": "0.4.0", + "resolved": "https://registry.npmjs.org/react-prop-types/-/react-prop-types-0.4.0.tgz", + "integrity": "sha1-+ZsL+0AGkpya8gUefBQUpcdbk9A=", + "requires": { + "warning": "3.0.0" + } + }, "react-reconciler": { "version": "0.7.0", "resolved": "https://registry.npmjs.org/react-reconciler/-/react-reconciler-0.7.0.tgz", @@ -4910,6 +4937,19 @@ "prop-types": "15.6.0" } }, + "react-transition-group": { + "version": "2.2.1", + "resolved": "https://registry.npmjs.org/react-transition-group/-/react-transition-group-2.2.1.tgz", + "integrity": "sha512-q54UBM22bs/CekG8r3+vi9TugSqh0t7qcEVycaRc9M0p0aCEu+h6rp/RFiW7fHfgd1IKpd9oILFTl5QK+FpiPA==", + "requires": { + "chain-function": "1.0.0", + "classnames": "2.2.5", + "dom-helpers": "3.3.1", + "loose-envify": "1.3.1", + "prop-types": "15.6.0", + "warning": "3.0.0" + } + }, "read-pkg": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/read-pkg/-/read-pkg-2.0.0.tgz", @@ -4977,21 +5017,14 @@ } }, "recompose": { - "version": "0.21.2", - "resolved": "https://registry.npmjs.org/recompose/-/recompose-0.21.2.tgz", - "integrity": "sha1-/z+9sjl7HHfEfUUb4qY7kpXURoE=", + "version": "0.26.0", + "resolved": "https://registry.npmjs.org/recompose/-/recompose-0.26.0.tgz", + "integrity": "sha512-KwOu6ztO0mN5vy3+zDcc45lgnaUoaQse/a5yLVqtzTK13czSWnFGmXbQVmnoMgDkI5POd1EwIKSbjU1V7xdZog==", "requires": { "change-emitter": "0.1.6", "fbjs": "0.8.16", - "hoist-non-react-statics": "1.2.0", + "hoist-non-react-statics": "2.3.1", "symbol-observable": "1.1.0" - }, - "dependencies": { - "hoist-non-react-statics": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/hoist-non-react-statics/-/hoist-non-react-statics-1.2.0.tgz", - "integrity": "sha1-qkSM8JhtVcxAdzsXF0t90GbLfPs=" - } } }, "redux": { @@ -5952,7 +5985,7 @@ "integrity": "sha1-RYXfzPn85O8O7jG6vJ5NGQ6gzqo=", "requires": { "babel-runtime": "6.26.0", - "react": "15.6.2" + "react": "16.2.0" } }, "trim": { diff --git a/package.json b/package.json index a470b5a87..5c1f69888 100644 --- a/package.json +++ b/package.json @@ -9,6 +9,7 @@ "lint": "eslint --cache --ext .jsx,js packages" }, "dependencies": { + "@babel/runtime": "^7.0.0-beta.38", "analytics-node": "^2.1.1", "apollo-client": "^1.2.2", "apollo-engine": "^0.5.4", diff --git a/packages/_boilerplate-generator/generator.js b/packages/_boilerplate-generator/generator.js deleted file mode 100644 index 7ce1b7eaf..000000000 --- a/packages/_boilerplate-generator/generator.js +++ /dev/null @@ -1,102 +0,0 @@ -import { readFile } from 'fs'; - -import WebBrowserTemplate from './template-web.browser'; -import WebCordovaTemplate from './template-web.cordova'; - -// Copied from webapp_server -const readUtf8FileSync = filename => Meteor.wrapAsync(readFile)(filename, 'utf8'); - -export class Boilerplate { - constructor(arch, manifest, options = {}) { - this.template = _getTemplate(arch); - this.baseData = null; - - this._generateBoilerplateFromManifest( - manifest, - options - ); - } - - // The 'extraData' argument can be used to extend 'self.baseData'. Its - // purpose is to allow you to specify data that you might not know at - // the time that you construct the Boilerplate object. (e.g. it is used - // by 'webapp' to specify data that is only known at request-time). - toHTML(extraData) { - if (!this.baseData || !this.template) { - throw new Error('Boilerplate did not instantiate correctly.'); - } - - return "\n" + - this.template({ ...this.baseData, ...extraData }); - } - - // XXX Exported to allow client-side only changes to rebuild the boilerplate - // without requiring a full server restart. - // Produces an HTML string with given manifest and boilerplateSource. - // Optionally takes urlMapper in case urls from manifest need to be prefixed - // or rewritten. - // Optionally takes pathMapper for resolving relative file system paths. - // Optionally allows to override fields of the data context. - _generateBoilerplateFromManifest(manifest, { - urlMapper = _.identity, - pathMapper = _.identity, - baseDataExtension, - inline, - } = {}) { - - const boilerplateBaseData = { - css: [], - js: [], - head: '', - body: '', - meteorManifest: JSON.stringify(manifest), - ...baseDataExtension, - }; - - _.each(manifest, item => { - const urlPath = urlMapper(item.url); - const itemObj = { url: urlPath }; - - if (inline) { - itemObj.scriptContent = readUtf8FileSync( - pathMapper(item.path)); - itemObj.inline = true; - } - - if (item.type === 'css' && item.where === 'client') { - boilerplateBaseData.css.push(itemObj); - } - - if (item.type === 'js' && item.where === 'client' && - // Dynamic JS modules should not be loaded eagerly in the - // initial HTML of the app. - !item.path.startsWith('dynamic/')) { - boilerplateBaseData.js.push(itemObj); - } - - if (item.type === 'head') { - boilerplateBaseData.head = - readUtf8FileSync(pathMapper(item.path)); - } - - if (item.type === 'body') { - boilerplateBaseData.body = - readUtf8FileSync(pathMapper(item.path)); - } - }); - - this.baseData = boilerplateBaseData; - } -}; - -// Returns a template function that, when called, produces the boilerplate -// html as a string. -const _getTemplate = arch => { - if (arch === 'web.browser') { - return WebBrowserTemplate; - } else if (arch === 'web.cordova') { - return WebCordovaTemplate; - } else { - throw new Error('Unsupported arch: ' + arch); - } -}; diff --git a/packages/_boilerplate-generator/package.js b/packages/_boilerplate-generator/package.js deleted file mode 100644 index 51171b585..000000000 --- a/packages/_boilerplate-generator/package.js +++ /dev/null @@ -1,14 +0,0 @@ -Package.describe({ - name: "boilerplate-generator", - summary: "Generates the boilerplate html from program's manifest", - version: '1.3.0' -}); - -Package.onUse(api => { - api.use('ecmascript'); - api.use([ - 'underscore', - ], 'server'); - api.mainModule('generator.js', 'server'); - api.export('Boilerplate', 'server'); -}); \ No newline at end of file diff --git a/packages/_boilerplate-generator/template-web.browser.js b/packages/_boilerplate-generator/template-web.browser.js deleted file mode 100644 index e3fefc923..000000000 --- a/packages/_boilerplate-generator/template-web.browser.js +++ /dev/null @@ -1,79 +0,0 @@ -// Template function for rendering the boilerplate html for browsers - -export default function({ - meteorRuntimeConfig, - rootUrlPathPrefix, - inlineScriptsAllowed, - css, - js, - additionalStaticJs, - htmlAttributes, - bundledJsCssUrlRewriteHook, - head, - body, - dynamicHead, - dynamicBody, -}) { - return [].concat( - [ - ' - _.template(' <%= attrName %>="<%- attrValue %>"')({ - attrName: key, - attrValue: value - }) - ).join('') + '>', - '' - ], - - [ - head, - dynamicHead, - ], - - _.map(css, ({url}) => - _.template(' ')({ - href: bundledJsCssUrlRewriteHook(url) - }) - ), - - [ - '', - '', - body, - dynamicBody, - '', - (inlineScriptsAllowed - ? _.template(' ')({ - conf: meteorRuntimeConfig - }) - : _.template(' ')({ - src: rootUrlPathPrefix - }) - ) , - '' - ], - - _.map(js, ({url}) => - _.template(' ')({ - src: bundledJsCssUrlRewriteHook(url) - }) - ), - - _.map(additionalStaticJs, ({contents, pathname}) => ( - (inlineScriptsAllowed - ? _.template(' ')({ - contents: contents - }) - : _.template(' ')({ - src: rootUrlPathPrefix + pathname - })) - )), - - [ - '', '', - '', - '' - ], - ).join('\n'); -} - diff --git a/packages/_boilerplate-generator/template-web.cordova.js b/packages/_boilerplate-generator/template-web.cordova.js deleted file mode 100644 index 42e3af548..000000000 --- a/packages/_boilerplate-generator/template-web.cordova.js +++ /dev/null @@ -1,79 +0,0 @@ -// Template function for rendering the boilerplate html for cordova - -export default function({ - meteorRuntimeConfig, - rootUrlPathPrefix, - inlineScriptsAllowed, - css, - js, - additionalStaticJs, - htmlAttributes, - bundledJsCssUrlRewriteHook, - head, - body, - dynamicHead, - dynamicBody, -}) { - return [].concat( - [ - '', - '', - ' ', - ' ', - ' ', - ' ', - ' ', - ], - // We are explicitly not using bundledJsCssUrlRewriteHook: in cordova we serve assets up directly from disk, so rewriting the URL does not make sense - _.map(css, ({url}) => - _.template(' ')({ - href: url - }) - ), - [ - ' ', - '', - ' ' - ], - _.map(js, ({url}) => - _.template(' ')({ - src: url - }) - ), - - _.map(additionalStaticJs, ({contents, pathname}) => ( - (inlineScriptsAllowed - ? _.template(' ')({ - contents: contents - }) - : _.template(' ')({ - src: rootUrlPathPrefix + pathname - })) - )), - - [ - '', - head, - '', - '', - '', - body, - '', - '' - ], - ).join('\n'); -} - diff --git a/packages/vulcan-lib/lib/modules/settings.js b/packages/vulcan-lib/lib/modules/settings.js index 614a4caae..6caf752eb 100644 --- a/packages/vulcan-lib/lib/modules/settings.js +++ b/packages/vulcan-lib/lib/modules/settings.js @@ -104,26 +104,4 @@ export const getSetting = (settingName, settingDefault) => { } -// Settings collection is deprecated -// getSetting = function (setting, defaultValue) { - -// const collection = Telescope.settings.collection; - -// if (typeof getSettingFromJSON(setting) !== "undefined") { // if on the server, look in Meteor.settings - -// return getSettingFromJSON(setting); - -// } else if (collection && collection.findOne() && typeof collection.findOne()[setting] !== "undefined") { // look in collection - -// return Telescope.settings.collection.findOne()[setting]; - -// } else if (typeof defaultValue !== 'undefined') { // fallback to default - -// return defaultValue; - -// } else { // or return undefined - -// return undefined; - -// } -// }; \ No newline at end of file +registerSetting('debug', false, 'Enable debug mode (more verbose logging)'); diff --git a/packages/vulcan-lib/lib/modules/utils.js b/packages/vulcan-lib/lib/modules/utils.js index 1d7e379fa..980c7af01 100644 --- a/packages/vulcan-lib/lib/modules/utils.js +++ b/packages/vulcan-lib/lib/modules/utils.js @@ -9,12 +9,10 @@ import urlObject from 'url'; import moment from 'moment'; import sanitizeHtml from 'sanitize-html'; import getSlug from 'speakingurl'; -import { getSetting, registerSetting } from './settings.js'; +import { getSetting } from './settings.js'; import { Routes } from './routes.js'; import { isAbsolute } from 'path'; -registerSetting('debug', false, 'Enable debug mode (more verbose logging)'); - /** * @summary The global namespace for Vulcan utils. * @namespace Telescope.utils From 020d970bebdf7932e61bcfe412de030674036ebd Mon Sep 17 00:00:00 2001 From: Justin Reynolds Date: Thu, 25 Jan 2018 12:53:19 -0600 Subject: [PATCH 02/12] Fix circular dependency in example-forum --- .../components/posts/PostsCommentsThread.jsx | 3 +-- packages/example-forum/lib/modules/index.js | 2 +- .../lib/modules/containers/withList.js | 20 +++++++++++++------ 3 files changed, 16 insertions(+), 9 deletions(-) diff --git a/packages/example-forum/lib/components/posts/PostsCommentsThread.jsx b/packages/example-forum/lib/components/posts/PostsCommentsThread.jsx index ead43bbd9..47d8bd01f 100644 --- a/packages/example-forum/lib/components/posts/PostsCommentsThread.jsx +++ b/packages/example-forum/lib/components/posts/PostsCommentsThread.jsx @@ -2,7 +2,6 @@ import React from 'react'; import PropTypes from 'prop-types'; import { FormattedMessage } from 'meteor/vulcan:i18n'; import { withList, withCurrentUser, Components, registerComponent, Utils } from 'meteor/vulcan:core'; -import { Comments } from '../../modules/comments/index.js'; const PostsCommentsThread = (props, /* context*/) => { @@ -47,7 +46,7 @@ PostsCommentsThread.propTypes = { }; const options = { - collection: Comments, + collectionName: 'Comments', queryName: 'commentsListQuery', fragmentName: 'CommentsList', limit: 0, diff --git a/packages/example-forum/lib/modules/index.js b/packages/example-forum/lib/modules/index.js index 5cffe6299..1a64d1a62 100644 --- a/packages/example-forum/lib/modules/index.js +++ b/packages/example-forum/lib/modules/index.js @@ -6,8 +6,8 @@ import './routes.js'; import './headtags.js'; import './i18n.js'; +export { Posts } from './posts/index.js'; export { Categories } from './categories/index.js'; export { Comments } from './comments/index.js'; -export { Posts } from './posts/index.js'; import './notifications/index.js'; diff --git a/packages/vulcan-core/lib/modules/containers/withList.js b/packages/vulcan-core/lib/modules/containers/withList.js index cb1237db7..ff9afe9f9 100644 --- a/packages/vulcan-core/lib/modules/containers/withList.js +++ b/packages/vulcan-core/lib/modules/containers/withList.js @@ -35,11 +35,10 @@ Terms object can have the following properties: */ import React, { Component } from 'react'; -import PropTypes from 'prop-types'; import { withApollo, graphql } from 'react-apollo'; import gql from 'graphql-tag'; import update from 'immutability-helper'; -import { getSetting, getFragment, getFragmentName } from 'meteor/vulcan:core'; +import { getSetting, getFragment, getFragmentName, Collections } from 'meteor/vulcan:core'; import Mingo from 'mingo'; import compose from 'recompose/compose'; import withState from 'recompose/withState'; @@ -48,10 +47,19 @@ const withList = (options) => { // console.log(options) - const { collection, limit = 10, pollInterval = getSetting('pollInterval', 20000), totalResolver = true, enableCache = false, extraQueries } = options, - queryName = options.queryName || `${collection.options.collectionName}ListQuery`, - listResolverName = collection.options.resolvers.list && collection.options.resolvers.list.name, - totalResolverName = collection.options.resolvers.total && collection.options.resolvers.total.name; + const { + collectionName, + limit = 10, + pollInterval = getSetting('pollInterval', 20000), + totalResolver = true, + enableCache = false, + extraQueries, + } = options; + const collection = options.collection + || Collections.find(({ options: { collectionName: name }}) => name === collectionName ); + const queryName = options.queryName || `${collection.options.collectionName}ListQuery`; + const listResolverName = collection.options.resolvers.list && collection.options.resolvers.list.name; + const totalResolverName = collection.options.resolvers.total && collection.options.resolvers.total.name; let fragment; From 0e5feab3fa51ea36557f12103faa3d6870c93640 Mon Sep 17 00:00:00 2001 From: Justin Reynolds Date: Thu, 25 Jan 2018 12:56:40 -0600 Subject: [PATCH 03/12] Add Enroll Account component and route --- .../vulcan-accounts/imports/components.js | 1 + packages/vulcan-accounts/imports/routes.js | 1 + .../imports/ui/components/EnrollAccount.jsx | 42 +++++++++++++++++++ packages/vulcan-users/lib/server/urls.js | 1 + 4 files changed, 45 insertions(+) create mode 100644 packages/vulcan-accounts/imports/ui/components/EnrollAccount.jsx diff --git a/packages/vulcan-accounts/imports/components.js b/packages/vulcan-accounts/imports/components.js index a7403d2ca..1d3f73bb6 100644 --- a/packages/vulcan-accounts/imports/components.js +++ b/packages/vulcan-accounts/imports/components.js @@ -9,3 +9,4 @@ import './ui/components/LoginForm.jsx'; import './ui/components/PasswordOrService.jsx'; import './ui/components/SocialButtons.jsx'; import './ui/components/ResetPassword.jsx'; +import './ui/components/EnrollAccount.jsx'; diff --git a/packages/vulcan-accounts/imports/routes.js b/packages/vulcan-accounts/imports/routes.js index 11d6def9c..3d4ee3371 100644 --- a/packages/vulcan-accounts/imports/routes.js +++ b/packages/vulcan-accounts/imports/routes.js @@ -1,3 +1,4 @@ import { addRoute } from 'meteor/vulcan:core'; addRoute({name: 'resetPassword', path: '/reset-password/:token', componentName: 'AccountsResetPassword'}); +addRoute({name: 'enrollAccount', path: '/enroll-account/:token', componentName: 'AccountsEnrollAccount'}); diff --git a/packages/vulcan-accounts/imports/ui/components/EnrollAccount.jsx b/packages/vulcan-accounts/imports/ui/components/EnrollAccount.jsx new file mode 100644 index 000000000..981749cee --- /dev/null +++ b/packages/vulcan-accounts/imports/ui/components/EnrollAccount.jsx @@ -0,0 +1,42 @@ +import { Components, registerComponent, withCurrentUser } from 'meteor/vulcan:core'; +import React, { PureComponent } from 'react'; +import PropTypes from 'prop-types'; +import { Link } from 'react-router'; +import { intlShape } from 'meteor/vulcan:i18n'; +import { STATES } from '../../helpers.js'; + +class AccountsEnrollAccount extends PureComponent { + componentDidMount() { + const token = this.props.params.token; + Accounts._loginButtonsSession.set('enrollAccountToken', token); + } + + render() { + if (!this.props.currentUser) { + return ( + + ); + } else { + return ( +
+
{this.context.intl.formatMessage({id: 'accounts.info_password_changed'})}!
+
+ ); + } + } +} + +AccountsEnrollAccount.contextTypes = { + intl: intlShape +} + +AccountsEnrollAccount.propsTypes = { + currentUser: PropTypes.object, + params: PropTypes.object, +}; + +AccountsEnrollAccount.displayName = 'AccountsEnrollAccount'; + +registerComponent('AccountsEnrollAccount', AccountsEnrollAccount, withCurrentUser); diff --git a/packages/vulcan-users/lib/server/urls.js b/packages/vulcan-users/lib/server/urls.js index d86b0be94..c90dfff73 100644 --- a/packages/vulcan-users/lib/server/urls.js +++ b/packages/vulcan-users/lib/server/urls.js @@ -1 +1,2 @@ Accounts.urls.resetPassword = (token) => Meteor.absoluteUrl(`reset-password/${token}`); +Accounts.urls.enrollAccount = (token) => Meteor.absoluteUrl(`enroll-account/${token}`); From 5c67e4548e5edfddd3e441ae085517eaab97d1db Mon Sep 17 00:00:00 2001 From: Justin Reynolds Date: Thu, 25 Jan 2018 13:36:20 -0600 Subject: [PATCH 04/12] Fix React prop warnings for SmartForm --- .../lib/components/FormComponent.jsx | 25 +++++++++++++------ .../lib/components/bootstrap/Checkbox.jsx | 1 - .../components/bootstrap/Checkboxgroup.jsx | 1 - .../lib/components/bootstrap/Default.jsx | 1 - .../lib/components/bootstrap/Email.jsx | 1 - .../lib/components/bootstrap/Number.jsx | 1 - .../lib/components/bootstrap/Radiogroup.jsx | 1 - .../lib/components/bootstrap/Select.jsx | 1 - .../lib/components/bootstrap/Textarea.jsx | 1 - .../lib/components/bootstrap/Url.jsx | 1 - 10 files changed, 18 insertions(+), 16 deletions(-) diff --git a/packages/vulcan-forms/lib/components/FormComponent.jsx b/packages/vulcan-forms/lib/components/FormComponent.jsx index 2e1cc468a..9f4807293 100644 --- a/packages/vulcan-forms/lib/components/FormComponent.jsx +++ b/packages/vulcan-forms/lib/components/FormComponent.jsx @@ -67,7 +67,7 @@ class FormComponent extends PureComponent { } else if (typeof this.props.control === 'string') { // else pick a predefined component switch (this.props.control) { - + case 'number': return ; @@ -81,29 +81,40 @@ class FormComponent extends PureComponent { return ; case 'checkbox': + properties.value = properties.value || false; return ; case 'checkboxgroup': + if (!Array.isArray(properties.value)) { + properties.value = [properties.value]; + } return ; case 'radiogroup': // not sure why, but onChange needs to be specified here properties.onChange = (name, value) => {this.props.updateCurrentValues({[name]: value})}; return ; - + case 'select': - properties.options = [{label: this.context.intl.formatMessage({id: 'forms.select_option'}), disabled: true}, ...properties.options]; + const optionsAsStrings = properties.options.map(({ value, label }) => ({ + value: value.toString(), + label, + })); + if (!properties.multiple && Array.isArray(properties.value) && properties.value.length === 0) { + properties.value = ''; + } + properties.options = [{label: this.context.intl.formatMessage({id: 'forms.select_option'}), disabled: true}, ...optionsAsStrings]; return ; - + case 'datetime': return ; - + case 'time': return ; - + case 'text': return ; - + default: const CustomComponent = Components[this.props.control]; return ; diff --git a/packages/vulcan-forms/lib/components/bootstrap/Checkbox.jsx b/packages/vulcan-forms/lib/components/bootstrap/Checkbox.jsx index c1228ff26..e0a3bb0f6 100644 --- a/packages/vulcan-forms/lib/components/bootstrap/Checkbox.jsx +++ b/packages/vulcan-forms/lib/components/bootstrap/Checkbox.jsx @@ -1,5 +1,4 @@ import React from 'react'; -import PropTypes from 'prop-types'; import { Checkbox } from 'formsy-react-components'; import { registerComponent } from 'meteor/vulcan:core'; diff --git a/packages/vulcan-forms/lib/components/bootstrap/Checkboxgroup.jsx b/packages/vulcan-forms/lib/components/bootstrap/Checkboxgroup.jsx index 9d99781da..707035a4f 100644 --- a/packages/vulcan-forms/lib/components/bootstrap/Checkboxgroup.jsx +++ b/packages/vulcan-forms/lib/components/bootstrap/Checkboxgroup.jsx @@ -1,5 +1,4 @@ import React from 'react'; -import PropTypes from 'prop-types'; import { CheckboxGroup } from 'formsy-react-components'; import { registerComponent } from 'meteor/vulcan:core'; diff --git a/packages/vulcan-forms/lib/components/bootstrap/Default.jsx b/packages/vulcan-forms/lib/components/bootstrap/Default.jsx index 9429af8cb..e9fbcb09c 100644 --- a/packages/vulcan-forms/lib/components/bootstrap/Default.jsx +++ b/packages/vulcan-forms/lib/components/bootstrap/Default.jsx @@ -1,5 +1,4 @@ import React from 'react'; -import PropTypes from 'prop-types'; import { Input } from 'formsy-react-components'; import { registerComponent } from 'meteor/vulcan:core'; diff --git a/packages/vulcan-forms/lib/components/bootstrap/Email.jsx b/packages/vulcan-forms/lib/components/bootstrap/Email.jsx index 6617026c2..99a6e5fbb 100644 --- a/packages/vulcan-forms/lib/components/bootstrap/Email.jsx +++ b/packages/vulcan-forms/lib/components/bootstrap/Email.jsx @@ -1,5 +1,4 @@ import React from 'react'; -import PropTypes from 'prop-types'; import { Input } from 'formsy-react-components'; import { registerComponent } from 'meteor/vulcan:core'; diff --git a/packages/vulcan-forms/lib/components/bootstrap/Number.jsx b/packages/vulcan-forms/lib/components/bootstrap/Number.jsx index a04013b4f..12cdaf051 100644 --- a/packages/vulcan-forms/lib/components/bootstrap/Number.jsx +++ b/packages/vulcan-forms/lib/components/bootstrap/Number.jsx @@ -1,5 +1,4 @@ import React from 'react'; -import PropTypes from 'prop-types'; import { Input } from 'formsy-react-components'; import { registerComponent } from 'meteor/vulcan:core'; diff --git a/packages/vulcan-forms/lib/components/bootstrap/Radiogroup.jsx b/packages/vulcan-forms/lib/components/bootstrap/Radiogroup.jsx index 0adee1809..ab1b613f8 100644 --- a/packages/vulcan-forms/lib/components/bootstrap/Radiogroup.jsx +++ b/packages/vulcan-forms/lib/components/bootstrap/Radiogroup.jsx @@ -1,5 +1,4 @@ import React from 'react'; -import PropTypes from 'prop-types'; import { RadioGroup } from 'formsy-react-components'; import { registerComponent } from 'meteor/vulcan:core'; diff --git a/packages/vulcan-forms/lib/components/bootstrap/Select.jsx b/packages/vulcan-forms/lib/components/bootstrap/Select.jsx index aab098e04..0f4ba0b3a 100644 --- a/packages/vulcan-forms/lib/components/bootstrap/Select.jsx +++ b/packages/vulcan-forms/lib/components/bootstrap/Select.jsx @@ -1,5 +1,4 @@ import React from 'react'; -import PropTypes from 'prop-types'; import { Select } from 'formsy-react-components'; import { registerComponent } from 'meteor/vulcan:core'; diff --git a/packages/vulcan-forms/lib/components/bootstrap/Textarea.jsx b/packages/vulcan-forms/lib/components/bootstrap/Textarea.jsx index 1898baeef..8d9bb5a05 100644 --- a/packages/vulcan-forms/lib/components/bootstrap/Textarea.jsx +++ b/packages/vulcan-forms/lib/components/bootstrap/Textarea.jsx @@ -1,5 +1,4 @@ import React from 'react'; -import PropTypes from 'prop-types'; import { Textarea } from 'formsy-react-components'; import { registerComponent } from 'meteor/vulcan:core'; diff --git a/packages/vulcan-forms/lib/components/bootstrap/Url.jsx b/packages/vulcan-forms/lib/components/bootstrap/Url.jsx index 7886803b3..fdf07704a 100644 --- a/packages/vulcan-forms/lib/components/bootstrap/Url.jsx +++ b/packages/vulcan-forms/lib/components/bootstrap/Url.jsx @@ -1,5 +1,4 @@ import React from 'react'; -import PropTypes from 'prop-types'; import { Input } from 'formsy-react-components'; import { registerComponent } from 'meteor/vulcan:core'; From 4a3f9ae1ef6247fa8bf12237ab9d086a343fcb5a Mon Sep 17 00:00:00 2001 From: Justin Reynolds Date: Thu, 25 Jan 2018 13:37:48 -0600 Subject: [PATCH 05/12] Only show admin menu to admins --- .../example-forum/lib/components/users/UsersMenu.jsx | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/packages/example-forum/lib/components/users/UsersMenu.jsx b/packages/example-forum/lib/components/users/UsersMenu.jsx index 6ece5f5a6..2cf9fcc65 100644 --- a/packages/example-forum/lib/components/users/UsersMenu.jsx +++ b/packages/example-forum/lib/components/users/UsersMenu.jsx @@ -24,9 +24,13 @@ const UsersMenu = ({currentUser, client}) => - - Admin - + Users.isAdmin(currentUser)} + > + + Admin + + Meteor.logout(() => client.resetStore())}> From 30b62cd33a8acc92b685aa6c6ebcf8d00d029a57 Mon Sep 17 00:00:00 2001 From: Justin Reynolds Date: Thu, 25 Jan 2018 13:39:58 -0600 Subject: [PATCH 06/12] Only show PostsNewButton if check passes --- packages/example-forum/lib/components/common/Header.jsx | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/packages/example-forum/lib/components/common/Header.jsx b/packages/example-forum/lib/components/common/Header.jsx index 6026f32ef..ade8cd5cb 100644 --- a/packages/example-forum/lib/components/common/Header.jsx +++ b/packages/example-forum/lib/components/common/Header.jsx @@ -1,8 +1,9 @@ import React from 'react'; import PropTypes from 'prop-types'; import { withCurrentUser, getSetting, registerSetting, Components, registerComponent } from 'meteor/vulcan:core'; +import { Posts } from '../../modules/posts/index.js'; -const Header = (props, context) => { +const Header = (props) => { const logoUrl = getSetting('logoUrl'); const siteTitle = getSetting('title', 'My App'); @@ -25,7 +26,9 @@ const Header = (props, context) => {
- + + +
From d4ecf1b0fe6e8341511c3a5fa7061e7fd9408adf Mon Sep 17 00:00:00 2001 From: Justin Reynolds Date: Thu, 25 Jan 2018 13:43:35 -0600 Subject: [PATCH 07/12] Allow Intercom widget url to be customizable --- .../vulcan-events-intercom/lib/client/intercom-client.js | 4 ++-- sample_settings.json | 6 +++++- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/packages/vulcan-events-intercom/lib/client/intercom-client.js b/packages/vulcan-events-intercom/lib/client/intercom-client.js index 5767b30f1..49bb89e1f 100644 --- a/packages/vulcan-events-intercom/lib/client/intercom-client.js +++ b/packages/vulcan-events-intercom/lib/client/intercom-client.js @@ -35,7 +35,7 @@ function intercomIdentify(currentUser) { var s = d.createElement('script'); s.type = 'text/javascript'; s.async = true; - s.src = 'https://widget.intercom.io/widget/icygo7se'; + s.src = getSetting('intercom.widgetUrl', 'https://widget.intercom.io/widget/icygo7se'); var x = d.getElementsByTagName('script')[0]; x.parentNode.insertBefore(s, x); } @@ -88,7 +88,7 @@ function intercomInit() { var s = d.createElement('script'); s.type = 'text/javascript'; s.async = true; - s.src = 'https://widget.intercom.io/widget/icygo7se'; + s.src = getSetting('intercom.widgetUrl', 'https://widget.intercom.io/widget/icygo7se'); var x = d.getElementsByTagName('script')[0]; x.parentNode.insertBefore(s, x); } diff --git a/sample_settings.json b/sample_settings.json index 1fff16794..c87fa1c0a 100644 --- a/sample_settings.json +++ b/sample_settings.json @@ -15,7 +15,11 @@ "twitterAccount": "foo", "facebookPage": "http://facebook.com/foo", - "googleAnalyticsId":"123foo" + "googleAnalyticsId": "123foo", + + "intercom": { + "widgetUrl": "https://widget.intercom.io/widget/icygo7se" + } }, From 797aec51e33bccd903c78a2a1e327d6767b8f369 Mon Sep 17 00:00:00 2001 From: Justin Reynolds Date: Thu, 25 Jan 2018 13:47:37 -0600 Subject: [PATCH 08/12] Fix PostsCategoryParameter callback not setting enableCache --- packages/example-forum/lib/modules/categories/parameters.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/example-forum/lib/modules/categories/parameters.js b/packages/example-forum/lib/modules/categories/parameters.js index 8bfa82aa2..01dd0ec96 100644 --- a/packages/example-forum/lib/modules/categories/parameters.js +++ b/packages/example-forum/lib/modules/categories/parameters.js @@ -25,7 +25,7 @@ function PostsCategoryParameter(parameters, terms, apolloClient) { // note: specify all arguments, see https://github.com/apollographql/apollo-client/issues/2051 const query = ` query GetCategories($terms: JSON) { - CategoriesList(terms: $terms) { + CategoriesList(terms: $terms, enableCache: $enableCache) { _id slug } @@ -36,7 +36,7 @@ function PostsCategoryParameter(parameters, terms, apolloClient) { // get categories from Redux store allCategories = apolloClient.readQuery({ query: gql`${query}`, - variables: {terms: {limit: 0, itemsPerPage: 0}} + variables: {terms: {limit: 0, itemsPerPage: 0}, enableCache: false} }).CategoriesList; } else { // TODO: figure out how to make this async without messing up withList on the client From a2ef4cc6c70d776f0b5962fc75861316590004ee Mon Sep 17 00:00:00 2001 From: Justin Reynolds Date: Thu, 25 Jan 2018 13:59:27 -0600 Subject: [PATCH 09/12] Fix categories missing on new post from individual user page --- .../lib/components/posts/PostsNewForm.jsx | 38 ++++++++++++++++--- 1 file changed, 33 insertions(+), 5 deletions(-) diff --git a/packages/example-forum/lib/components/posts/PostsNewForm.jsx b/packages/example-forum/lib/components/posts/PostsNewForm.jsx index dfa61b51f..dde4fb7b2 100644 --- a/packages/example-forum/lib/components/posts/PostsNewForm.jsx +++ b/packages/example-forum/lib/components/posts/PostsNewForm.jsx @@ -1,14 +1,32 @@ -import { Components, registerComponent, getRawComponent, getFragment, withMessages } from 'meteor/vulcan:core'; +import { + Components, + registerComponent, + getRawComponent, + getFragment, + withMessages, + withList, +} from 'meteor/vulcan:core'; import { Posts } from '../../modules/posts/index.js'; import React from 'react'; import PropTypes from 'prop-types'; import { intlShape, FormattedMessage } from 'meteor/vulcan:i18n'; import { withRouter } from 'react-router' -const PostsNewForm = (props, context) => - { + if (props.loading) { + return
; + } + return ( +

} + failureComponent={ +
+

+ +

+ +
+ } >
/>
+ ); +}; PostsNewForm.propTypes = { closeModal: PropTypes.func, @@ -37,4 +57,12 @@ PostsNewForm.contextTypes = { PostsNewForm.displayName = "PostsNewForm"; -registerComponent('PostsNewForm', PostsNewForm, withRouter, withMessages); +const options = { + collectionName: 'Categories', + queryName: 'categoriesListQuery', + fragmentName: 'CategoriesList', + limit: 0, + pollInterval: 0, +}; + +registerComponent('PostsNewForm', PostsNewForm, withRouter, withMessages, [withList, options]); From 04789bad94605c4fa8b1b7e88196d4e71bf6fca3 Mon Sep 17 00:00:00 2001 From: Justin Reynolds Date: Thu, 25 Jan 2018 14:00:51 -0600 Subject: [PATCH 10/12] Fix incorrect i18n email required key --- packages/vulcan-i18n-en-us/lib/en_US.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/vulcan-i18n-en-us/lib/en_US.js b/packages/vulcan-i18n-en-us/lib/en_US.js index 7adc261c7..ea5a0086b 100644 --- a/packages/vulcan-i18n-en-us/lib/en_US.js +++ b/packages/vulcan-i18n-en-us/lib/en_US.js @@ -2,7 +2,7 @@ import { addStrings } from 'meteor/vulcan:core'; addStrings('en', { - "accounts.error_emailRequired": "Email required", + "accounts.error_email_required": "Email required", "accounts.error_email_already_exists": "Email already exists", "accounts.error_invalid_email": "Invalid email", "accounts.error_minchar": "Your password is too short", From e25c95b0aa375ef089280369c9dea5a4eef877f7 Mon Sep 17 00:00:00 2001 From: Justin Reynolds Date: Thu, 25 Jan 2018 14:12:29 -0600 Subject: [PATCH 11/12] Fix CommentsItem flash prop --- .../example-forum/lib/components/comments/CommentsItem.jsx | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/packages/example-forum/lib/components/comments/CommentsItem.jsx b/packages/example-forum/lib/components/comments/CommentsItem.jsx index 60659c100..4cf1a60ed 100644 --- a/packages/example-forum/lib/components/comments/CommentsItem.jsx +++ b/packages/example-forum/lib/components/comments/CommentsItem.jsx @@ -125,6 +125,7 @@ class CommentsItem extends PureComponent { CommentsItem.propTypes = { comment: PropTypes.object.isRequired, // the current comment currentUser: PropTypes.object, + flash: PropTypes.func, }; CommentsItem.contextTypes = { @@ -132,4 +133,4 @@ CommentsItem.contextTypes = { intl: intlShape }; -registerComponent('CommentsItem', CommentsItem); +registerComponent('CommentsItem', CommentsItem, withMessages); From 75b6ece0a43fd9840edf90a33157a64d63534dbb Mon Sep 17 00:00:00 2001 From: Justin Reynolds Date: Thu, 25 Jan 2018 15:03:03 -0600 Subject: [PATCH 12/12] Fix linting --- package-lock.json | 22 ++++++++ package.json | 1 + .../lib/components/common/Header.jsx | 2 +- .../lib/components/common/Newsletter.jsx | 2 +- .../lib/components/posts/PostsDailyList.jsx | 2 +- .../lib/components/posts/PostsEditForm.jsx | 2 +- .../lib/components/posts/PostsPage.jsx | 2 +- .../lib/components/users/UsersProfile.jsx | 2 +- .../lib/modules/categories/parameters.js | 2 +- .../lib/modules/posts/newsletter.js | 2 + .../lib/server/posts/callbacks/embedly.js | 4 +- .../lib/server/posts/callbacks/other.js | 14 ++--- .../example-forum/lib/server/posts/out.js | 9 ++- .../lib/server/seed/seed_categories.js | 2 + .../lib/server/seed/seed_posts.js | 5 ++ .../lib/components/pics/PicsNewForm.jsx | 2 +- packages/example-instagram/lib/server/seed.js | 4 +- .../example-interfaces/lib/server/seed.js | 2 + .../lib/components/common/Layout.jsx | 1 - .../lib/components/pics/PicsNewForm.jsx | 2 +- .../example-membership/lib/server/seed.js | 3 +- packages/example-movies/lib/server/seed.js | 2 + .../example-permissions/lib/server/seed.js | 4 +- packages/example-reactions/lib/server/seed.js | 2 + packages/example-simple/lib/server/seed.js | 2 + .../vulcan-accounts/imports/accounts_ui.js | 7 +-- packages/vulcan-accounts/imports/helpers.js | 26 +++++---- .../vulcan-accounts/imports/login_session.js | 15 ++--- .../imports/ui/components/Button.jsx | 14 ++--- .../imports/ui/components/Buttons.jsx | 2 +- .../imports/ui/components/EnrollAccount.jsx | 1 - .../imports/ui/components/Field.jsx | 2 +- .../imports/ui/components/Form.jsx | 10 ++-- .../imports/ui/components/FormMessage.jsx | 3 +- .../imports/ui/components/FormMessages.jsx | 6 +- .../imports/ui/components/LoginForm.jsx | 46 +++++++++------- .../ui/components/PasswordOrService.jsx | 2 +- .../imports/ui/components/ResetPassword.jsx | 1 - packages/vulcan-accounts/main_client.js | 2 +- packages/vulcan-accounts/main_server.js | 2 +- .../lib/modules/components/App.jsx | 1 - .../lib/modules/components/DynamicLoading.jsx | 3 +- .../lib/modules/containers/withDocument.js | 2 +- .../lib/modules/containers/withList.js | 1 + .../vulcan-debug/lib/components/Callbacks.jsx | 1 - .../vulcan-debug/lib/components/Settings.jsx | 1 - packages/vulcan-email/lib/server/email.js | 1 + .../lib/server/integrations/builtin.js | 1 + .../lib/server/integrations/embedly.js | 7 ++- packages/vulcan-embed/lib/server/mutations.js | 9 ++- .../lib/client/intercom-client.js | 14 ++++- .../lib/server/intercom-server.js | 13 ++++- .../lib/client/internal-client.js | 3 +- .../lib/client/segment-client.js | 7 ++- .../lib/server/segment-server.js | 10 +++- packages/vulcan-forms-upload/lib/Upload.jsx | 1 + packages/vulcan-forms/lib/components/Form.jsx | 11 +++- .../lib/components/FormComponent.jsx | 3 +- .../lib/components/FormWrapper.jsx | 2 +- packages/vulcan-i18n/lib/modules/index.js | 1 - packages/vulcan-i18n/lib/modules/message.js | 4 +- packages/vulcan-i18n/lib/modules/provider.js | 5 +- packages/vulcan-i18n/lib/modules/shape.js | 2 +- packages/vulcan-lib/lib/modules/apollo.js | 2 +- packages/vulcan-lib/lib/modules/callbacks.js | 3 + .../vulcan-lib/lib/modules/collections.js | 2 +- packages/vulcan-lib/lib/modules/config.js | 3 + packages/vulcan-lib/lib/modules/debug.js | 3 + packages/vulcan-lib/lib/modules/graphql.js | 1 + packages/vulcan-lib/lib/modules/utils.js | 3 +- packages/vulcan-lib/lib/modules/validation.js | 6 +- .../vulcan-lib/lib/server/meteor_patch.js | 3 - packages/vulcan-lib/lib/server/mutations.js | 6 +- packages/vulcan-lib/lib/server/query.js | 1 + packages/vulcan-lib/lib/server/site.js | 2 +- .../lib/server/integrations/sample.js | 14 +++-- .../lib/server/integrations/sendy.js | 18 ++++-- .../lib/server/newsletters.js | 23 +++++--- .../lib/components/Checkout.jsx | 7 ++- .../lib/server/integrations/stripe.js | 55 ++++++++++++------- packages/vulcan-users/lib/avatar.js | 3 +- packages/vulcan-users/lib/resolvers.js | 1 - .../lib/modules/make_voteable.js | 2 + packages/vulcan-voting/lib/modules/vote.js | 2 +- .../lib/modules/votes/collection.js | 2 +- .../vulcan-voting/lib/server/callbacks.js | 8 +-- packages/vulcan-voting/lib/server/graphql.js | 2 +- 87 files changed, 322 insertions(+), 189 deletions(-) diff --git a/package-lock.json b/package-lock.json index df2d8b26a..d213c5c40 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1922,6 +1922,16 @@ } } }, + "eslint-plugin-prettier": { + "version": "2.5.0", + "resolved": "https://registry.npmjs.org/eslint-plugin-prettier/-/eslint-plugin-prettier-2.5.0.tgz", + "integrity": "sha512-L06bewYpt2Wb8Uk7os8f/0cL5DjddL38t1M/nOpjw5MqVFBn1RIIBBE6tfr37lHUH7AvAubZsvu/bDmNl4RBKQ==", + "dev": true, + "requires": { + "fast-diff": "1.1.2", + "jest-docblock": "21.2.0" + } + }, "eslint-plugin-react": { "version": "6.10.3", "resolved": "https://registry.npmjs.org/eslint-plugin-react/-/eslint-plugin-react-6.10.3.tgz", @@ -2099,6 +2109,12 @@ "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-1.0.0.tgz", "integrity": "sha1-liVqO8l1WV6zbYLpkp0GDYk0Of8=" }, + "fast-diff": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/fast-diff/-/fast-diff-1.1.2.tgz", + "integrity": "sha512-KaJUt+M9t1qaIteSvjc6P3RbMdXsNhK61GRftR6SNxqmhthcd9MGIi4T+o0jD8LUSpSnSKXE20nLtJ3fOHxQig==", + "dev": true + }, "fast-json-stable-stringify": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/fast-json-stable-stringify/-/fast-json-stable-stringify-2.0.0.tgz", @@ -2989,6 +3005,12 @@ "resolved": "https://registry.npmjs.org/iterall/-/iterall-1.1.3.tgz", "integrity": "sha512-Cu/kb+4HiNSejAPhSaN1VukdNTTi/r4/e+yykqjlG/IW+1gZH5b4+Bq3whDX4tvbYugta3r8KTMUiqT3fIGxuQ==" }, + "jest-docblock": { + "version": "21.2.0", + "resolved": "https://registry.npmjs.org/jest-docblock/-/jest-docblock-21.2.0.tgz", + "integrity": "sha512-5IZ7sY9dBAYSV+YjQ0Ovb540Ku7AO9Z5o2Cg789xj167iQuZ2cG+z0f3Uct6WeYLbU6aQiM2pCs7sZ+4dotydw==", + "dev": true + }, "join-component": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/join-component/-/join-component-1.1.0.tgz", diff --git a/package.json b/package.json index 5c1f69888..cbf475a80 100644 --- a/package.json +++ b/package.json @@ -97,6 +97,7 @@ "eslint-plugin-import": "^2.2.0", "eslint-plugin-jsx-a11y": "^2.2.3", "eslint-plugin-meteor": "^4.0.1", + "eslint-plugin-prettier": "^2.5.0", "eslint-plugin-react": "^6.7.1" }, "postcss": { diff --git a/packages/example-forum/lib/components/common/Header.jsx b/packages/example-forum/lib/components/common/Header.jsx index ade8cd5cb..b0a90d169 100644 --- a/packages/example-forum/lib/components/common/Header.jsx +++ b/packages/example-forum/lib/components/common/Header.jsx @@ -1,6 +1,6 @@ import React from 'react'; import PropTypes from 'prop-types'; -import { withCurrentUser, getSetting, registerSetting, Components, registerComponent } from 'meteor/vulcan:core'; +import { withCurrentUser, getSetting, Components, registerComponent } from 'meteor/vulcan:core'; import { Posts } from '../../modules/posts/index.js'; const Header = (props) => { diff --git a/packages/example-forum/lib/components/common/Newsletter.jsx b/packages/example-forum/lib/components/common/Newsletter.jsx index b780f021e..ea8708fc4 100644 --- a/packages/example-forum/lib/components/common/Newsletter.jsx +++ b/packages/example-forum/lib/components/common/Newsletter.jsx @@ -1,4 +1,4 @@ -import { Components, registerComponent, withCurrentUser, withMutation, withMessages, Utils } from 'meteor/vulcan:core'; +import { Components, registerComponent, withCurrentUser, withMutation, withMessages } from 'meteor/vulcan:core'; import React, { PureComponent } from 'react'; import PropTypes from 'prop-types'; import { FormattedMessage, intlShape } from 'meteor/vulcan:i18n'; diff --git a/packages/example-forum/lib/components/posts/PostsDailyList.jsx b/packages/example-forum/lib/components/posts/PostsDailyList.jsx index 3a4dbdeae..7fbd6dbec 100644 --- a/packages/example-forum/lib/components/posts/PostsDailyList.jsx +++ b/packages/example-forum/lib/components/posts/PostsDailyList.jsx @@ -3,7 +3,7 @@ import PropTypes from 'prop-types'; import moment from 'moment'; import { FormattedMessage } from 'meteor/vulcan:i18n'; import { Posts } from '../../modules/posts/index.js'; -import { withCurrentUser, withList, getSetting, registerSetting, Components, getRawComponent, registerComponent } from 'meteor/vulcan:core'; +import { withCurrentUser, withList, getSetting, Components, getRawComponent, registerComponent } from 'meteor/vulcan:core'; class PostsDailyList extends PureComponent { diff --git a/packages/example-forum/lib/components/posts/PostsEditForm.jsx b/packages/example-forum/lib/components/posts/PostsEditForm.jsx index f2245f95b..cb491aead 100644 --- a/packages/example-forum/lib/components/posts/PostsEditForm.jsx +++ b/packages/example-forum/lib/components/posts/PostsEditForm.jsx @@ -1,6 +1,6 @@ import React, { PureComponent } from 'react'; import PropTypes from 'prop-types'; -import { Components, registerComponent, getFragment, withMessages, withCurrentUser } from 'meteor/vulcan:core'; +import { Components, registerComponent, withMessages, withCurrentUser } from 'meteor/vulcan:core'; import { intlShape } from 'meteor/vulcan:i18n'; import { Posts } from '../../modules/posts/index.js'; import Users from "meteor/vulcan:users"; diff --git a/packages/example-forum/lib/components/posts/PostsPage.jsx b/packages/example-forum/lib/components/posts/PostsPage.jsx index 8a68059e7..c3ebbce55 100644 --- a/packages/example-forum/lib/components/posts/PostsPage.jsx +++ b/packages/example-forum/lib/components/posts/PostsPage.jsx @@ -15,7 +15,7 @@ class PostsPage extends Component { } else if (!this.props.document) { - console.log(`// missing post (_id: ${this.props.documentId})`); + // console.log(`// missing post (_id: ${this.props.documentId})`); return
} else { diff --git a/packages/example-forum/lib/components/users/UsersProfile.jsx b/packages/example-forum/lib/components/users/UsersProfile.jsx index f6af377ac..0b6420984 100644 --- a/packages/example-forum/lib/components/users/UsersProfile.jsx +++ b/packages/example-forum/lib/components/users/UsersProfile.jsx @@ -11,7 +11,7 @@ const UsersProfile = (props) => { } else if (!props.document) { - console.log(`// missing user (_id/slug: ${props.documentId || props.slug})`); + // console.log(`// missing user (_id/slug: ${props.documentId || props.slug})`); return
} else { diff --git a/packages/example-forum/lib/modules/categories/parameters.js b/packages/example-forum/lib/modules/categories/parameters.js index 01dd0ec96..103a14291 100644 --- a/packages/example-forum/lib/modules/categories/parameters.js +++ b/packages/example-forum/lib/modules/categories/parameters.js @@ -4,7 +4,7 @@ Categories parameter */ -import { addCallback, getSetting, registerSetting, getFragment, runQuery } from 'meteor/vulcan:core'; +import { addCallback, getSetting, registerSetting } from 'meteor/vulcan:core'; import gql from 'graphql-tag'; import { Categories } from './collection.js'; diff --git a/packages/example-forum/lib/modules/posts/newsletter.js b/packages/example-forum/lib/modules/posts/newsletter.js index 24ecf5607..cb66bfd94 100644 --- a/packages/example-forum/lib/modules/posts/newsletter.js +++ b/packages/example-forum/lib/modules/posts/newsletter.js @@ -84,8 +84,10 @@ VulcanEmail.addEmails({ function MarkPostsAsScheduled (email) { const postsIds = _.pluck(email.data.PostsList, '_id'); + // eslint-disable-next-line no-console console.log(postsIds) const updated = Posts.update({_id: {$in: postsIds}}, {$set: {scheduledAt: new Date()}}, {multi: true}) // eslint-disable-line + // eslint-disable-next-line no-console console.log(`updated ${updated} posts`) } addCallback('newsletter.send.async', MarkPostsAsScheduled); diff --git a/packages/example-forum/lib/server/posts/callbacks/embedly.js b/packages/example-forum/lib/server/posts/callbacks/embedly.js index 6c0438091..5959ec11a 100644 --- a/packages/example-forum/lib/server/posts/callbacks/embedly.js +++ b/packages/example-forum/lib/server/posts/callbacks/embedly.js @@ -4,7 +4,7 @@ Callbacks to add media/thumbnail after submit and on edit */ -import { addCallback, getSetting, registerSetting } from 'meteor/vulcan:core'; +import { addCallback, getSetting } from 'meteor/vulcan:core'; import Embed from 'meteor/vulcan:embed'; const embedProvider = getSetting('embedProvider'); @@ -74,6 +74,8 @@ function updateMediaOnEdit (modifier, post) { } addCallback('posts.edit.sync', updateMediaOnEdit); +const addMediaAfterSubmit = AddMediaAfterSubmit; + const regenerateThumbnail = function (post) { delete post.thumbnailUrl; delete post.media; diff --git a/packages/example-forum/lib/server/posts/callbacks/other.js b/packages/example-forum/lib/server/posts/callbacks/other.js index ce7fdf4b9..e2e97eea2 100644 --- a/packages/example-forum/lib/server/posts/callbacks/other.js +++ b/packages/example-forum/lib/server/posts/callbacks/other.js @@ -83,13 +83,13 @@ addCallback('users.remove.async', UsersRemoveDeletePosts); // * @param {string} ip – the IP of the current user // */ Posts.increaseClicks = (post, ip) => { - const clickEvent = { - name: 'click', - properties: { - postId: post._id, - ip: ip - } - }; + // const clickEvent = { + // name: 'click', + // properties: { + // postId: post._id, + // ip: ip + // } + // }; if (getSetting('forum.trackClickEvents', true)) { // make sure this IP hasn't previously clicked on this post diff --git a/packages/example-forum/lib/server/posts/out.js b/packages/example-forum/lib/server/posts/out.js index 64b80961b..9a668e791 100644 --- a/packages/example-forum/lib/server/posts/out.js +++ b/packages/example-forum/lib/server/posts/out.js @@ -31,9 +31,12 @@ Picker.route('/out', ({ query}, req, res, next) => { res.end(`Invalid URL: ${query.url}`); } } catch (error) { - console.log('// /out error') - console.log(error) - console.log(query) + // eslint-disable-next-line no-console + console.log('// /out error'); + // eslint-disable-next-line no-console + console.log(error); + // eslint-disable-next-line no-console + console.log(query); } } else { res.end("Please provide a URL"); diff --git a/packages/example-forum/lib/server/seed/seed_categories.js b/packages/example-forum/lib/server/seed/seed_categories.js index 8b05db660..2f141360d 100644 --- a/packages/example-forum/lib/server/seed/seed_categories.js +++ b/packages/example-forum/lib/server/seed/seed_categories.js @@ -69,10 +69,12 @@ if (getSetting('forum.seedOnStart')) { }); // Categories.insert(category); + // eslint-disable-next-line no-console console.log(`// Creating category “${category.name}”`); // eslint-disable-line } }); } else if (!Categories.find().count()) { + // eslint-disable-next-line no-console console.log('// inserting dummy categories'); // else if there are no categories yet, create dummy categories dummyCategories.forEach(category => { diff --git a/packages/example-forum/lib/server/seed/seed_posts.js b/packages/example-forum/lib/server/seed/seed_posts.js index 82ff1ce0a..39ea67aae 100644 --- a/packages/example-forum/lib/server/seed/seed_posts.js +++ b/packages/example-forum/lib/server/seed/seed_posts.js @@ -1,3 +1,4 @@ +/* global Vulcan */ import { newMutation, registerSetting, getSetting } from 'meteor/vulcan:core'; import moment from 'moment'; import { Posts } from '../../modules/posts/index.js'; @@ -96,6 +97,7 @@ if (getSetting('forum.seedOnStart')) { } var createDummyUsers = function () { + // eslint-disable-next-line no-console console.log('// inserting dummy users…'); createUser('Bruce', 'dummyuser1@telescopeapp.org'); createUser('Arnold', 'dummyuser2@telescopeapp.org'); @@ -103,6 +105,7 @@ if (getSetting('forum.seedOnStart')) { }; var createDummyPosts = function () { + // eslint-disable-next-line no-console console.log('// inserting dummy posts'); createPost("read_this_first", moment().toDate(), "Bruce", "telescope.png"); @@ -118,6 +121,7 @@ if (getSetting('forum.seedOnStart')) { }; var createDummyComments = function () { + // eslint-disable-next-line no-console console.log('// inserting dummy comments…'); createComment("read_this_first", "Bruce", "What an awesome app!"); @@ -137,6 +141,7 @@ if (getSetting('forum.seedOnStart')) { Posts.remove({isDummy: true}); Comments.remove({isDummy: true}); Categories.remove({isDummy: true}); + // eslint-disable-next-line no-console console.log('// Getting started content removed'); }; diff --git a/packages/example-instagram/lib/components/pics/PicsNewForm.jsx b/packages/example-instagram/lib/components/pics/PicsNewForm.jsx index 32e2c8cd1..fcba39ed9 100644 --- a/packages/example-instagram/lib/components/pics/PicsNewForm.jsx +++ b/packages/example-instagram/lib/components/pics/PicsNewForm.jsx @@ -8,7 +8,7 @@ to check if the user has the proper permissions to actually insert a new picture */ import React from 'react'; -import { Components, registerComponent, withCurrentUser, getFragment } from 'meteor/vulcan:core'; +import { Components, registerComponent, getFragment } from 'meteor/vulcan:core'; import Pics from '../../modules/pics/collection.js'; diff --git a/packages/example-instagram/lib/server/seed.js b/packages/example-instagram/lib/server/seed.js index 90ded057f..9b5a13ccd 100644 --- a/packages/example-instagram/lib/server/seed.js +++ b/packages/example-instagram/lib/server/seed.js @@ -8,7 +8,6 @@ import Pics from '../modules/pics/collection.js'; import Comments from '../modules/comments/collection.js'; import Users from 'meteor/vulcan:users'; import { newMutation } from 'meteor/vulcan:core'; -import { Accounts } from 'meteor/accounts-base'; import moment from 'moment'; const dummyFlag = { @@ -77,6 +76,7 @@ const createUser = function (username, email) { } var createDummyUsers = function () { + // eslint-disable-next-line no-console console.log('// inserting dummy users…'); createUser('Bruce', 'dummyuser1@telescopeapp.org'); createUser('Arnold', 'dummyuser2@telescopeapp.org'); @@ -84,6 +84,7 @@ var createDummyUsers = function () { }; const createDummyPics = function () { + // eslint-disable-next-line no-console console.log('// creating dummy pics…'); createPic('cherry_blossoms.jpg', moment().toDate(), `Kyoto's cherry blossoms`, 'Bruce'); createPic('koyo.jpg', moment().subtract(10, 'minutes').toDate(), `Red maple leaves during Fall.`, 'Arnold'); @@ -97,6 +98,7 @@ const createDummyPics = function () { }; const createDummyComments = function () { + // eslint-disable-next-line no-console console.log('// creating dummy comments'); createComment('Bruce', 'Great job.'); createComment('Arnold', 'I would love to go there…'); diff --git a/packages/example-interfaces/lib/server/seed.js b/packages/example-interfaces/lib/server/seed.js index 10c20892f..4a1e35906 100644 --- a/packages/example-interfaces/lib/server/seed.js +++ b/packages/example-interfaces/lib/server/seed.js @@ -72,6 +72,7 @@ const createUser = function (username, email) { } var createDummyUsers = function () { + // eslint-disable-next-line no-console console.log('// inserting dummy users…'); createUser('Bruce', 'dummyuser1@telescopeapp.org'); createUser('Arnold', 'dummyuser2@telescopeapp.org'); @@ -84,6 +85,7 @@ Meteor.startup(function () { } const currentUser = Users.findOne(); // just get the first user available if (Categories.find().fetch().length === 0) { + // eslint-disable-next-line no-console console.log('// creating dummy categories'); seedData.forEach(document => { newMutation({ diff --git a/packages/example-membership/lib/components/common/Layout.jsx b/packages/example-membership/lib/components/common/Layout.jsx index 2a52ab948..d2cd8be46 100644 --- a/packages/example-membership/lib/components/common/Layout.jsx +++ b/packages/example-membership/lib/components/common/Layout.jsx @@ -11,7 +11,6 @@ Note: the Helmet library is used to insert meta tags and link tags in the import React from 'react'; import Helmet from 'react-helmet'; -import Header from './Header.jsx'; import { replaceComponent, Components } from 'meteor/vulcan:core'; // note: modal popups won't work with anything above bootstrap alpha.5. diff --git a/packages/example-membership/lib/components/pics/PicsNewForm.jsx b/packages/example-membership/lib/components/pics/PicsNewForm.jsx index 32e2c8cd1..fcba39ed9 100644 --- a/packages/example-membership/lib/components/pics/PicsNewForm.jsx +++ b/packages/example-membership/lib/components/pics/PicsNewForm.jsx @@ -8,7 +8,7 @@ to check if the user has the proper permissions to actually insert a new picture */ import React from 'react'; -import { Components, registerComponent, withCurrentUser, getFragment } from 'meteor/vulcan:core'; +import { Components, registerComponent, getFragment } from 'meteor/vulcan:core'; import Pics from '../../modules/pics/collection.js'; diff --git a/packages/example-membership/lib/server/seed.js b/packages/example-membership/lib/server/seed.js index 1457c8464..5bcc3ea7b 100644 --- a/packages/example-membership/lib/server/seed.js +++ b/packages/example-membership/lib/server/seed.js @@ -7,7 +7,6 @@ Seed the database with some dummy content. import Pics from '../modules/pics/collection.js'; import Users from 'meteor/vulcan:users'; import { newMutation } from 'meteor/vulcan:core'; -import { Accounts } from 'meteor/accounts-base'; import moment from 'moment'; const dummyFlag = { @@ -56,6 +55,7 @@ const createUser = function (username, email) { } var createDummyUsers = function () { + // eslint-disable-next-line no-console console.log('// inserting dummy users…'); createUser('Bruce', 'dummyuser1@telescopeapp.org'); createUser('Arnold', 'dummyuser2@telescopeapp.org'); @@ -63,6 +63,7 @@ var createDummyUsers = function () { }; const createDummyPics = function () { + // eslint-disable-next-line no-console console.log('// creating dummy pics…'); createPic('cherry_blossoms.jpg', moment().toDate(), `Kyoto's cherry blossoms`, 'Bruce'); createPic('koyo.jpg', moment().subtract(10, 'minutes').toDate(), `Red maple leaves during Fall.`, 'Arnold'); diff --git a/packages/example-movies/lib/server/seed.js b/packages/example-movies/lib/server/seed.js index 8fcefbe10..718dfb869 100644 --- a/packages/example-movies/lib/server/seed.js +++ b/packages/example-movies/lib/server/seed.js @@ -69,6 +69,7 @@ const createUser = function (username, email) { } var createDummyUsers = function () { + // eslint-disable-next-line no-console console.log('// inserting dummy users…'); createUser('Bruce', 'dummyuser1@telescopeapp.org'); createUser('Arnold', 'dummyuser2@telescopeapp.org'); @@ -81,6 +82,7 @@ Meteor.startup(function () { } const currentUser = Users.findOne(); // just get the first user available if (Movies.find().fetch().length === 0) { + // eslint-disable-next-line no-console console.log('// creating dummy movies'); seedData.forEach(document => { newMutation({ diff --git a/packages/example-permissions/lib/server/seed.js b/packages/example-permissions/lib/server/seed.js index 90ded057f..9b5a13ccd 100644 --- a/packages/example-permissions/lib/server/seed.js +++ b/packages/example-permissions/lib/server/seed.js @@ -8,7 +8,6 @@ import Pics from '../modules/pics/collection.js'; import Comments from '../modules/comments/collection.js'; import Users from 'meteor/vulcan:users'; import { newMutation } from 'meteor/vulcan:core'; -import { Accounts } from 'meteor/accounts-base'; import moment from 'moment'; const dummyFlag = { @@ -77,6 +76,7 @@ const createUser = function (username, email) { } var createDummyUsers = function () { + // eslint-disable-next-line no-console console.log('// inserting dummy users…'); createUser('Bruce', 'dummyuser1@telescopeapp.org'); createUser('Arnold', 'dummyuser2@telescopeapp.org'); @@ -84,6 +84,7 @@ var createDummyUsers = function () { }; const createDummyPics = function () { + // eslint-disable-next-line no-console console.log('// creating dummy pics…'); createPic('cherry_blossoms.jpg', moment().toDate(), `Kyoto's cherry blossoms`, 'Bruce'); createPic('koyo.jpg', moment().subtract(10, 'minutes').toDate(), `Red maple leaves during Fall.`, 'Arnold'); @@ -97,6 +98,7 @@ const createDummyPics = function () { }; const createDummyComments = function () { + // eslint-disable-next-line no-console console.log('// creating dummy comments'); createComment('Bruce', 'Great job.'); createComment('Arnold', 'I would love to go there…'); diff --git a/packages/example-reactions/lib/server/seed.js b/packages/example-reactions/lib/server/seed.js index 8fcefbe10..718dfb869 100644 --- a/packages/example-reactions/lib/server/seed.js +++ b/packages/example-reactions/lib/server/seed.js @@ -69,6 +69,7 @@ const createUser = function (username, email) { } var createDummyUsers = function () { + // eslint-disable-next-line no-console console.log('// inserting dummy users…'); createUser('Bruce', 'dummyuser1@telescopeapp.org'); createUser('Arnold', 'dummyuser2@telescopeapp.org'); @@ -81,6 +82,7 @@ Meteor.startup(function () { } const currentUser = Users.findOne(); // just get the first user available if (Movies.find().fetch().length === 0) { + // eslint-disable-next-line no-console console.log('// creating dummy movies'); seedData.forEach(document => { newMutation({ diff --git a/packages/example-simple/lib/server/seed.js b/packages/example-simple/lib/server/seed.js index ad5db4e6f..aaaa31ad4 100644 --- a/packages/example-simple/lib/server/seed.js +++ b/packages/example-simple/lib/server/seed.js @@ -70,6 +70,7 @@ const createUser = function (username, email) { } var createDummyUsers = function () { + // eslint-disable-next-line no-console console.log('// inserting dummy users…'); createUser('Bruce', 'dummyuser1@telescopeapp.org'); createUser('Arnold', 'dummyuser2@telescopeapp.org'); @@ -82,6 +83,7 @@ Meteor.startup(function () { } const currentUser = Users.findOne(); // just get the first user available if (Movies.find().fetch().length === 0) { + // eslint-disable-next-line no-console console.log('// creating dummy movies'); seedData.forEach(document => { newMutation({ diff --git a/packages/vulcan-accounts/imports/accounts_ui.js b/packages/vulcan-accounts/imports/accounts_ui.js index 24546e64d..8449efbee 100755 --- a/packages/vulcan-accounts/imports/accounts_ui.js +++ b/packages/vulcan-accounts/imports/accounts_ui.js @@ -1,10 +1,5 @@ import { Accounts } from 'meteor/accounts-base'; -import { - redirect, - validatePassword, - validateEmail, - validateUsername, -} from './helpers.js'; +import { redirect } from './helpers.js'; /** * @summary Accounts UI diff --git a/packages/vulcan-accounts/imports/helpers.js b/packages/vulcan-accounts/imports/helpers.js index dd7d33403..cce2f0960 100755 --- a/packages/vulcan-accounts/imports/helpers.js +++ b/packages/vulcan-accounts/imports/helpers.js @@ -1,5 +1,9 @@ -let browserHistory -try { browserHistory = require('react-router').browserHistory } catch(e) {} +let browserHistory; +try { + browserHistory = require('react-router').browserHistory; +} catch(e) { + // swallow errors +} export const loginButtonsSession = Accounts._loginButtonsSession; export const STATES = { SIGN_IN: Symbol('SIGN_IN'), @@ -21,7 +25,7 @@ export function getLoginServices() { return _.map(services, function(name){ return {name: name}; }); -}; +} // Export getLoginServices using old style globals for accounts-base which // requires it. this.getLoginServices = getLoginServices; @@ -29,17 +33,17 @@ this.getLoginServices = getLoginServices; export function hasPasswordService() { // First look for OAuth services. return !!Package['accounts-password']; -}; +} export function loginResultCallback(service, err) { if (!err) { - + // Do nothing } else if (err instanceof Accounts.LoginCancelledError) { - // do nothing + // Do nothing } else if (err instanceof ServiceConfiguration.ConfigError) { - + // Do nothing } else { - //loginButtonsSession.errorMessage(err.reason || "Unknown error"); + // loginButtonsSession.errorMessage(err.reason || "Unknown error"); } if (Meteor.isClient) { @@ -51,11 +55,11 @@ export function loginResultCallback(service, err) { service(); } } -}; +} export function passwordSignupFields() { return Accounts.ui._options.passwordSignupFields || "USERNAME_AND_EMAIL"; -}; +} export function validateEmail(email, showMessage, clearMessage) { if (passwordSignupFields() === "USERNAME_AND_OPTIONAL_EMAIL" && email === '') { @@ -80,7 +84,7 @@ export function validatePassword(password = '', showMessage, clearMessage){ showMessage(errMsg, 'warning', false, 'password'); return false; } -}; +} export function validateUsername(username, showMessage, clearMessage, formState) { if ( username ) { diff --git a/packages/vulcan-accounts/imports/login_session.js b/packages/vulcan-accounts/imports/login_session.js index 26d38c179..07fdada27 100755 --- a/packages/vulcan-accounts/imports/login_session.js +++ b/packages/vulcan-accounts/imports/login_session.js @@ -1,9 +1,6 @@ -import {Accounts} from 'meteor/accounts-base'; -import { - STATES, - loginResultCallback, - getLoginServices -} from './helpers.js'; +/* eslint-disable meteor/no-session */ +import { Accounts } from 'meteor/accounts-base'; +import { loginResultCallback, getLoginServices } from './helpers.js'; const VALID_KEYS = [ 'dropdownVisible', @@ -72,12 +69,12 @@ if (Meteor.isClient){ loginResultCallback(attemptInfo.type, attemptInfo.error); }); - let doneCallback; + // let doneCallback; Accounts.onResetPasswordLink(function (token, done) { Accounts._loginButtonsSession.set('resetPasswordToken', token); Session.set(KEY_PREFIX + 'state', 'resetPasswordToken'); - doneCallback = done; + // doneCallback = done; Accounts.ui._options.onResetPasswordHook(); }); @@ -85,7 +82,7 @@ if (Meteor.isClient){ Accounts.onEnrollmentLink(function (token, done) { Accounts._loginButtonsSession.set('enrollAccountToken', token); Session.set(KEY_PREFIX + 'state', 'enrollAccountToken'); - doneCallback = done; + // doneCallback = done; Accounts.ui._options.onEnrollAccountHook(); }); diff --git a/packages/vulcan-accounts/imports/ui/components/Button.jsx b/packages/vulcan-accounts/imports/ui/components/Button.jsx index 5de8219bc..459758087 100755 --- a/packages/vulcan-accounts/imports/ui/components/Button.jsx +++ b/packages/vulcan-accounts/imports/ui/components/Button.jsx @@ -8,7 +8,7 @@ export class AccountsButton extends PureComponent { const { label, - href = null, + // href = null, type, disabled = false, className, @@ -16,15 +16,15 @@ export class AccountsButton extends PureComponent { } = this.props; return type === 'link' ? - { label } : + {label} : ; } } diff --git a/packages/vulcan-accounts/imports/ui/components/Buttons.jsx b/packages/vulcan-accounts/imports/ui/components/Buttons.jsx index 60b0f8f15..5ad3f3146 100755 --- a/packages/vulcan-accounts/imports/ui/components/Buttons.jsx +++ b/packages/vulcan-accounts/imports/ui/components/Buttons.jsx @@ -13,6 +13,6 @@ export class Buttons extends React.Component { ); } -}; +} registerComponent('AccountsButtons', Buttons); \ No newline at end of file diff --git a/packages/vulcan-accounts/imports/ui/components/EnrollAccount.jsx b/packages/vulcan-accounts/imports/ui/components/EnrollAccount.jsx index 981749cee..f7252d85e 100644 --- a/packages/vulcan-accounts/imports/ui/components/EnrollAccount.jsx +++ b/packages/vulcan-accounts/imports/ui/components/EnrollAccount.jsx @@ -1,7 +1,6 @@ import { Components, registerComponent, withCurrentUser } from 'meteor/vulcan:core'; import React, { PureComponent } from 'react'; import PropTypes from 'prop-types'; -import { Link } from 'react-router'; import { intlShape } from 'meteor/vulcan:i18n'; import { STATES } from '../../helpers.js'; diff --git a/packages/vulcan-accounts/imports/ui/components/Field.jsx b/packages/vulcan-accounts/imports/ui/components/Field.jsx index 0737f6637..4fda26d59 100755 --- a/packages/vulcan-accounts/imports/ui/components/Field.jsx +++ b/packages/vulcan-accounts/imports/ui/components/Field.jsx @@ -49,7 +49,7 @@ export class AccountsField extends PureComponent { label, type = 'text', onChange, - required = false, + // required = false, className = "field", defaultValue = "", message, diff --git a/packages/vulcan-accounts/imports/ui/components/Form.jsx b/packages/vulcan-accounts/imports/ui/components/Form.jsx index cb701d216..5f94410b0 100755 --- a/packages/vulcan-accounts/imports/ui/components/Form.jsx +++ b/packages/vulcan-accounts/imports/ui/components/Form.jsx @@ -15,18 +15,16 @@ export class AccountsForm extends PureComponent { render() { const { - hasPasswordService, + // hasPasswordService, oauthServices, fields, buttons, - error, + // error, messages, ready = true, - className + className, } = this.props; - const _className = classnames("accounts-ui", { - "ready": ready, - }); + const _className = classnames('accounts-ui', { ready }, className); return (
this.form = ref} diff --git a/packages/vulcan-accounts/imports/ui/components/FormMessage.jsx b/packages/vulcan-accounts/imports/ui/components/FormMessage.jsx index db72b174a..ca768616f 100755 --- a/packages/vulcan-accounts/imports/ui/components/FormMessage.jsx +++ b/packages/vulcan-accounts/imports/ui/components/FormMessage.jsx @@ -6,8 +6,7 @@ export class AccountsFormMessage extends React.Component { let { message, type, className = "message", style = {} } = this.props; message = _.isObject(message) ? message.message : message; // If message is object, then try to get message from it return message ? ( -
{ message }
+
{ message }
) : null; } } diff --git a/packages/vulcan-accounts/imports/ui/components/FormMessages.jsx b/packages/vulcan-accounts/imports/ui/components/FormMessages.jsx index b17afb889..03d441cc0 100755 --- a/packages/vulcan-accounts/imports/ui/components/FormMessages.jsx +++ b/packages/vulcan-accounts/imports/ui/components/FormMessages.jsx @@ -1,14 +1,14 @@ -import React, { Component } from 'react'; +import React, { Component } from 'react'; import { Components, registerComponent } from 'meteor/vulcan:core'; export class AccountsFormMessages extends Component { render () { const { messages = [], className = "messages", style = {} } = this.props; return messages.length > 0 && ( -
+
{messages .filter(message => !('field' in message)) - .map(({ message, type }, i) => + .map(({ message, type }, i) => { onSubmitHook(error,formState); if (error) { + // eslint-disable-next-line no-console console.log(error); const errorId = `accounts.error_${error.reason.toLowerCase().replace(/ /g, '_')}`; if (this.context.intl.formatMessage({id: errorId})) { @@ -691,7 +693,7 @@ export class AccountsLoginForm extends Tracker.Component { } oauthSignIn(serviceName) { - const { formState, waiting, currentUser, onSubmitHook } = this.state; + const { formState, /* waiting, currentUser, */ onSubmitHook } = this.state; //Thanks Josh Owens for this one. function capitalService() { return serviceName.charAt(0).toUpperCase() + serviceName.slice(1); @@ -715,7 +717,8 @@ export class AccountsLoginForm extends Tracker.Component { loginWithService(options, (error) => { onSubmitHook(error,formState); if (error) { - console.log(error) + // eslint-disable-next-line no-console + console.log(error); if (error instanceof Accounts.LoginCancelledError) { // do nothing } else { @@ -741,7 +744,7 @@ export class AccountsLoginForm extends Tracker.Component { const { username = null, email = null, - usernameOrEmail = null, + // usernameOrEmail = null, password, formState, onSubmitHook @@ -788,6 +791,7 @@ export class AccountsLoginForm extends Tracker.Component { const SignUp = function(_options) { Accounts.createUser(_options, (error) => { if (error) { + // eslint-disable-next-line no-console console.log(error); const errorId = `accounts.error_${error.reason.toLowerCase().replace(/ /g, '_').replace('.','')}`; @@ -824,6 +828,7 @@ export class AccountsLoginForm extends Tracker.Component { promise.then(SignUp.bind(this, options)); } else { + // eslint-disable-next-line babel/new-cap SignUp(options); } } @@ -835,7 +840,7 @@ export class AccountsLoginForm extends Tracker.Component { waiting, formState, onSubmitHook - } = this.state; + } = this.state; if (waiting) { return; @@ -847,7 +852,8 @@ export class AccountsLoginForm extends Tracker.Component { this.setState({ waiting: true }); Accounts.forgotPassword({ email: email }, (error) => { - console.log(error) + // eslint-disable-next-line no-console + console.log(error); if (error) { const errorId = `accounts.error_${error.reason.toLowerCase().replace(/ /g, '_')}`; this.showMessage(errorId, 'error'); @@ -869,7 +875,7 @@ export class AccountsLoginForm extends Tracker.Component { formState, onSubmitHook, onSignedInHook, - } = this.state; + } = this.state; if (!this.validateField('password', newPassword)){ onSubmitHook('err.minChar',formState); @@ -916,13 +922,13 @@ export class AccountsLoginForm extends Tracker.Component { showMessage(messageId, type, clearTimeout, field){ if (messageId) { - this.setState(({ messages = [] }) => { + this.setState(({ messages = [] }) => { messages.push({ message: this.context.intl.formatMessage({id: messageId}), type, - ...(field && { field }), + ...(field && { field }), }); - return { messages }; + return { messages }; }); if (clearTimeout) { this.hideMessageTimout = setTimeout(() => { @@ -934,14 +940,14 @@ export class AccountsLoginForm extends Tracker.Component { } getMessageForField(field) { - const { messages = [] } = this.state; - return messages.find(({ field:key }) => key === field); + const { messages = [] } = this.state; + return messages.find(({ field:key }) => key === field); } clearMessage(message) { if (message) { - this.setState(({ messages = [] }) => ({ - messages: messages.filter(({ message:a }) => a !== message), + this.setState(({ messages = [] }) => ({ + messages: messages.filter(({ message:a }) => a !== message), })); } } @@ -962,16 +968,16 @@ export class AccountsLoginForm extends Tracker.Component { render() { this.oauthButtons(); // Backwords compatibility with v1.2.x. - const { messages = [] } = this.state; + const { messages = [] } = this.state; const message = { deprecated: true, - message: messages.map(({ message }) => message).join(', '), + message: messages.map(({ message }) => message).join(', '), }; return ( 0) { return ( -
+
{ `${this.context.intl.formatMessage({id: 'accounts.or_use'})} ${ labels.join(' / ') }` }
); diff --git a/packages/vulcan-accounts/imports/ui/components/ResetPassword.jsx b/packages/vulcan-accounts/imports/ui/components/ResetPassword.jsx index 202395a58..b7c829e3a 100644 --- a/packages/vulcan-accounts/imports/ui/components/ResetPassword.jsx +++ b/packages/vulcan-accounts/imports/ui/components/ResetPassword.jsx @@ -1,7 +1,6 @@ import { Components, registerComponent, withCurrentUser } from 'meteor/vulcan:core'; import React, { PureComponent } from 'react'; import PropTypes from 'prop-types'; -import { Link } from 'react-router'; import { intlShape } from 'meteor/vulcan:i18n'; import { STATES } from '../../helpers.js'; diff --git a/packages/vulcan-accounts/main_client.js b/packages/vulcan-accounts/main_client.js index e657dfd2d..40482edc3 100755 --- a/packages/vulcan-accounts/main_client.js +++ b/packages/vulcan-accounts/main_client.js @@ -3,7 +3,7 @@ import './imports/accounts_ui.js'; import './imports/components.js'; import './imports/login_session.js'; import './imports/routes.js'; -import { STATES } from './imports/helpers.js'; +import { STATES } from './imports/helpers.js'; import './imports/ui/components/LoginForm.jsx'; diff --git a/packages/vulcan-accounts/main_server.js b/packages/vulcan-accounts/main_server.js index d775f9b66..c004218c1 100755 --- a/packages/vulcan-accounts/main_server.js +++ b/packages/vulcan-accounts/main_server.js @@ -3,7 +3,7 @@ import './imports/accounts_ui.js'; import './imports/components.js'; import './imports/login_session.js'; import './imports/routes.js'; -import { redirect, STATES } from './imports/helpers.js'; +import { redirect, STATES } from './imports/helpers.js'; import './imports/api/server/servicesListPublication.js'; import './imports/ui/components/LoginForm.jsx'; diff --git a/packages/vulcan-core/lib/modules/components/App.jsx b/packages/vulcan-core/lib/modules/components/App.jsx index e47fd659d..92bcba269 100644 --- a/packages/vulcan-core/lib/modules/components/App.jsx +++ b/packages/vulcan-core/lib/modules/components/App.jsx @@ -1,7 +1,6 @@ import { Components, registerComponent, - registerSetting, getSetting, Strings, runCallbacks, diff --git a/packages/vulcan-core/lib/modules/components/DynamicLoading.jsx b/packages/vulcan-core/lib/modules/components/DynamicLoading.jsx index 63126b5cf..7cfe32e6d 100644 --- a/packages/vulcan-core/lib/modules/components/DynamicLoading.jsx +++ b/packages/vulcan-core/lib/modules/components/DynamicLoading.jsx @@ -5,7 +5,8 @@ const DynamicLoading = ({ isLoading, pastDelay, error }) => { if (isLoading && pastDelay) { return ; } else if (error && !isLoading) { - console.log(error) + // eslint-disable-next-line no-console + console.log(error); return

Error!

; } else { return null; diff --git a/packages/vulcan-core/lib/modules/containers/withDocument.js b/packages/vulcan-core/lib/modules/containers/withDocument.js index eda8d4f45..c34ba2a08 100644 --- a/packages/vulcan-core/lib/modules/containers/withDocument.js +++ b/packages/vulcan-core/lib/modules/containers/withDocument.js @@ -47,7 +47,7 @@ export default function withDocument (options) { return graphQLOptions; }, props: returnedProps => { - const { ownProps, data } = returnedProps; + const { /* ownProps, */ data } = returnedProps; const propertyName = options.propertyName || 'document'; const props = { diff --git a/packages/vulcan-core/lib/modules/containers/withList.js b/packages/vulcan-core/lib/modules/containers/withList.js index ff9afe9f9..e5ada3ae3 100644 --- a/packages/vulcan-core/lib/modules/containers/withList.js +++ b/packages/vulcan-core/lib/modules/containers/withList.js @@ -154,6 +154,7 @@ const withList = (options) => { propertyName = options.propertyName || 'results'; if (error) { + // eslint-disable-next-line no-console console.log(error); } diff --git a/packages/vulcan-debug/lib/components/Callbacks.jsx b/packages/vulcan-debug/lib/components/Callbacks.jsx index b158d1f8f..4152449da 100644 --- a/packages/vulcan-debug/lib/components/Callbacks.jsx +++ b/packages/vulcan-debug/lib/components/Callbacks.jsx @@ -1,5 +1,4 @@ import React from 'react'; -import { FormattedMessage } from 'meteor/vulcan:i18n'; import { registerComponent, Components } from 'meteor/vulcan:lib'; import Callbacks from '../modules/callbacks/collection.js'; diff --git a/packages/vulcan-debug/lib/components/Settings.jsx b/packages/vulcan-debug/lib/components/Settings.jsx index 48836a832..960935358 100644 --- a/packages/vulcan-debug/lib/components/Settings.jsx +++ b/packages/vulcan-debug/lib/components/Settings.jsx @@ -1,5 +1,4 @@ import React from 'react'; -import { FormattedMessage } from 'meteor/vulcan:i18n'; import { registerComponent, Components } from 'meteor/vulcan:lib'; import Settings from '../modules/settings/collection.js'; diff --git a/packages/vulcan-email/lib/server/email.js b/packages/vulcan-email/lib/server/email.js index 8161799c0..f5a49ab9d 100644 --- a/packages/vulcan-email/lib/server/email.js +++ b/packages/vulcan-email/lib/server/email.js @@ -1,3 +1,4 @@ +/* eslint-disable no-console */ import VulcanEmail from '../namespace.js'; import Juice from 'juice'; import htmlToText from 'html-to-text'; diff --git a/packages/vulcan-embed/lib/server/integrations/builtin.js b/packages/vulcan-embed/lib/server/integrations/builtin.js index 55dd2544d..56011d80f 100644 --- a/packages/vulcan-embed/lib/server/integrations/builtin.js +++ b/packages/vulcan-embed/lib/server/integrations/builtin.js @@ -50,6 +50,7 @@ const extractMeta = function (params) { } html = result.content; } catch (e) { + // eslint-disable-next-line no-console console.log('catch error', e); return META; } diff --git a/packages/vulcan-embed/lib/server/integrations/embedly.js b/packages/vulcan-embed/lib/server/integrations/embedly.js index 594798206..dc6335577 100644 --- a/packages/vulcan-embed/lib/server/integrations/embedly.js +++ b/packages/vulcan-embed/lib/server/integrations/embedly.js @@ -14,6 +14,7 @@ if (settings) { if(!apiKey) { // fail silently to still let the post be submitted as usual + // eslint-disable-next-line no-console console.log("Couldn't find an Embedly API key! Please add it to your Vulcan settings."); // eslint-disable-line return null; } @@ -48,8 +49,10 @@ if (settings) { return embedlyData; } catch (error) { - console.log('// Embedly error') - console.log(error); // eslint-disable-line + // eslint-disable-next-line no-console + console.log('// Embedly error'); + // eslint-disable-next-line no-console + console.log(error); // the first 13 characters of the Embedly errors are "failed [400] ", so remove them and parse the rest const errorObject = JSON.parse(error.message.substring(13)); throw new Error(errorObject.error_message); diff --git a/packages/vulcan-embed/lib/server/mutations.js b/packages/vulcan-embed/lib/server/mutations.js index 7a068583c..5b6b89e7d 100644 --- a/packages/vulcan-embed/lib/server/mutations.js +++ b/packages/vulcan-embed/lib/server/mutations.js @@ -11,9 +11,12 @@ const resolver = { Mutation: { getEmbedData(root, args, context) { const data = Embed[embedProvider].getData(args.url); - console.log('// getEmbedData') - console.log(args) - console.log(data) + // eslint-disable-next-line no-console + console.log('// getEmbedData'); + // eslint-disable-next-line no-console + console.log(args); + // eslint-disable-next-line no-console + console.log(data); return data; }, }, diff --git a/packages/vulcan-events-intercom/lib/client/intercom-client.js b/packages/vulcan-events-intercom/lib/client/intercom-client.js index 49bb89e1f..6b378ae63 100644 --- a/packages/vulcan-events-intercom/lib/client/intercom-client.js +++ b/packages/vulcan-events-intercom/lib/client/intercom-client.js @@ -1,5 +1,10 @@ -import { getSetting, addCallback, Utils } from 'meteor/vulcan:core'; -import { addPageFunction, addInitFunction, addIdentifyFunction, addTrackFunction } from 'meteor/vulcan:events'; +import { getSetting, /* addCallback, Utils */ } from 'meteor/vulcan:core'; +import { + // addPageFunction, + addInitFunction, + addIdentifyFunction, + // addTrackFunction, +} from 'meteor/vulcan:events'; /* @@ -7,6 +12,7 @@ Identify User */ function intercomIdentify(currentUser) { + // eslint-disable-next-line no-undef intercomSettings = { app_id: getSetting('intercom.appId'), name: currentUser.displayName, @@ -20,6 +26,7 @@ function intercomIdentify(currentUser) { var ic = w.Intercom; if (typeof ic === 'function') { ic('reattach_activator'); + // eslint-disable-next-line no-undef ic('update', intercomSettings); } else { var d = document; @@ -31,6 +38,7 @@ function intercomIdentify(currentUser) { i.q.push(args); }; w.Intercom = i; + // eslint-disable-next-line no-inner-declarations function l() { var s = d.createElement('script'); s.type = 'text/javascript'; @@ -73,6 +81,7 @@ function intercomInit() { var ic = w.Intercom; if (typeof ic === 'function') { ic('reattach_activator'); + // eslint-disable-next-line no-undef ic('update', intercomSettings); } else { var d = document; @@ -84,6 +93,7 @@ function intercomInit() { i.q.push(args); }; w.Intercom = i; + // eslint-disable-next-line no-inner-declarations function l() { var s = d.createElement('script'); s.type = 'text/javascript'; diff --git a/packages/vulcan-events-intercom/lib/server/intercom-server.js b/packages/vulcan-events-intercom/lib/server/intercom-server.js index cc15444f9..2214a933c 100644 --- a/packages/vulcan-events-intercom/lib/server/intercom-server.js +++ b/packages/vulcan-events-intercom/lib/server/intercom-server.js @@ -1,6 +1,13 @@ import Intercom from 'intercom-client'; -import { getSetting, addCallback, Utils } from 'meteor/vulcan:core'; -import { addPageFunction, addUserFunction, addInitFunction, addIdentifyFunction, addTrackFunction } from 'meteor/vulcan:events'; +import { getSetting, /* addCallback, Utils */ } from 'meteor/vulcan:core'; +import { + // addPageFunction, + addUserFunction, + // addInitFunction, + // addIdentifyFunction, + addTrackFunction, +} from 'meteor/vulcan:events'; +import Users from 'meteor/vulcan:users'; const token = getSetting('intercom.accessToken'); @@ -17,6 +24,7 @@ if (!token) { New User */ + // eslint-disable-next-line no-inner-declarations function intercomNewUser(user) { intercomClient.users.create({ email: user.email, @@ -34,6 +42,7 @@ if (!token) { Track Event */ + // eslint-disable-next-line no-inner-declarations function intercomTrackServer(eventName, eventProperties, currentUser) { intercomClient.events.create({ event_name: eventName, diff --git a/packages/vulcan-events-internal/lib/client/internal-client.js b/packages/vulcan-events-internal/lib/client/internal-client.js index 8379d7889..0cd9fc2e5 100644 --- a/packages/vulcan-events-internal/lib/client/internal-client.js +++ b/packages/vulcan-events-internal/lib/client/internal-client.js @@ -1,10 +1,9 @@ import { addTrackFunction } from 'meteor/vulcan:events'; -import { ApolloClient } from 'apollo-client'; import { getRenderContext } from 'meteor/vulcan:lib'; import gql from 'graphql-tag'; function trackInternal(eventName, eventProperties) { - const { apolloClient, store } = getRenderContext(); + const { apolloClient } = getRenderContext(); const mutation = gql` mutation AnalyticsEventsNew($document: AnalyticsEventsInput) { AnalyticsEventsNew(document: $document) { diff --git a/packages/vulcan-events-segment/lib/client/segment-client.js b/packages/vulcan-events-segment/lib/client/segment-client.js index b733d1e52..1460b33a9 100644 --- a/packages/vulcan-events-segment/lib/client/segment-client.js +++ b/packages/vulcan-events-segment/lib/client/segment-client.js @@ -1,4 +1,4 @@ -import { getSetting, addCallback, Utils } from 'meteor/vulcan:core'; +import { getSetting, Utils } from 'meteor/vulcan:core'; import { addPageFunction, addInitFunction, @@ -41,7 +41,7 @@ Track Event */ function segmentTrack(eventName, eventProperties) { - analytics.track(eventName, eventProperties); + window.analytics.track(eventName, eventProperties); } addTrackFunction(segmentTrack); @@ -55,8 +55,11 @@ function segmentInit() { var analytics = (window.analytics = window.analytics || []); if (!analytics.initialize) if (analytics.invoked) + // eslint-disable-next-line no-console window.console && + // eslint-disable-next-line no-console console.error && + // eslint-disable-next-line no-console console.error('Segment snippet included twice.'); else { analytics.invoked = !0; diff --git a/packages/vulcan-events-segment/lib/server/segment-server.js b/packages/vulcan-events-segment/lib/server/segment-server.js index 6d19e9a6b..36270b90b 100644 --- a/packages/vulcan-events-segment/lib/server/segment-server.js +++ b/packages/vulcan-events-segment/lib/server/segment-server.js @@ -1,6 +1,10 @@ import Analytics from 'analytics-node'; -import { getSetting, addCallback, Utils } from 'meteor/vulcan:core'; -import { addPageFunction, addInitFunction, addIdentifyFunction, addTrackFunction } from 'meteor/vulcan:events'; +import { getSetting } from 'meteor/vulcan:core'; +import { + /* addPageFunction, addInitFunction, */ + addIdentifyFunction, + addTrackFunction, +} from 'meteor/vulcan:events'; const segmentWriteKey = getSetting('segment.serverKey'); @@ -13,6 +17,7 @@ if (segmentWriteKey) { Identify User */ + // eslint-disable-next-line no-inner-declarations function segmentIdentifyServer(currentUser) { analytics.identify({ userId: currentUser._id, @@ -29,6 +34,7 @@ if (segmentWriteKey) { Track Event */ + // eslint-disable-next-line no-inner-declarations function segmentTrackServer(eventName, eventProperties, currentUser) { analytics.track({ event: eventName, diff --git a/packages/vulcan-forms-upload/lib/Upload.jsx b/packages/vulcan-forms-upload/lib/Upload.jsx index bc0030af2..eefb56eea 100755 --- a/packages/vulcan-forms-upload/lib/Upload.jsx +++ b/packages/vulcan-forms-upload/lib/Upload.jsx @@ -157,6 +157,7 @@ class Upload extends PureComponent { // tell vulcanForm to catch the value this.context.addToAutofilledValues({[this.props.name]: newValue}); }) + // eslint-disable-next-line no-console .catch(err => console.log('err', err)); } diff --git a/packages/vulcan-forms/lib/components/Form.jsx b/packages/vulcan-forms/lib/components/Form.jsx index a226b2338..9d1e4bab7 100644 --- a/packages/vulcan-forms/lib/components/Form.jsx +++ b/packages/vulcan-forms/lib/components/Form.jsx @@ -140,6 +140,7 @@ class Form extends Component { // backward compatibility from 'autoform' to 'form' if (fieldSchema.autoform) { fieldSchema.form = fieldSchema.autoform; + // eslint-disable-next-line no-console console.warn(`Vulcan Warning: The 'autoform' field is deprecated. You should rename it to 'form' instead. It was defined on your '${fieldName}' field on the '${this.props.collection._name}' collection`); // eslint-disable-line } @@ -395,7 +396,8 @@ class Form extends Component { // get graphQL error (see https://github.com/thebigredgeek/apollo-errors/issues/12) const graphQLError = error.graphQLErrors[0]; - console.log(graphQLError) + // eslint-disable-next-line no-console + console.log(graphQLError); // add error to state this.setState(prevState => ({ @@ -515,8 +517,10 @@ class Form extends Component { this.setState(prevState => ({disabled: false})); - console.log("// graphQL Error"); // eslint-disable-line no-console - console.log(error); // eslint-disable-line no-console + // eslint-disable-next-line no-console + console.log("// graphQL Error"); + // eslint-disable-next-line no-console + console.log(error); // run mutation failure callbacks on error, we do not allow the callbacks to change the error runCallbacks(this.failureFormCallbacks, error); @@ -607,6 +611,7 @@ class Form extends Component { if (this.props.refetch) this.props.refetch(); }) .catch((error) => { + // eslint-disable-next-line no-console console.log(error); }); } diff --git a/packages/vulcan-forms/lib/components/FormComponent.jsx b/packages/vulcan-forms/lib/components/FormComponent.jsx index 9f4807293..6c375c29a 100644 --- a/packages/vulcan-forms/lib/components/FormComponent.jsx +++ b/packages/vulcan-forms/lib/components/FormComponent.jsx @@ -141,7 +141,8 @@ class FormComponent extends PureComponent { clearField = (e) => { e.preventDefault(); - console.log(this.props) + // eslint-disable-next-line no-console + console.log(this.props); const fieldName = this.props.name; // clear value this.props.updateCurrentValues({[fieldName]: null}); diff --git a/packages/vulcan-forms/lib/components/FormWrapper.jsx b/packages/vulcan-forms/lib/components/FormWrapper.jsx index 2ba2ab614..be95c88be 100644 --- a/packages/vulcan-forms/lib/components/FormWrapper.jsx +++ b/packages/vulcan-forms/lib/components/FormWrapper.jsx @@ -193,7 +193,7 @@ class FormWrapper extends PureComponent { }`, { alias: 'withExtraQueries', props: returnedProps => { - const { ownProps, data } = returnedProps; + const { /* ownProps, */ data } = returnedProps; const props = { loading: data.loading, data, diff --git a/packages/vulcan-i18n/lib/modules/index.js b/packages/vulcan-i18n/lib/modules/index.js index c79603bda..661e6bb70 100644 --- a/packages/vulcan-i18n/lib/modules/index.js +++ b/packages/vulcan-i18n/lib/modules/index.js @@ -5,4 +5,3 @@ registerSetting('locale', 'en', 'Your app\'s locale (“en”, “fr”, etc.)') export { default as FormattedMessage } from './message.js'; export { intlShape } from './shape.js'; export { default as IntlProvider } from './provider.js'; - diff --git a/packages/vulcan-i18n/lib/modules/message.js b/packages/vulcan-i18n/lib/modules/message.js index 8c1825267..b548e59f1 100644 --- a/packages/vulcan-i18n/lib/modules/message.js +++ b/packages/vulcan-i18n/lib/modules/message.js @@ -1,5 +1,5 @@ import React, { Component } from 'react'; -import { getSetting, registerSetting, Strings } from 'meteor/vulcan:lib'; +import { getSetting, Strings } from 'meteor/vulcan:lib'; const FormattedMessage = ({ id, values, defaultMessage }) => { const messages = Strings[getSetting('locale', 'en')] || {}; @@ -12,4 +12,4 @@ const FormattedMessage = ({ id, values, defaultMessage }) => { return {message} } -export default FormattedMessage; \ No newline at end of file +export default FormattedMessage; diff --git a/packages/vulcan-i18n/lib/modules/provider.js b/packages/vulcan-i18n/lib/modules/provider.js index 18eff080d..c160ece9e 100644 --- a/packages/vulcan-i18n/lib/modules/provider.js +++ b/packages/vulcan-i18n/lib/modules/provider.js @@ -1,6 +1,5 @@ import React, { Component } from 'react'; -import PropTypes from 'prop-types'; -import { getSetting, registerSetting, Strings } from 'meteor/vulcan:lib'; +import { getSetting, Strings } from 'meteor/vulcan:lib'; import { intlShape } from './shape.js'; @@ -49,4 +48,4 @@ export default class IntlProvider extends Component{ IntlProvider.childContextTypes = { intl: intlShape -} \ No newline at end of file +} diff --git a/packages/vulcan-i18n/lib/modules/shape.js b/packages/vulcan-i18n/lib/modules/shape.js index 872134cd3..46ef87da0 100644 --- a/packages/vulcan-i18n/lib/modules/shape.js +++ b/packages/vulcan-i18n/lib/modules/shape.js @@ -85,4 +85,4 @@ export const relativeFormatPropTypes = { export const pluralFormatPropTypes = { style: oneOf(['cardinal', 'ordinal']), -}; \ No newline at end of file +}; diff --git a/packages/vulcan-lib/lib/modules/apollo.js b/packages/vulcan-lib/lib/modules/apollo.js index 1813f7a30..15b5571bf 100644 --- a/packages/vulcan-lib/lib/modules/apollo.js +++ b/packages/vulcan-lib/lib/modules/apollo.js @@ -3,7 +3,7 @@ import 'cross-fetch/polyfill'; import { Meteor } from 'meteor/meteor'; import { getSetting, registerSetting } from './settings.js'; import { getFragmentMatcher } from './fragment_matcher.js'; -import { Callbacks, runCallbacks } from './callbacks.js'; +import { runCallbacks } from './callbacks.js'; registerSetting('developmentServerIp', Meteor.absoluteUrl(), 'Development server IP'); diff --git a/packages/vulcan-lib/lib/modules/callbacks.js b/packages/vulcan-lib/lib/modules/callbacks.js index 9b7088d87..876d15902 100644 --- a/packages/vulcan-lib/lib/modules/callbacks.js +++ b/packages/vulcan-lib/lib/modules/callbacks.js @@ -29,6 +29,7 @@ export const registerCallback = function (callback) { export const addCallback = function (hook, callback) { if (!callback.name) { + // eslint-disable-next-line no-console console.log(`// Warning! You are adding an unnamed callback to ${hook}. Please use the function foo () {} syntax.`); } @@ -94,7 +95,9 @@ export const runCallbacks = function () { } } catch (error) { + // eslint-disable-next-line no-console console.log(`\x1b[31m// error at callback [${callback.name}] in hook [${hook}]\x1b[0m`); + // eslint-disable-next-line no-console console.log(error); if (error.break || error.data && error.data.break) { throw error; diff --git a/packages/vulcan-lib/lib/modules/collections.js b/packages/vulcan-lib/lib/modules/collections.js index 8f5c9ff49..c200bc777 100644 --- a/packages/vulcan-lib/lib/modules/collections.js +++ b/packages/vulcan-lib/lib/modules/collections.js @@ -6,7 +6,7 @@ import { runCallbacks } from './callbacks.js'; import { getSetting, registerSetting } from './settings.js'; import { registerFragment, getDefaultFragmentText } from './fragments.js'; import escapeStringRegexp from 'escape-string-regexp'; -import { debug } from './debug.js'; +// import { debug } from './debug.js'; registerSetting('maxDocumentsPerRequest', 1000, 'Maximum documents per request'); diff --git a/packages/vulcan-lib/lib/modules/config.js b/packages/vulcan-lib/lib/modules/config.js index 87d61e771..261a6aab5 100644 --- a/packages/vulcan-lib/lib/modules/config.js +++ b/packages/vulcan-lib/lib/modules/config.js @@ -5,8 +5,10 @@ import SimpleSchema from 'simpl-schema'; * @namespace Vulcan */ +// eslint-disable-next-line no-undef Vulcan = {}; +// eslint-disable-next-line no-undef Vulcan.VERSION = '1.8.5'; // ------------------------------------- Schemas -------------------------------- // @@ -36,4 +38,5 @@ SimpleSchema.extendOptions([ 'description', ]); +// eslint-disable-next-line no-undef export default Vulcan; diff --git a/packages/vulcan-lib/lib/modules/debug.js b/packages/vulcan-lib/lib/modules/debug.js index 572b1c26f..15c261dae 100644 --- a/packages/vulcan-lib/lib/modules/debug.js +++ b/packages/vulcan-lib/lib/modules/debug.js @@ -2,17 +2,20 @@ import { getSetting } from './settings.js'; export const debug = function () { if (getSetting('debug', false)) { + // eslint-disable-next-line no-console console.log.apply(null, arguments); } } export const debugGroup = function () { if (getSetting('debug', false)) { + // eslint-disable-next-line no-console console.groupCollapsed.apply(null, arguments); } } export const debugGroupEnd = function () { if (getSetting('debug', false)) { + // eslint-disable-next-line no-console console.groupEnd.apply(null, arguments); } } \ No newline at end of file diff --git a/packages/vulcan-lib/lib/modules/graphql.js b/packages/vulcan-lib/lib/modules/graphql.js index ab0f1636a..83f8ae045 100644 --- a/packages/vulcan-lib/lib/modules/graphql.js +++ b/packages/vulcan-lib/lib/modules/graphql.js @@ -234,6 +234,7 @@ input ${collectionName}Unset { Vulcan.getGraphQLSchema = () => { const schema = GraphQLSchema.finalSchema[0]; + // eslint-disable-next-line no-console console.log(schema); return schema; } diff --git a/packages/vulcan-lib/lib/modules/utils.js b/packages/vulcan-lib/lib/modules/utils.js index 980c7af01..10ba4f0d3 100644 --- a/packages/vulcan-lib/lib/modules/utils.js +++ b/packages/vulcan-lib/lib/modules/utils.js @@ -11,7 +11,6 @@ import sanitizeHtml from 'sanitize-html'; import getSlug from 'speakingurl'; import { getSetting } from './settings.js'; import { Routes } from './routes.js'; -import { isAbsolute } from 'path'; /** * @summary The global namespace for Vulcan utils. @@ -128,7 +127,7 @@ Utils.getDateRange = function(pageNumber) { * @summary Returns the user defined site URL or Meteor.absoluteUrl. Add trailing '/' if missing */ Utils.getSiteUrl = function () { - const url = getSetting('siteUrl', Meteor.absoluteUrl()); + let url = getSetting('siteUrl', Meteor.absoluteUrl()); if (url.slice(-1) !== '/') { url += '/'; } diff --git a/packages/vulcan-lib/lib/modules/validation.js b/packages/vulcan-lib/lib/modules/validation.js index 09dd3e175..a507c2724 100644 --- a/packages/vulcan-lib/lib/modules/validation.js +++ b/packages/vulcan-lib/lib/modules/validation.js @@ -60,7 +60,8 @@ export const validateDocument = (document, collection, context) => { try { collection.simpleSchema().validate(document); } catch (error) { - console.log(error) + // eslint-disable-next-line no-console + console.log(error); validationErrors.push({ id: 'app.schema_validation_error', data: {message: error.message} @@ -141,7 +142,8 @@ export const validateModifier = (modifier, document, collection, context) => { try { collection.simpleSchema().validate({$set: set, $unset: unset}, { modifier: true }); } catch (error) { - console.log(error) + // eslint-disable-next-line no-console + console.log(error); validationErrors.push({ id: 'app.schema_validation_error', data: {message: error.message} diff --git a/packages/vulcan-lib/lib/server/meteor_patch.js b/packages/vulcan-lib/lib/server/meteor_patch.js index d5bdaaf7d..0c9c49169 100644 --- a/packages/vulcan-lib/lib/server/meteor_patch.js +++ b/packages/vulcan-lib/lib/server/meteor_patch.js @@ -1,8 +1,5 @@ -import { Meteor } from 'meteor/meteor'; import { WebApp } from 'meteor/webapp'; -import { Utils } from '../modules/index.js'; - // clever webAppConnectHandlersUse export const webAppConnectHandlersUse = (name, route, fn, options) => { // init diff --git a/packages/vulcan-lib/lib/server/mutations.js b/packages/vulcan-lib/lib/server/mutations.js index e4c7cb32d..0f6c24fb0 100644 --- a/packages/vulcan-lib/lib/server/mutations.js +++ b/packages/vulcan-lib/lib/server/mutations.js @@ -137,8 +137,10 @@ export const editMutation = async ({ collection, documentId, set = {}, unset = { modifier = runCallbacks(`${collectionName}.edit.validate`, modifier, document, currentUser, validationErrors); if (validationErrors.length) { - console.log('// validationErrors') - console.log(validationErrors) + // eslint-disable-next-line no-console + console.log('// validationErrors'); + // eslint-disable-next-line no-console + console.log(validationErrors); const EditDocumentValidationError = createError('app.validation_error', {message: 'app.edit_document_validation_error'}); throw new EditDocumentValidationError({data: {break: true, errors: validationErrors}}); } diff --git a/packages/vulcan-lib/lib/server/query.js b/packages/vulcan-lib/lib/server/query.js index 37c6f39e4..8cc6bf0ad 100644 --- a/packages/vulcan-lib/lib/server/query.js +++ b/packages/vulcan-lib/lib/server/query.js @@ -24,6 +24,7 @@ export const runQuery = async (query, variables = {}, context = { currentUser: { const result = await graphql(executableSchema, query, {}, context, variables); if (result.errors) { + // eslint-disable-next-line no-console console.log('runQuery error: '+result.errors[0].message); throw new Error(result.errors[0].message); } diff --git a/packages/vulcan-lib/lib/server/site.js b/packages/vulcan-lib/lib/server/site.js index d5d4f2194..cad4a5725 100644 --- a/packages/vulcan-lib/lib/server/site.js +++ b/packages/vulcan-lib/lib/server/site.js @@ -1,6 +1,6 @@ import { addGraphQLSchema, addGraphQLResolvers, addGraphQLQuery } from '../modules/graphql.js'; import { Utils } from '../modules/utils'; -import { getSetting, registerSetting } from '../modules/settings.js'; +import { getSetting } from '../modules/settings.js'; const siteSchema = `type Site { title: String diff --git a/packages/vulcan-newsletter/lib/server/integrations/sample.js b/packages/vulcan-newsletter/lib/server/integrations/sample.js index 4c87f2719..63ffa0096 100644 --- a/packages/vulcan-newsletter/lib/server/integrations/sample.js +++ b/packages/vulcan-newsletter/lib/server/integrations/sample.js @@ -7,7 +7,7 @@ This is a sample template for future integrations. import { getSetting, regiserSetting } from 'meteor/vulcan:core'; import Newsletters from '../../modules/collection.js'; -regiserSetting('providerName') +regiserSetting('providerName'); /* @@ -19,7 +19,8 @@ const settings = getSetting('providerName'); if (settings) { - const {server, apiKey, listId, somethingElse } = settings; + const {server, apiKey, /* listId, somethingElse */ } = settings; + // eslint-disable-next-line no-undef const MyProviderAPI = new ProviderAPI(server, apiKey); const subscribeSync = options => { @@ -27,7 +28,8 @@ if (settings) { const wrapped = Meteor.wrapAsync( MyProviderAPI.subscribe, MyProviderAPI ); return wrapped( options ); } catch ( error ) { - console.log(error) + // eslint-disable-next-line no-console + console.log(error); } }; @@ -36,7 +38,8 @@ if (settings) { const wrapped = Meteor.wrapAsync( MyProviderAPI.unsubscribe, MyProviderAPI ); return wrapped( options ); } catch ( error ) { - console.log(error) + // eslint-disable-next-line no-console + console.log(error); } }; @@ -45,7 +48,8 @@ if (settings) { const wrapped = Meteor.wrapAsync( MyProviderAPI.send, MyProviderAPI ); return wrapped( options ); } catch ( error ) { - console.log(error) + // eslint-disable-next-line no-console + console.log(error); } }; diff --git a/packages/vulcan-newsletter/lib/server/integrations/sendy.js b/packages/vulcan-newsletter/lib/server/integrations/sendy.js index 5546158ca..f8bdd166f 100644 --- a/packages/vulcan-newsletter/lib/server/integrations/sendy.js +++ b/packages/vulcan-newsletter/lib/server/integrations/sendy.js @@ -22,8 +22,10 @@ if (settings) { const wrapped = Meteor.wrapAsync( SendyAPI.subscribe, SendyAPI ); return wrapped( options ); } catch ( error ) { - console.log('// Sendy API error') - console.log(error) + // eslint-disable-next-line no-console + console.log('// Sendy API error'); + // eslint-disable-next-line no-console + console.log(error); if (error.message === 'Already subscribed.') { return {result: 'already-subscribed'} } @@ -35,8 +37,10 @@ if (settings) { const wrapped = Meteor.wrapAsync( SendyAPI.unsubscribe, SendyAPI ); return wrapped( options ); } catch ( error ) { - console.log('// Sendy API error') - console.log(error) + // eslint-disable-next-line no-console + console.log('// Sendy API error'); + // eslint-disable-next-line no-console + console.log(error); } }; @@ -45,8 +49,10 @@ if (settings) { const wrapped = Meteor.wrapAsync( SendyAPI.createCampaign, SendyAPI ); return wrapped( options ); } catch ( error ) { - console.log('// Sendy API error') - console.log(error) + // eslint-disable-next-line no-console + console.log('// Sendy API error'); + // eslint-disable-next-line no-console + console.log(error); } }; diff --git a/packages/vulcan-newsletter/lib/server/newsletters.js b/packages/vulcan-newsletter/lib/server/newsletters.js index 68e5070a5..0e4aa2b0f 100644 --- a/packages/vulcan-newsletter/lib/server/newsletters.js +++ b/packages/vulcan-newsletter/lib/server/newsletters.js @@ -42,8 +42,10 @@ Newsletters.subscribeUser = (user, confirm = false) => { throw 'User must have an email address'; } - console.log(`// Adding ${email} to ${provider} list…`); // eslint-disable-line + // eslint-disable-next-line no-console + console.log(`// Adding ${email} to ${provider} list…`); const result = Newsletters[provider].subscribe(email, confirm); + // eslint-disable-next-line no-console if (result) {console.log ('-> added')} Users.setSetting(user, 'newsletter_subscribeToNewsletter', true); } @@ -53,8 +55,10 @@ Newsletters.subscribeUser = (user, confirm = false) => { * @param {String} email */ Newsletters.subscribeEmail = (email, confirm = false) => { - console.log(`// Adding ${email} to ${provider} list…`); // eslint-disable-line + // eslint-disable-next-line no-console + console.log(`// Adding ${email} to ${provider} list…`); const result = Newsletters[provider].subscribe(email, confirm); + // eslint-disable-next-line no-console if (result) {console.log ('-> added')} } @@ -68,8 +72,9 @@ Newsletters.unsubscribeUser = (user) => { if (!email) { throw 'User must have an email address'; } - - console.log('// Removing "'+email+'" from list…'); // eslint-disable-line + + // eslint-disable-next-line no-console + console.log('// Removing "'+email+'" from list…'); Newsletters[provider].unsubscribe(email); Users.setSetting(user, 'newsletter_subscribeToNewsletter', false); } @@ -79,7 +84,8 @@ Newsletters.unsubscribeUser = (user) => { * @param {String} email */ Newsletters.unsubscribeEmail = (email) => { - console.log('// Removing "'+email+'" from list…'); // eslint-disable-line + // eslint-disable-next-line no-console + console.log('// Removing "'+email+'" from list…'); Newsletters[provider].unsubscribe(email); } @@ -238,8 +244,10 @@ Newsletters.send = async (isTest = false) => { if(newsletterEmail.isValid(data)){ + // eslint-disable-next-line no-console console.log('// Sending newsletter…'); - console.log('// Subject: '+subject) + // eslint-disable-next-line no-console + console.log('// Subject: '+subject); const newsletter = Newsletters[provider].send({ subject, text, html, isTest }); @@ -270,7 +278,8 @@ Newsletters.send = async (isTest = false) => { } } else { - + + // eslint-disable-next-line no-console console.log('No newsletter to schedule today…'); } diff --git a/packages/vulcan-payments/lib/components/Checkout.jsx b/packages/vulcan-payments/lib/components/Checkout.jsx index 91566dd27..48ce57117 100644 --- a/packages/vulcan-payments/lib/components/Checkout.jsx +++ b/packages/vulcan-payments/lib/components/Checkout.jsx @@ -1,6 +1,6 @@ import React from 'react' import StripeCheckout from 'react-stripe-checkout'; -import { Components, registerComponent, getSetting, registerSetting, withCurrentUser, withMessages } from 'meteor/vulcan:core'; +import { Components, registerComponent, getSetting, withCurrentUser, withMessages } from 'meteor/vulcan:core'; import Users from 'meteor/vulcan:users'; import { intlShape } from 'meteor/vulcan:i18n'; import classNames from 'classnames'; @@ -48,8 +48,9 @@ class Checkout extends React.Component { } }).catch(error => { - - console.log(error) + + // eslint-disable-next-line no-console + console.log(error); flash(this.context.intl.formatMessage({id: 'payments.error'}), 'error'); }); diff --git a/packages/vulcan-payments/lib/server/integrations/stripe.js b/packages/vulcan-payments/lib/server/integrations/stripe.js index 40675b905..165962a24 100644 --- a/packages/vulcan-payments/lib/server/integrations/stripe.js +++ b/packages/vulcan-payments/lib/server/integrations/stripe.js @@ -1,8 +1,6 @@ import { getSetting, registerSetting, newMutation, editMutation, Collections, registerCallback, runCallbacks, runCallbacksAsync } from 'meteor/vulcan:core'; import express from 'express'; import Stripe from 'stripe'; -import { Picker } from 'meteor/meteorhacks:picker'; -import bodyParser from 'body-parser'; import Charges from '../../modules/charges/collection.js'; import Users from 'meteor/vulcan:users'; import { Products } from '../../modules/products.js'; @@ -122,8 +120,8 @@ Create one-time charge. */ export const createCharge = async ({user, customer, product, collection, document, metadata, args}) => { - - const {token, userId, productKey, associatedId, properties, coupon } = args; + + const { /* token, userId, productKey, associatedId, properties, */ coupon } = args; let amount = product.amount; @@ -229,6 +227,7 @@ export const subscribeUser = async ({user, customer, product, collection, docume // create an invoice item and attach it to the customer first // see https://stripe.com/docs/subscriptions/invoices#adding-invoice-items if (product.initialAmount) { + // eslint-disable-next-line no-unused-vars const initialInvoiceItem = await stripe.invoiceItems.create({ customer: customer.id, amount: product.initialAmount, @@ -237,6 +236,7 @@ export const subscribeUser = async ({user, customer, product, collection, docume }); } + // eslint-disable-next-line no-unused-vars const subscription = await stripe.subscriptions.create({ customer: customer.id, items: [ @@ -246,8 +246,10 @@ export const subscribeUser = async ({user, customer, product, collection, docume }); } catch (error) { - console.log('// Stripe subscribeUser error') - console.log(error) + // eslint-disable-next-line no-console + console.log('// Stripe subscribeUser error'); + // eslint-disable-next-line no-console + console.log(error); } } @@ -283,7 +285,8 @@ app.use(addRawBody); app.post('/stripe', async function(req, res) { - console.log('////////////// stripe webhook') + // eslint-disable-next-line no-console + console.log('////////////// stripe webhook'); const sig = req.headers['stripe-signature']; @@ -291,30 +294,38 @@ app.post('/stripe', async function(req, res) { const event = stripe.webhooks.constructEvent(req.rawBody, sig, stripeSettings.endpointSecret); - console.log('event ///////////////////') - console.log(event) + // eslint-disable-next-line no-console + console.log('event ///////////////////'); + // eslint-disable-next-line no-console + console.log(event); switch (event.type) { case 'charge.succeeded': - console.log('////// charge succeeded') + // eslint-disable-next-line no-console + console.log('////// charge succeeded'); const charge = event.data.object; - console.log(charge) + // eslint-disable-next-line no-console + console.log(charge); try { // look up corresponding invoice const invoice = await stripe.invoices.retrieve(charge.invoice); - console.log('////// invoice') - console.log(invoice) + // eslint-disable-next-line no-console + console.log('////// invoice'); + // eslint-disable-next-line no-console + console.log(invoice); // look up corresponding subscription const subscription = await stripe.subscriptions.retrieve(invoice.subscription); - console.log('////// subscription') - console.log(subscription) + // eslint-disable-next-line no-console + console.log('////// subscription'); + // eslint-disable-next-line no-console + console.log(subscription); const { userId, productKey, associatedCollection, associatedId } = subscription.metadata; @@ -334,8 +345,10 @@ app.post('/stripe', async function(req, res) { } } catch (error) { - console.log('// Stripe webhook error') - console.log(error) + // eslint-disable-next-line no-console + console.log('// Stripe webhook error'); + // eslint-disable-next-line no-console + console.log(error); } break; @@ -343,8 +356,10 @@ app.post('/stripe', async function(req, res) { } } catch (error) { - console.log('///// Stripe webhook error') - console.log(error) + // eslint-disable-next-line no-console + console.log('///// Stripe webhook error'); + // eslint-disable-next-line no-console + console.log(error); } res.sendStatus(200); @@ -434,7 +449,7 @@ webAppConnectHandlersUse(Meteor.bindEnvironment(app), {name: 'stripe_endpoint', Meteor.startup(() => { Collections.forEach(c => { - collectionName = c._name.toLowerCase(); + const collectionName = c._name.toLowerCase(); registerCallback({ name: `${collectionName}.charge.sync`, diff --git a/packages/vulcan-users/lib/avatar.js b/packages/vulcan-users/lib/avatar.js index f56737962..c7e6464cd 100644 --- a/packages/vulcan-users/lib/avatar.js +++ b/packages/vulcan-users/lib/avatar.js @@ -33,7 +33,8 @@ Users.avatar = { * @return {String} md5 hash of the input */ hash: function (string) { - var self = this + var self = this; + // eslint-disable-next-line babel/new-cap return CryptoJS.MD5(self.cleanString(string)).toString() }, diff --git a/packages/vulcan-users/lib/resolvers.js b/packages/vulcan-users/lib/resolvers.js index a9167c6a3..72a7d370e 100644 --- a/packages/vulcan-users/lib/resolvers.js +++ b/packages/vulcan-users/lib/resolvers.js @@ -1,5 +1,4 @@ import { addGraphQLResolvers } from 'meteor/vulcan:lib'; -import Users from './collection.js'; const specificResolvers = { Query: { diff --git a/packages/vulcan-voting/lib/modules/make_voteable.js b/packages/vulcan-voting/lib/modules/make_voteable.js index 1963a71fa..1206dc5ef 100644 --- a/packages/vulcan-voting/lib/modules/make_voteable.js +++ b/packages/vulcan-voting/lib/modules/make_voteable.js @@ -1,3 +1,5 @@ +import Votes from './votes/collection.js'; + export const VoteableCollections = []; export const makeVoteable = collection => { diff --git a/packages/vulcan-voting/lib/modules/vote.js b/packages/vulcan-voting/lib/modules/vote.js index cc60900d4..82e1b9157 100644 --- a/packages/vulcan-voting/lib/modules/vote.js +++ b/packages/vulcan-voting/lib/modules/vote.js @@ -1,4 +1,4 @@ -import { debug, runCallbacksAsync, runCallbacks, addCallback } from 'meteor/vulcan:core'; +import { debug, /* runCallbacksAsync, runCallbacks, addCallback */ } from 'meteor/vulcan:core'; import { createError } from 'apollo-errors'; import Votes from './votes/collection.js'; import Users from 'meteor/vulcan:users'; diff --git a/packages/vulcan-voting/lib/modules/votes/collection.js b/packages/vulcan-voting/lib/modules/votes/collection.js index 650890b40..346e6828a 100644 --- a/packages/vulcan-voting/lib/modules/votes/collection.js +++ b/packages/vulcan-voting/lib/modules/votes/collection.js @@ -1,4 +1,4 @@ -import { createCollection, getDefaultResolvers, getDefaultMutations } from 'meteor/vulcan:core'; +import { createCollection, /* getDefaultResolvers, getDefaultMutations */ } from 'meteor/vulcan:core'; import schema from './schema.js'; const Votes = createCollection({ diff --git a/packages/vulcan-voting/lib/server/callbacks.js b/packages/vulcan-voting/lib/server/callbacks.js index 101aacb67..f48a1a1c0 100644 --- a/packages/vulcan-voting/lib/server/callbacks.js +++ b/packages/vulcan-voting/lib/server/callbacks.js @@ -1,7 +1,7 @@ -import { addCallback, Utils } from 'meteor/vulcan:core'; -import Users from 'meteor/vulcan:users'; -import { getVotePower } from '../modules/vote.js'; -import { updateScore } from './scoring.js'; +// import { addCallback, Utils } from 'meteor/vulcan:core'; +// import Users from 'meteor/vulcan:users'; +// import { getVotePower } from '../modules/vote.js'; +// import { updateScore } from './scoring.js'; // ----------------------------- vote.async ------------------------------- // diff --git a/packages/vulcan-voting/lib/server/graphql.js b/packages/vulcan-voting/lib/server/graphql.js index 68356fc43..138ee03e7 100644 --- a/packages/vulcan-voting/lib/server/graphql.js +++ b/packages/vulcan-voting/lib/server/graphql.js @@ -1,4 +1,4 @@ -import { addCallback, addGraphQLSchema, addGraphQLResolvers, addGraphQLMutation, Utils, registerSetting, getSetting } from 'meteor/vulcan:core'; +import { addCallback, addGraphQLSchema, addGraphQLResolvers, addGraphQLMutation } from 'meteor/vulcan:core'; import { performVoteServer } from '../modules/vote.js'; import { VoteableCollections } from '../modules/make_voteable.js';