From dfa4c77314b9eaf7cb048d7a47512e30aad5ed2f Mon Sep 17 00:00:00 2001 From: SachaG <358832+SachaG@users.noreply.github.com> Date: Sun, 16 Sep 2018 11:48:38 +0900 Subject: [PATCH] ESLint fixes --- .../imports/ui/components/Buttons.jsx | 2 +- .../imports/ui/components/Field.jsx | 4 +- .../imports/ui/components/Fields.jsx | 2 +- .../imports/ui/components/FormMessage.jsx | 2 +- .../imports/ui/components/FormMessages.jsx | 2 +- .../imports/ui/components/LoginFormInner.jsx | 44 +++++------ .../ui/components/PasswordOrService.jsx | 2 +- .../imports/ui/components/SocialButtons.jsx | 2 +- .../lib/modules/components/Card.jsx | 2 +- .../lib/modules/components/Error404.jsx | 2 +- .../lib/modules/components/HelloWorld.jsx | 12 +-- .../lib/modules/components/Icon.jsx | 2 +- .../lib/modules/components/Layout.jsx | 2 +- .../lib/modules/components/Loading.jsx | 2 +- .../lib/modules/components/ShowIf.jsx | 2 +- .../lib/modules/components/Welcome.jsx | 2 +- .../lib/components/Components.jsx | 12 +-- .../vulcan-debug/lib/components/Emails.jsx | 4 +- packages/vulcan-email/lib/server/email.js | 79 ++++++++----------- .../vulcan-embed/lib/components/EmbedURL.jsx | 2 +- .../vulcan-forms-tags/lib/components/Tags.jsx | 2 +- packages/vulcan-forms/lib/components/Form.jsx | 6 -- .../lib/components/FormWrapper.jsx | 6 +- packages/vulcan-lib/lib/modules/components.js | 2 +- .../vulcan-routing/lib/client/routing.jsx | 2 +- packages/vulcan-routing/lib/server/router.jsx | 2 +- .../vulcan-routing/lib/server/routing.jsx | 2 +- .../lib/components/SubscribeTo.jsx | 6 +- .../lib/components/forms/Datetime.jsx | 2 +- 29 files changed, 96 insertions(+), 117 deletions(-) diff --git a/packages/vulcan-accounts/imports/ui/components/Buttons.jsx b/packages/vulcan-accounts/imports/ui/components/Buttons.jsx index 5ad3f3146..9709efcc0 100755 --- a/packages/vulcan-accounts/imports/ui/components/Buttons.jsx +++ b/packages/vulcan-accounts/imports/ui/components/Buttons.jsx @@ -4,7 +4,7 @@ import { Components, registerComponent } from 'meteor/vulcan:core'; export class Buttons extends React.Component { render () { - let { buttons = {}, className = "buttons" } = this.props; + let { buttons = {}, className = 'buttons' } = this.props; return (
{Object.keys(buttons).map((id, i) => diff --git a/packages/vulcan-accounts/imports/ui/components/Field.jsx b/packages/vulcan-accounts/imports/ui/components/Field.jsx index abe1defe1..89288fd9c 100755 --- a/packages/vulcan-accounts/imports/ui/components/Field.jsx +++ b/packages/vulcan-accounts/imports/ui/components/Field.jsx @@ -49,8 +49,8 @@ export class AccountsField extends PureComponent { type = 'text', onChange, // required = false, - className = "field", - defaultValue = "", + className = 'field', + defaultValue = '', message, } = this.props; const { mount = true } = this.state; diff --git a/packages/vulcan-accounts/imports/ui/components/Fields.jsx b/packages/vulcan-accounts/imports/ui/components/Fields.jsx index bb42212a7..81dd0e37e 100755 --- a/packages/vulcan-accounts/imports/ui/components/Fields.jsx +++ b/packages/vulcan-accounts/imports/ui/components/Fields.jsx @@ -3,7 +3,7 @@ import { Components, registerComponent } from 'meteor/vulcan:core'; export class AccountsFields extends React.Component { render () { - let { fields = {}, className = "fields" } = this.props; + let { fields = {}, className = 'fields' } = this.props; return (
{Object.keys(fields).map((id, i) => diff --git a/packages/vulcan-accounts/imports/ui/components/FormMessage.jsx b/packages/vulcan-accounts/imports/ui/components/FormMessage.jsx index ca768616f..f97823a50 100755 --- a/packages/vulcan-accounts/imports/ui/components/FormMessage.jsx +++ b/packages/vulcan-accounts/imports/ui/components/FormMessage.jsx @@ -3,7 +3,7 @@ import { registerComponent } from 'meteor/vulcan:core'; export class AccountsFormMessage extends React.Component { render () { - let { message, type, className = "message", style = {} } = this.props; + 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 }
diff --git a/packages/vulcan-accounts/imports/ui/components/FormMessages.jsx b/packages/vulcan-accounts/imports/ui/components/FormMessages.jsx index 03d441cc0..f79438d64 100755 --- a/packages/vulcan-accounts/imports/ui/components/FormMessages.jsx +++ b/packages/vulcan-accounts/imports/ui/components/FormMessages.jsx @@ -3,7 +3,7 @@ import { Components, registerComponent } from 'meteor/vulcan:core'; export class AccountsFormMessages extends Component { render () { - const { messages = [], className = "messages", style = {} } = this.props; + const { messages = [], className = 'messages', style = {} } = this.props; return messages.length > 0 && (
{messages diff --git a/packages/vulcan-accounts/imports/ui/components/LoginFormInner.jsx b/packages/vulcan-accounts/imports/ui/components/LoginFormInner.jsx index 181c69454..a696b37bf 100644 --- a/packages/vulcan-accounts/imports/ui/components/LoginFormInner.jsx +++ b/packages/vulcan-accounts/imports/ui/components/LoginFormInner.jsx @@ -185,7 +185,7 @@ export class AccountsLoginFormInner extends TrackerComponent { hint: this.context.intl.formatMessage({id: 'accounts.enter_username_or_email'}), label: this.context.intl.formatMessage({id: 'accounts.username_or_email'}), required: true, - defaultValue: this.state.currentUsername || "", + defaultValue: this.state.currentUsername || '', onChange: this.handleChange.bind(this, 'usernameOrEmail'), message: this.getMessageForField('usernameOrEmail'), }; @@ -197,7 +197,7 @@ export class AccountsLoginFormInner extends TrackerComponent { hint: this.context.intl.formatMessage({id: 'accounts.enter_username'}), label: this.context.intl.formatMessage({id: 'accounts.username'}), required: true, - defaultValue: this.state.currentUsername || "", + defaultValue: this.state.currentUsername || '', onChange: this.handleChange.bind(this, 'username'), message: this.getMessageForField('username'), }; @@ -210,7 +210,7 @@ export class AccountsLoginFormInner extends TrackerComponent { label: this.context.intl.formatMessage({id: 'accounts.email'}), type: 'email', required: true, - defaultValue: this.state.email || "", + defaultValue: this.state.email || '', onChange: this.handleChange.bind(this, 'email'), message: this.getMessageForField('email'), }; @@ -223,7 +223,7 @@ export class AccountsLoginFormInner extends TrackerComponent { label: this.context.intl.formatMessage({id: 'accounts.password'}), type: 'password', required: true, - defaultValue: this.state.password || "", + defaultValue: this.state.password || '', onChange: this.handleChange.bind(this, 'password'), message: this.getMessageForField('password'), }; @@ -277,18 +277,18 @@ export class AccountsLoginFormInner extends TrackerComponent { if (hasPasswordService() && formState == STATES.SIGN_IN) { if (_.contains([ - "USERNAME_AND_EMAIL", - "USERNAME_AND_OPTIONAL_EMAIL", + 'USERNAME_AND_EMAIL', + 'USERNAME_AND_OPTIONAL_EMAIL', ], passwordSignupFields())) { loginFields.push(this.getUsernameOrEmailField()); } - if (passwordSignupFields() === "USERNAME_ONLY") { + if (passwordSignupFields() === 'USERNAME_ONLY') { loginFields.push(this.getUsernameField()); } if (_.contains([ - "EMAIL_ONLY", + 'EMAIL_ONLY', ], passwordSignupFields())) { loginFields.push(this.getEmailField()); } @@ -298,21 +298,21 @@ export class AccountsLoginFormInner extends TrackerComponent { if (hasPasswordService() && formState == STATES.SIGN_UP) { if (_.contains([ - "USERNAME_AND_EMAIL", - "USERNAME_AND_OPTIONAL_EMAIL", - "USERNAME_ONLY", + 'USERNAME_AND_EMAIL', + 'USERNAME_AND_OPTIONAL_EMAIL', + 'USERNAME_ONLY', ], passwordSignupFields())) { loginFields.push(this.getUsernameField()); } if (_.contains([ - "USERNAME_AND_EMAIL", - "EMAIL_ONLY", + 'USERNAME_AND_EMAIL', + 'EMAIL_ONLY', ], passwordSignupFields())) { loginFields.push(this.getEmailField()); } - if (_.contains(["USERNAME_AND_OPTIONAL_EMAIL"], passwordSignupFields())) { + if (_.contains(['USERNAME_AND_OPTIONAL_EMAIL'], passwordSignupFields())) { loginFields.push(Object.assign(this.getEmailField(), {required: false})); } @@ -495,7 +495,7 @@ export class AccountsLoginFormInner extends TrackerComponent { showForgotPasswordLink() { return this.state.formState == STATES.SIGN_IN && hasPasswordService() && _.contains( - ["USERNAME_AND_EMAIL", "USERNAME_AND_OPTIONAL_EMAIL", "EMAIL_ONLY"], + ['USERNAME_AND_EMAIL', 'USERNAME_AND_OPTIONAL_EMAIL', 'EMAIL_ONLY'], passwordSignupFields() ); } @@ -628,7 +628,7 @@ export class AccountsLoginFormInner extends TrackerComponent { if (usernameOrEmail !== null) { if (!this.validateField('username', usernameOrEmail)) { if (this.state.formState == STATES.SIGN_UP) { - this.state.onSubmitHook("error.accounts.usernameRequired", this.state.formState); + this.state.onSubmitHook('error.accounts.usernameRequired', this.state.formState); } error = true; } @@ -638,7 +638,7 @@ export class AccountsLoginFormInner extends TrackerComponent { } else if (username !== null) { if (!this.validateField('username', username)) { if (this.state.formState == STATES.SIGN_UP) { - this.state.onSubmitHook("error.accounts.usernameRequired", this.state.formState); + this.state.onSubmitHook('error.accounts.usernameRequired', this.state.formState); } error = true; } @@ -718,7 +718,7 @@ export class AccountsLoginFormInner extends TrackerComponent { serviceName = 'meteorDeveloperAccount'; } - const loginWithService = Meteor["loginWith" + capitalService()]; + const loginWithService = Meteor['loginWith' + capitalService()]; let options = {}; // use default scope unless specified if (Accounts.ui._options.requestPermissions[serviceName]) @@ -774,7 +774,7 @@ export class AccountsLoginFormInner extends TrackerComponent { if (username !== null) { if ( !this.validateField('username', username) ) { if (this.state.formState == STATES.SIGN_UP) { - this.state.onSubmitHook("error.accounts.usernameRequired", this.state.formState); + this.state.onSubmitHook('error.accounts.usernameRequired', this.state.formState); } error = true; } else { @@ -782,10 +782,10 @@ export class AccountsLoginFormInner extends TrackerComponent { } } else { if (_.contains([ - "USERNAME_AND_EMAIL", + 'USERNAME_AND_EMAIL', ], passwordSignupFields()) && !this.validateField('username', username) ) { if (this.state.formState == STATES.SIGN_UP) { - this.state.onSubmitHook("error.accounts.usernameRequired", this.state.formState); + this.state.onSubmitHook('error.accounts.usernameRequired', this.state.formState); } error = true; } @@ -798,7 +798,7 @@ export class AccountsLoginFormInner extends TrackerComponent { } if (!this.validateField('password', password)) { - onSubmitHook("Invalid password", formState); + onSubmitHook('Invalid password', formState); error = true; } else { options.password = password; diff --git a/packages/vulcan-accounts/imports/ui/components/PasswordOrService.jsx b/packages/vulcan-accounts/imports/ui/components/PasswordOrService.jsx index 6b8fbe8e8..9c39a751c 100755 --- a/packages/vulcan-accounts/imports/ui/components/PasswordOrService.jsx +++ b/packages/vulcan-accounts/imports/ui/components/PasswordOrService.jsx @@ -6,7 +6,7 @@ import { intlShape } from 'meteor/vulcan:i18n'; export class AccountsPasswordOrService extends PureComponent { render () { - let { className = "password-or-service", style = {} } = this.props; + let { className = 'password-or-service', style = {} } = this.props; const services = Object.keys(this.props.oauthServices).map(service => { return this.props.oauthServices[service].label; }); diff --git a/packages/vulcan-accounts/imports/ui/components/SocialButtons.jsx b/packages/vulcan-accounts/imports/ui/components/SocialButtons.jsx index 37e2ac2bb..dcf19d7c2 100755 --- a/packages/vulcan-accounts/imports/ui/components/SocialButtons.jsx +++ b/packages/vulcan-accounts/imports/ui/components/SocialButtons.jsx @@ -5,7 +5,7 @@ import { Components, registerComponent } from 'meteor/vulcan:core'; export class AccountsSocialButtons extends React.Component { render() { - let { oauthServices = {}, className = "social-buttons" } = this.props; + let { oauthServices = {}, className = 'social-buttons' } = this.props; return(
{Object.keys(oauthServices).map((id, i) => { diff --git a/packages/vulcan-core/lib/modules/components/Card.jsx b/packages/vulcan-core/lib/modules/components/Card.jsx index 728de4387..a87dfb9b0 100644 --- a/packages/vulcan-core/lib/modules/components/Card.jsx +++ b/packages/vulcan-core/lib/modules/components/Card.jsx @@ -172,7 +172,7 @@ const Card = ({title, className, collection, document, currentUser, fields, show ); }; -Card.displayName = "Card"; +Card.displayName = 'Card'; Card.propTypes = { className: PropTypes.string, diff --git a/packages/vulcan-core/lib/modules/components/Error404.jsx b/packages/vulcan-core/lib/modules/components/Error404.jsx index 79f9efe5d..2ac5c3a93 100644 --- a/packages/vulcan-core/lib/modules/components/Error404.jsx +++ b/packages/vulcan-core/lib/modules/components/Error404.jsx @@ -10,7 +10,7 @@ const Error404 = () => { ) } -Error404.displayName = "Error404"; +Error404.displayName = 'Error404'; registerComponent('Error404', Error404); diff --git a/packages/vulcan-core/lib/modules/components/HelloWorld.jsx b/packages/vulcan-core/lib/modules/components/HelloWorld.jsx index 8bbe6bf86..11bae5633 100644 --- a/packages/vulcan-core/lib/modules/components/HelloWorld.jsx +++ b/packages/vulcan-core/lib/modules/components/HelloWorld.jsx @@ -20,7 +20,7 @@ const header = { } const code = { - border: "1px solid #ccc", + border: '1px solid #ccc', borderRadius: 3, padding: '10px 20px', background: 'white', @@ -28,11 +28,11 @@ const code = { function escapeHtml(unsafe) { return unsafe - .replace(/&/g, "&") - .replace(//g, ">") - .replace(/"/g, """) - .replace(/'/g, "'"); + .replace(/&/g, '&') + .replace(//g, '>') + .replace(/"/g, '"') + .replace(/'/g, '''); } const HelloWorld = props => diff --git a/packages/vulcan-core/lib/modules/components/Icon.jsx b/packages/vulcan-core/lib/modules/components/Icon.jsx index 470acb2d9..aa03499a3 100644 --- a/packages/vulcan-core/lib/modules/components/Icon.jsx +++ b/packages/vulcan-core/lib/modules/components/Icon.jsx @@ -9,7 +9,7 @@ const Icon = ({ name, iconClass, onClick }) => { return ; } -Icon.displayName = "Icon"; +Icon.displayName = 'Icon'; registerComponent('Icon', Icon); diff --git a/packages/vulcan-core/lib/modules/components/Layout.jsx b/packages/vulcan-core/lib/modules/components/Layout.jsx index 45b6add96..e84e97471 100644 --- a/packages/vulcan-core/lib/modules/components/Layout.jsx +++ b/packages/vulcan-core/lib/modules/components/Layout.jsx @@ -4,7 +4,7 @@ import React from 'react'; const Layout = ({children}) =>
{children}
-Layout.displayName = "Layout"; +Layout.displayName = 'Layout'; registerComponent('Layout', Layout); diff --git a/packages/vulcan-core/lib/modules/components/Loading.jsx b/packages/vulcan-core/lib/modules/components/Loading.jsx index 6b85a1672..a34da33e9 100644 --- a/packages/vulcan-core/lib/modules/components/Loading.jsx +++ b/packages/vulcan-core/lib/modules/components/Loading.jsx @@ -11,7 +11,7 @@ const Loading = props => { ) } -Loading.displayName = "Loading"; +Loading.displayName = 'Loading'; registerComponent('Loading', Loading); diff --git a/packages/vulcan-core/lib/modules/components/ShowIf.jsx b/packages/vulcan-core/lib/modules/components/ShowIf.jsx index 0a53f0be7..2ae68bb12 100644 --- a/packages/vulcan-core/lib/modules/components/ShowIf.jsx +++ b/packages/vulcan-core/lib/modules/components/ShowIf.jsx @@ -15,6 +15,6 @@ ShowIf.propTypes = { failureComponent: PropTypes.object, }; -ShowIf.displayName = "ShowIf"; +ShowIf.displayName = 'ShowIf'; registerComponent('ShowIf', ShowIf, withCurrentUser); \ No newline at end of file diff --git a/packages/vulcan-core/lib/modules/components/Welcome.jsx b/packages/vulcan-core/lib/modules/components/Welcome.jsx index 7d81adfce..fc35053cd 100644 --- a/packages/vulcan-core/lib/modules/components/Welcome.jsx +++ b/packages/vulcan-core/lib/modules/components/Welcome.jsx @@ -19,7 +19,7 @@ const header = { } const code = { - border: "1px solid #ccc", + border: '1px solid #ccc', borderRadius: 3, padding: '10px 20px', background: 'white', diff --git a/packages/vulcan-debug/lib/components/Components.jsx b/packages/vulcan-debug/lib/components/Components.jsx index 348de3de0..b30b66b0e 100644 --- a/packages/vulcan-debug/lib/components/Components.jsx +++ b/packages/vulcan-debug/lib/components/Components.jsx @@ -1,15 +1,15 @@ -import React from "react"; +import React from 'react'; import { registerComponent, Components, ComponentsTable -} from "meteor/vulcan:lib"; +} from 'meteor/vulcan:lib'; const ComponentHOCs = ({ document }) => (
    {document.hocs.map((hoc, i) => ( -
  • {typeof hoc.name === "string" ? hoc.name : hoc[0].name}
  • +
  • {typeof hoc.name === 'string' ? hoc.name : hoc[0].name}
  • ))}
@@ -23,9 +23,9 @@ const ComponentsDashboard = props => ( showEdit={false} data={Object.values(ComponentsTable)} columns={[ - "name", + 'name', { - name: "hocs", + name: 'hocs', component: ComponentHOCs } ]} @@ -33,4 +33,4 @@ const ComponentsDashboard = props => (
); -registerComponent("Components", ComponentsDashboard); +registerComponent('Components', ComponentsDashboard); diff --git a/packages/vulcan-debug/lib/components/Emails.jsx b/packages/vulcan-debug/lib/components/Emails.jsx index fc51fa822..478a0e63b 100644 --- a/packages/vulcan-debug/lib/components/Emails.jsx +++ b/packages/vulcan-debug/lib/components/Emails.jsx @@ -34,11 +34,11 @@ class Email extends PureComponent { return ( {name} - {email.template} + {email.template} {typeof email.subject === 'function' ? email.subject({}) : email.subject} {email.path} -
+
Send Test {this.state.loading ? : null}
diff --git a/packages/vulcan-email/lib/server/email.js b/packages/vulcan-email/lib/server/email.js index 41f5ac3dd..2b760e9b9 100644 --- a/packages/vulcan-email/lib/server/email.js +++ b/packages/vulcan-email/lib/server/email.js @@ -23,10 +23,8 @@ VulcanEmail.addTemplates = templates => { _.extend(VulcanEmail.templates, templates); }; -VulcanEmail.getTemplate = templateName => Handlebars.compile( - VulcanEmail.templates[templateName], - { noEscape: true, strict: true} -); +VulcanEmail.getTemplate = templateName => + Handlebars.compile(VulcanEmail.templates[templateName], { noEscape: true, strict: true }); VulcanEmail.buildTemplate = (htmlContent, data = {}, locale) => { const emailProperties = { @@ -37,7 +35,7 @@ VulcanEmail.buildTemplate = (htmlContent, data = {}, locale) => { siteUrl: Utils.getSiteUrl(), body: htmlContent, unsubscribe: '', - accountLink: Utils.getSiteUrl()+'account', + accountLink: Utils.getSiteUrl() + 'account', footer: getSetting('emailFooter'), logoUrl: getSetting('logoUrl'), logoHeight: getSetting('logoHeight'), @@ -47,40 +45,33 @@ VulcanEmail.buildTemplate = (htmlContent, data = {}, locale) => { }; const emailHTML = VulcanEmail.getTemplate('wrapper')(emailProperties); - const inlinedHTML = Juice(emailHTML, {preserveMediaQueries: true}); - const doctype = '' + const inlinedHTML = Juice(emailHTML, { preserveMediaQueries: true }); + const doctype = + ''; - return doctype+inlinedHTML; + return doctype + inlinedHTML; }; VulcanEmail.generateTextVersion = html => { return htmlToText.fromString(html, { - wordwrap: 130 + wordwrap: 130, }); -} +}; VulcanEmail.send = (to, subject, html, text, throwErrors, cc, bcc, replyTo) => { // TODO: limit who can send emails // TODO: fix this error: Error: getaddrinfo ENOTFOUND - - if(typeof to === 'object'){ - var { - to, - cc, - bcc, - replyTo, - subject, - html, - text, - throwErrors, - } = to; + + if (typeof to === 'object') { + // eslint-disable-next-line no-redeclare + var { to, cc, bcc, replyTo, subject, html, text, throwErrors } = to; } const from = getSetting('defaultEmail', 'noreply@example.com'); const siteName = getSetting('title', 'Vulcan'); - subject = '['+siteName+'] '+subject; + subject = '[' + siteName + '] ' + subject; - if (typeof text === 'undefined'){ + if (typeof text === 'undefined') { // Auto-generate text version if it doesn't exist. Has bugs, but should be good enough. text = VulcanEmail.generateTextVersion(html); } @@ -93,49 +84,44 @@ VulcanEmail.send = (to, subject, html, text, throwErrors, cc, bcc, replyTo) => { replyTo: replyTo, subject: subject, text: text, - html: html + html: html, }; - - if (process.env.NODE_ENV === 'production' || getSetting('enableDevelopmentEmails', false)) { + if (process.env.NODE_ENV === 'production' || getSetting('enableDevelopmentEmails', false)) { console.log('//////// sending email…'); // eslint-disable-line - console.log('from: '+from); // eslint-disable-line - console.log("cc: " + cc); // eslint-disable-line - console.log("bcc: " + bcc); // eslint-disable-line - console.log("replyTo: " + replyTo); // eslint-disable-line + console.log('from: ' + from); // eslint-disable-line + console.log('cc: ' + cc); // eslint-disable-line + console.log('bcc: ' + bcc); // eslint-disable-line + console.log('replyTo: ' + replyTo); // eslint-disable-line // console.log('html: '+html); // console.log('text: '+text); try { Email.send(email); } catch (error) { - console.log("// error while sending email:"); // eslint-disable-line + console.log('// error while sending email:'); // eslint-disable-line console.log(error); // eslint-disable-line if (throwErrors) throw error; } - } else { - console.log('//////// sending email (simulation)…'); // eslint-disable-line - console.log('from: '+from); // eslint-disable-line - console.log('to: '+to); // eslint-disable-line - console.log("cc: " + cc); // eslint-disable-line - console.log("bcc: " + bcc); // eslint-disable-line - console.log("replyTo: " + replyTo); // eslint-disable-line - + console.log('from: ' + from); // eslint-disable-line + console.log('to: ' + to); // eslint-disable-line + console.log('cc: ' + cc); // eslint-disable-line + console.log('bcc: ' + bcc); // eslint-disable-line + console.log('replyTo: ' + replyTo); // eslint-disable-line } return email; - }; VulcanEmail.build = async ({ emailName, variables, locale }) => { // execute email's GraphQL query const email = VulcanEmail.emails[emailName]; - const result = email.query ? await runQuery(email.query, variables, { locale }) : {data: {}}; + const result = email.query ? await runQuery(email.query, variables, { locale }) : { data: {} }; // if email has a data() function, merge its return value with results from the query - const data = email.data ? {...result.data, ...email.data(variables)} : result.data; + const data = email.data ? { ...result.data, ...email.data(variables) } : result.data; const subject = typeof email.subject === 'function' ? email.subject(data) : email.subject; @@ -144,12 +130,11 @@ VulcanEmail.build = async ({ emailName, variables, locale }) => { const html = VulcanEmail.buildTemplate(VulcanEmail.getTemplate(email.template)(data), data, locale); return { data, subject, html }; -} +}; - -VulcanEmail.buildAndSend = async ({ to, cc, bcc, replyTo, emailName, variables, locale = getSetting("locale") }) => { +VulcanEmail.buildAndSend = async ({ to, cc, bcc, replyTo, emailName, variables, locale = getSetting('locale') }) => { const email = await VulcanEmail.build({ to, emailName, variables, locale }); - return VulcanEmail.send({to, cc, bcc, replyTo, subject: email.subject, html: email.html}); + return VulcanEmail.send({ to, cc, bcc, replyTo, subject: email.subject, html: email.html }); }; VulcanEmail.buildAndSendHTML = (to, subject, html) => VulcanEmail.send(to, subject, VulcanEmail.buildTemplate(html)); diff --git a/packages/vulcan-embed/lib/components/EmbedURL.jsx b/packages/vulcan-embed/lib/components/EmbedURL.jsx index 0fec19b34..f28be3253 100644 --- a/packages/vulcan-embed/lib/components/EmbedURL.jsx +++ b/packages/vulcan-embed/lib/components/EmbedURL.jsx @@ -128,7 +128,7 @@ class EmbedURL extends Component { return (
diff --git a/packages/vulcan-forms-tags/lib/components/Tags.jsx b/packages/vulcan-forms-tags/lib/components/Tags.jsx index 49f1f9540..635832806 100644 --- a/packages/vulcan-forms-tags/lib/components/Tags.jsx +++ b/packages/vulcan-forms-tags/lib/components/Tags.jsx @@ -23,7 +23,7 @@ class Tags extends PureComponent { this.state = { tags: tags, - suggestions: _.pluck(props.options, "label"), + suggestions: _.pluck(props.options, 'label'), value: props.value || [] }; } diff --git a/packages/vulcan-forms/lib/components/Form.jsx b/packages/vulcan-forms/lib/components/Form.jsx index 237327683..f1db211dc 100644 --- a/packages/vulcan-forms/lib/components/Form.jsx +++ b/packages/vulcan-forms/lib/components/Form.jsx @@ -58,12 +58,6 @@ import { convertSchema, formProperties } from '../modules/schema_utils'; import { isEmptyValue } from '../modules/utils'; import { getParentPath } from '../modules/path_utils'; -// unsetCompact -const unsetCompact = (object, path) => { - unset(object, path); - compactParent(object, path); -}; - const compactParent = (object, path) => { const parentPath = getParentPath(path); diff --git a/packages/vulcan-forms/lib/components/FormWrapper.jsx b/packages/vulcan-forms/lib/components/FormWrapper.jsx index 9d374794c..1f3dc610c 100644 --- a/packages/vulcan-forms/lib/components/FormWrapper.jsx +++ b/packages/vulcan-forms/lib/components/FormWrapper.jsx @@ -64,7 +64,7 @@ class FormWrapper extends PureComponent { // if a document is being passed, this is an edit form getFormType() { - return this.props.documentId || this.props.slug ? "edit" : "new"; + return this.props.documentId || this.props.slug ? 'edit' : 'new'; } // filter out fields with "." or "$" @@ -108,7 +108,7 @@ class FormWrapper extends PureComponent { let mutationFields = this.getFormType() === 'new' ? _.unique(createableFields.concat(readableFields)) : _.unique(createableFields.concat(updatetableFields)); // if "fields" prop is specified, restrict list of fields to it - if (typeof fields !== "undefined" && fields.length > 0) { + if (typeof fields !== 'undefined' && fields.length > 0) { queryFields = _.intersection(queryFields, fields); mutationFields = _.intersection(mutationFields, fields); } @@ -211,7 +211,7 @@ class FormWrapper extends PureComponent { {...props} />; }; - Loader.displayName = `withLoader(Form)`; + Loader.displayName = 'withLoader(Form)'; // if this is an edit from, load the necessary data using the withSingle HoC if (this.getFormType() === 'edit') { diff --git a/packages/vulcan-lib/lib/modules/components.js b/packages/vulcan-lib/lib/modules/components.js index e45f5b7a7..2651150e8 100644 --- a/packages/vulcan-lib/lib/modules/components.js +++ b/packages/vulcan-lib/lib/modules/components.js @@ -132,7 +132,7 @@ export const populateComponentsApp = () => { } return registerComponent(name, newComponent, ...newHocs, ...previousHocs); -}; +} export const copyHoCs = (sourceComponent, targetComponent) => { return compose(...sourceComponent.hocs)(targetComponent); diff --git a/packages/vulcan-routing/lib/client/routing.jsx b/packages/vulcan-routing/lib/client/routing.jsx index c3b635997..d515d0493 100644 --- a/packages/vulcan-routing/lib/client/routing.jsx +++ b/packages/vulcan-routing/lib/client/routing.jsx @@ -17,7 +17,7 @@ import { RouterClient } from './router.jsx'; Meteor.startup(() => { // note: route defined here because it "shouldn't be removable" - addRoute({name:"app.notfound", path:"*", componentName: 'Error404'}); + addRoute({name:'app.notfound', path:'*', componentName: 'Error404'}); // init the application components and routes, including components & routes from 3rd-party packages initializeFragments(); diff --git a/packages/vulcan-routing/lib/server/router.jsx b/packages/vulcan-routing/lib/server/router.jsx index cc127e8f4..eded83e76 100644 --- a/packages/vulcan-routing/lib/server/router.jsx +++ b/packages/vulcan-routing/lib/server/router.jsx @@ -25,7 +25,7 @@ function isAppUrl(req) { // we only need to support HTML pages only for browsers // Facebook's scraper uses a request header Accepts: */* // so allow either - const facebookAcceptsHeader = new RegExp("/*\/*/"); + const facebookAcceptsHeader = new RegExp('/*\/*/'); return /html/.test(req.headers.accept) || facebookAcceptsHeader.test(req.headers.accept); } diff --git a/packages/vulcan-routing/lib/server/routing.jsx b/packages/vulcan-routing/lib/server/routing.jsx index 374aec9d8..de9668651 100644 --- a/packages/vulcan-routing/lib/server/routing.jsx +++ b/packages/vulcan-routing/lib/server/routing.jsx @@ -17,7 +17,7 @@ import { RouterServer } from './router.jsx'; Meteor.startup(() => { // note: route defined here because it "shouldn't be removable" - addRoute({name:"app.notfound", path:"*", componentName: 'Error404'}); + addRoute({name:'app.notfound', path:'*', componentName: 'Error404'}); // init the application components and routes, including components & routes from 3rd-party packages initializeFragments(); diff --git a/packages/vulcan-subscribe/lib/components/SubscribeTo.jsx b/packages/vulcan-subscribe/lib/components/SubscribeTo.jsx index af7e54cb6..d90f12a96 100644 --- a/packages/vulcan-subscribe/lib/components/SubscribeTo.jsx +++ b/packages/vulcan-subscribe/lib/components/SubscribeTo.jsx @@ -39,11 +39,11 @@ class SubscribeToActionHandler extends PureComponent { {id: `${documentType}.${action}d`}, // handle usual name properties {name: document.name || document.title || document.displayName} - ), "success"); + ), 'success'); } catch(error) { - this.props.flash(error.message, "error"); + this.props.flash(error.message, 'error'); } } @@ -58,7 +58,7 @@ class SubscribeToActionHandler extends PureComponent { return null; } - const className = this.props.className ? this.props.className : ""; + const className = this.props.className ? this.props.className : ''; return Users.canDo(currentUser, action) ? : null; } diff --git a/packages/vulcan-ui-bootstrap/lib/components/forms/Datetime.jsx b/packages/vulcan-ui-bootstrap/lib/components/forms/Datetime.jsx index 0d4ba024b..dece5d99c 100644 --- a/packages/vulcan-ui-bootstrap/lib/components/forms/Datetime.jsx +++ b/packages/vulcan-ui-bootstrap/lib/components/forms/Datetime.jsx @@ -33,7 +33,7 @@ class DateTime extends PureComponent { value={date} // newDate argument is a Moment object given by react-datetime onChange={newDate => this.updateDate(newDate._d)} - format={"x"} + format={'x'} inputProps={{name: this.props.name}} />