From 7533dc0ac61b17de7fe5cbb4487f30fface052ec Mon Sep 17 00:00:00 2001 From: Ben Gotow Date: Fri, 6 May 2016 16:06:16 -0700 Subject: [PATCH] fix(lint): Various linter issues --- build/config/eslint.json | 2 +- .../composer-templates/lib/template-store.es6 | 8 +- .../spec/template-store-spec.es6 | 12 +- .../decorators/inflate-draft-client-id.es6 | 2 +- internal_packages/composer/lib/main.es6 | 2 +- .../lib/sidebar-participant-picker.jsx | 10 +- .../lib/headers/account-error-header.jsx | 52 ++++--- .../lib/headers/connection-status-header.jsx | 5 +- .../lib/sidebar-participant-profile.jsx | 33 +++-- .../lib/sidebar-related-threads.jsx | 8 +- internal_packages/plugins/lib/package.jsx | 8 +- .../plugins/lib/packages-store.jsx | 10 +- .../plugins/lib/plugins-actions.jsx | 6 +- .../plugins/lib/plugins-tabs-view.jsx | 20 +-- .../plugins/lib/preferences-plugins.jsx | 10 +- internal_packages/plugins/lib/tab-explore.jsx | 11 +- .../plugins/lib/tab-installed.jsx | 14 +- .../lib/tabs/preferences-account-details.jsx | 44 +++--- .../lib/tabs/workspace-section.jsx | 14 +- .../theme-picker/lib/theme-option.jsx | 3 +- .../lib/injects-toolbar-buttons.jsx | 3 +- .../thread-list/lib/message-list-toolbar.jsx | 40 +++-- .../thread-list/lib/selected-items-stack.jsx | 6 +- .../lib/thread-list-context-menu.es6 | 10 +- .../thread-snooze/lib/snooze-buttons.jsx | 20 ++- .../thread-snooze/lib/snooze-mail-label.jsx | 5 +- .../thread-snooze/lib/snooze-popover.jsx | 9 +- .../thread-snooze/spec/snooze-utils-spec.es6 | 8 +- .../composer-extension-adapter-spec.es6 | 8 +- spec/mailbox-perspective-spec.es6 | 24 +-- spec/stores/draft-factory-spec.es6 | 8 +- src/browser/auto-update-manager.es6 | 1 + src/browser/window-manager.es6 | 2 +- src/components/date-input.jsx | 3 +- src/components/date-picker.jsx | 6 +- src/components/editable-list.jsx | 19 ++- src/components/mail-label-set.jsx | 6 +- src/components/modal.jsx | 3 +- src/components/multiselect-toolbar.jsx | 6 +- .../calendar-event-container.jsx | 3 +- .../nylas-calendar/calendar-event.jsx | 3 +- .../nylas-calendar/header-controls.jsx | 12 +- .../nylas-calendar/mini-month-view.jsx | 13 +- src/components/nylas-calendar/month-view.jsx | 4 - .../nylas-calendar/nylas-calendar.jsx | 8 +- .../week-view-all-day-events.jsx | 4 +- .../nylas-calendar/week-view-event-column.jsx | 15 +- src/components/nylas-calendar/week-view.jsx | 28 +++- src/components/outline-view-item.jsx | 24 +-- src/components/outline-view.jsx | 15 +- src/components/participants-text-field.jsx | 47 +++--- src/components/retina-img.jsx | 16 +- src/components/scrollbar-ticks.jsx | 2 +- src/components/selectable-table.jsx | 4 +- src/components/switch.jsx | 36 ++--- src/components/table.jsx | 6 + src/date-utils.es6 | 4 +- src/dom-walkers.es6 | 2 +- src/extension-registry.es6 | 2 - src/extensions/composer-extension-adapter.es6 | 140 ------------------ .../message-view-extension-adapter.es6 | 21 --- src/flux/models/account.es6 | 1 + src/flux/nylas-long-connection.es6 | 1 + src/flux/stores/badge-store.es6 | 1 + src/flux/stores/recently-read-store.es6 | 4 +- .../stores/searchable-component-store.es6 | 2 +- src/flux/tasks/change-folder-task.es6 | 1 + src/flux/tasks/change-mail-task.es6 | 7 +- src/flux/tasks/destroy-draft-task.es6 | 3 - src/flux/tasks/destroy-model-task.es6 | 1 + src/pro | 2 +- src/searchable-components/real-dom-parser.es6 | 2 +- src/searchable-components/search-match.jsx | 33 +++-- .../searchable-component-maker.jsx | 5 +- src/serializable-registry.es6 | 8 +- src/store-registry.es6 | 14 +- src/system-start-service.es6 | 8 +- src/virtual-dom-utils.es6 | 6 +- 78 files changed, 445 insertions(+), 524 deletions(-) delete mode 100644 src/extensions/composer-extension-adapter.es6 delete mode 100644 src/extensions/message-view-extension-adapter.es6 diff --git a/build/config/eslint.json b/build/config/eslint.json index 5514fcbbc..fb26081f3 100644 --- a/build/config/eslint.json +++ b/build/config/eslint.json @@ -34,7 +34,7 @@ "quote-props": ["error", "consistent-as-needed", { "keywords": true }], "no-param-reassign": ["error", { "props": false }], "semi": "off", - "import/no-unresolved": ["error", {"ignore": ["nylas-exports", "nylas-component-kit", "electron", "nylas-store", "react-dom/server", "nylas-observables"]}], + "import/no-unresolved": ["error", {"ignore": ["nylas-exports", "nylas-component-kit", "electron", "nylas-store", "react-dom/server", "nylas-observables", "windows-shortcuts"]}], "react/no-multi-comp": "off", "react/prop-types": ["error", {"ignore": ["children"]}], "react/sort-comp": "error" diff --git a/internal_packages/composer-templates/lib/template-store.es6 b/internal_packages/composer-templates/lib/template-store.es6 index 1be259a93..48124af58 100644 --- a/internal_packages/composer-templates/lib/template-store.es6 +++ b/internal_packages/composer-templates/lib/template-store.es6 @@ -1,3 +1,5 @@ +/* eslint global-require: 0*/ + import {DraftStore, Actions, QuotedHTMLTransformer} from 'nylas-exports'; import NylasStore from 'nylas-store'; import path from 'path'; @@ -105,8 +107,8 @@ class TemplateStore extends NylasStore { if (draftClientId) { DraftStore.sessionForClientId(draftClientId).then((session) => { const draft = session.draft(); - const draftName = name ? name : draft.subject.replace(TemplateStore.INVALID_TEMPLATE_NAME_REGEX, ''); - let draftContents = contents ? contents : QuotedHTMLTransformer.removeQuotedHTML(draft.body); + const draftName = name || draft.subject.replace(TemplateStore.INVALID_TEMPLATE_NAME_REGEX, ''); + let draftContents = contents || QuotedHTMLTransformer.removeQuotedHTML(draft.body); const sigIndex = draftContents.indexOf(''); draftContents = sigIndex > -1 ? draftContents.slice(0, sigIndex) : draftContents; @@ -203,7 +205,7 @@ class TemplateStore extends NylasStore { deleteTemplate(name, callback) { const template = this._getTemplate(name); - if (!template) { return undefined; } + if (!template) { return; } if (this._displayDialog( 'Delete this template?', diff --git a/internal_packages/composer-templates/spec/template-store-spec.es6 b/internal_packages/composer-templates/spec/template-store-spec.es6 index aa04a610f..0beca3073 100644 --- a/internal_packages/composer-templates/spec/template-store-spec.es6 +++ b/internal_packages/composer-templates/spec/template-store-spec.es6 @@ -31,7 +31,7 @@ describe('TemplateStore', function templateStore() { }); it('should create the templates folder if it does not exist', () => { - spyOn(fs, 'exists').andCallFake((path, callback) => callback(false) ); + spyOn(fs, 'exists').andCallFake((path, callback) => callback(false)); TemplateStore._init(stubTemplatesDir); expect(fs.mkdir).toHaveBeenCalled(); }); @@ -39,7 +39,7 @@ describe('TemplateStore', function templateStore() { it('should expose templates in the templates directory', () => { let watchCallback; spyOn(fs, 'exists').andCallFake((path, callback) => { callback(true); }); - spyOn(fs, 'watch').andCallFake((path, callback) => watchCallback = callback); + spyOn(fs, 'watch').andCallFake((path, callback) => { watchCallback = callback }); spyOn(fs, 'readdir').andCallFake((path, callback) => { callback(null, Object.keys(stubTemplateFiles)); }); TemplateStore._init(stubTemplatesDir); watchCallback(); @@ -51,7 +51,7 @@ describe('TemplateStore', function templateStore() { let watchFired = false; spyOn(fs, 'exists').andCallFake((path, callback) => callback(true)); - spyOn(fs, 'watch').andCallFake((path, callback) => watchCallback = callback); + spyOn(fs, 'watch').andCallFake((path, callback) => { watchCallback = callback }); spyOn(fs, 'readdir').andCallFake((path, callback) => { if (watchFired) { callback(null, Object.keys(stubTemplateFiles)); @@ -71,7 +71,7 @@ describe('TemplateStore', function templateStore() { xit('should insert the template with the given id into the draft with the given id', () => { let watchCallback; spyOn(fs, 'exists').andCallFake((path, callback) => { callback(true); }); - spyOn(fs, 'watch').andCallFake((path, callback) => watchCallback = callback); + spyOn(fs, 'watch').andCallFake((path, callback) => { watchCallback = callback }); spyOn(fs, 'readdir').andCallFake((path, callback) => { callback(null, Object.keys(stubTemplateFiles)); }); TemplateStore._init(stubTemplatesDir); watchCallback(); @@ -151,7 +151,7 @@ describe('TemplateStore', function templateStore() { runs(() => { TemplateStore._onCreateTemplate({draftClientId: 'localid-b'}); }); - waitsFor(() => TemplateStore.trigger.callCount > 0 ); + waitsFor(() => TemplateStore.trigger.callCount > 0); runs(() => { expect(TemplateStore.items().length).toEqual(1); }); @@ -163,7 +163,7 @@ describe('TemplateStore', function templateStore() { runs(() => { TemplateStore._onCreateTemplate({draftClientId: 'localid-nosubject'}); }); - waitsFor(() => TemplateStore._displayError.callCount > 0 ); + waitsFor(() => TemplateStore._displayError.callCount > 0); runs(() => { expect(TemplateStore._displayError).toHaveBeenCalled(); }); diff --git a/internal_packages/composer/lib/decorators/inflate-draft-client-id.es6 b/internal_packages/composer/lib/decorators/inflate-draft-client-id.es6 index f0342700f..52a31abeb 100644 --- a/internal_packages/composer/lib/decorators/inflate-draft-client-id.es6 +++ b/internal_packages/composer/lib/decorators/inflate-draft-client-id.es6 @@ -92,7 +92,7 @@ function InflateDraftClientId(ComposedComponent) { render() { if (!this.state.draft) { - return ; + return ; } return ; } diff --git a/internal_packages/composer/lib/main.es6 b/internal_packages/composer/lib/main.es6 index c9a472bf3..86ab12140 100644 --- a/internal_packages/composer/lib/main.es6 +++ b/internal_packages/composer/lib/main.es6 @@ -35,7 +35,7 @@ class ComposerWithWindowProps extends React.Component { } componentWillUnmount() { - if (this._usub) {this._usub()} + if (this._usub) { this._usub() } } componentDidUpdate() { diff --git a/internal_packages/message-list/lib/sidebar-participant-picker.jsx b/internal_packages/message-list/lib/sidebar-participant-picker.jsx index 6032f9960..a5b3974b1 100644 --- a/internal_packages/message-list/lib/sidebar-participant-picker.jsx +++ b/internal_packages/message-list/lib/sidebar-participant-picker.jsx @@ -7,6 +7,11 @@ const SPLIT_KEY = "---splitvalue---" export default class SidebarParticipantPicker extends React.Component { static displayName = 'SidebarParticipantPicker'; + static containerStyles = { + order: 0, + flexShrink: 0, + }; + constructor(props) { super(props); this.state = this._getStateFromStores(); @@ -22,11 +27,6 @@ export default class SidebarParticipantPicker extends React.Component { this._usub(); } - static containerStyles = { - order: 0, - flexShrink: 0, - }; - _getStateFromStores() { return { sortedContacts: FocusedContactsStore.sortedContacts(), diff --git a/internal_packages/notifications/lib/headers/account-error-header.jsx b/internal_packages/notifications/lib/headers/account-error-header.jsx index 404a83a62..beb622af3 100644 --- a/internal_packages/notifications/lib/headers/account-error-header.jsx +++ b/internal_packages/notifications/lib/headers/account-error-header.jsx @@ -1,3 +1,4 @@ +/* eslint global-require: 0 */ import {AccountStore, Account, Actions, React} from 'nylas-exports' import {RetinaImg} from 'nylas-component-kit' @@ -39,12 +40,15 @@ export default class AccountErrorHeader extends React.Component { renderErrorHeader(message, buttonName, actionCallback) { return (
-
- +
+
{message}
@@ -62,32 +66,32 @@ export default class AccountErrorHeader extends React.Component { switch (account.syncState) { - case Account.SYNC_STATE_AUTH_FAILED: - return this.renderErrorHeader( - `Nylas N1 can no longer authenticate with ${account.emailAddress}. Click here to reconnect.`, - "Reconnect", - ()=>this._reconnect(account)); + case Account.SYNC_STATE_AUTH_FAILED: + return this.renderErrorHeader( + `Nylas N1 can no longer authenticate with ${account.emailAddress}. Click here to reconnect.`, + "Reconnect", + () => this._reconnect(account)); - case Account.SYNC_STATE_STOPPED: - return this.renderErrorHeader( - `The cloud sync for ${account.emailAddress} has been disabled. You will - not be able to send or receive mail. Please contact Nylas support.`, - "Contact support", - ()=>this._contactSupport()); + case Account.SYNC_STATE_STOPPED: + return this.renderErrorHeader( + `The cloud sync for ${account.emailAddress} has been disabled. You will + not be able to send or receive mail. Please contact Nylas support.`, + "Contact support", + () => this._contactSupport()); - default: - return this.renderErrorHeader( - `Nylas encountered an error while syncing mail for ${account.emailAddress} - we're - looking into it. Contact Nylas support for details.`, - "Contact support", - ()=>this._contactSupport()); + default: + return this.renderErrorHeader( + `Nylas encountered an error while syncing mail for ${account.emailAddress} - we're + looking into it. Contact Nylas support for details.`, + "Contact support", + () => this._contactSupport()); } } if (errorAccounts.length > 1) { return this.renderErrorHeader("Several of your accounts are having issues. " + "You will not be able to send or receive mail. Click here to manage your accounts.", "Open preferences", - ()=>this._openPreferences()); + () => this._openPreferences()); } return false; } diff --git a/internal_packages/notifications/lib/headers/connection-status-header.jsx b/internal_packages/notifications/lib/headers/connection-status-header.jsx index 54a60667e..c74b0a4e8 100644 --- a/internal_packages/notifications/lib/headers/connection-status-header.jsx +++ b/internal_packages/notifications/lib/headers/connection-status-header.jsx @@ -88,7 +88,7 @@ export default class ConnectionStatusHeader extends React.Component { const {connected, nextRetryText} = this.state; if (connected) { - return (); + return (); } const apiDomain = NylasAPI.APIRoot.split('//').pop(); @@ -99,7 +99,8 @@ export default class ConnectionStatusHeader extends React.Component { + mode={RetinaImg.Mode.ContentPreserve} + />
Nylas N1 isn't able to reach {apiDomain}. Retrying {nextRetryText}.
diff --git a/internal_packages/participant-profile/lib/sidebar-participant-profile.jsx b/internal_packages/participant-profile/lib/sidebar-participant-profile.jsx index 1496559b4..8a7708f87 100644 --- a/internal_packages/participant-profile/lib/sidebar-participant-profile.jsx +++ b/internal_packages/participant-profile/lib/sidebar-participant-profile.jsx @@ -13,6 +13,10 @@ export default class SidebarParticipantProfile extends React.Component { contactThreads: React.PropTypes.array, } + static containerStyles = { + order: 0, + } + constructor(props) { super(props); @@ -42,16 +46,12 @@ export default class SidebarParticipantProfile extends React.Component { this.usub() } - static containerStyles = { - order: 0, - } - _renderProfilePhoto() { if (this.state.profilePhotoUrl) { return (
- + Profile
) @@ -66,8 +66,11 @@ export default class SidebarParticipantProfile extends React.Component { return (
-
{abv} +
+ {abv}
@@ -92,11 +95,13 @@ export default class SidebarParticipantProfile extends React.Component { _renderSocialProfiles() { if (!this.state.socialProfiles) { return false } const profiles = _.map(this.state.socialProfiles, (profile, type) => { - const linkFn = () => {shell.openExternal(profile.url)} + const linkFn = () => { shell.openExternal(profile.url) } return ( - + ) }); @@ -135,9 +140,11 @@ export default class SidebarParticipantProfile extends React.Component { if (!this.state.location) { return false; } return (

- + {this.state.location}

) diff --git a/internal_packages/participant-profile/lib/sidebar-related-threads.jsx b/internal_packages/participant-profile/lib/sidebar-related-threads.jsx index f1a25db17..bf4f8dbc6 100644 --- a/internal_packages/participant-profile/lib/sidebar-related-threads.jsx +++ b/internal_packages/participant-profile/lib/sidebar-related-threads.jsx @@ -9,16 +9,16 @@ export default class RelatedThreads extends React.Component { contactThreads: React.PropTypes.array, } + static containerStyles = { + order: 99, + } + constructor(props) { super(props) this.state = {expanded: false} this.DEFAULT_NUM = 3 } - static containerStyles = { - order: 99, - } - _onClick(thread) { Actions.setFocus({collection: 'thread', item: thread}) } diff --git a/internal_packages/plugins/lib/package.jsx b/internal_packages/plugins/lib/package.jsx index 71e992b44..3093473b5 100644 --- a/internal_packages/plugins/lib/package.jsx +++ b/internal_packages/plugins/lib/package.jsx @@ -9,11 +9,7 @@ class Package extends React.Component { static displayName = 'Package'; static propTypes = { - package: React.PropTypes.object.isRequired, - } - - constructor() { - super(); + 'package': React.PropTypes.object.isRequired, } _onDisablePackage = () => { @@ -47,7 +43,7 @@ class Package extends React.Component { let uninstallButton = null; if (this.props.package.icon) { - icon = (); + icon = (); } else if (this.props.package.theme) { icon = (); } diff --git a/internal_packages/plugins/lib/packages-store.jsx b/internal_packages/plugins/lib/packages-store.jsx index 5b02a0d5e..d6a7e7ae4 100644 --- a/internal_packages/plugins/lib/packages-store.jsx +++ b/internal_packages/plugins/lib/packages-store.jsx @@ -277,8 +277,10 @@ const PackagesStore = Reflux.createStore({ } fs.mkdir(packageDir, (err) => { - if (err) return this._displayMessage('Could not create plugin', err.toString()); - + if (err) { + this._displayMessage('Could not create plugin', err.toString()); + return; + } const {resourcePath} = NylasEnv.getLoadSettings(); const packageTemplatePath = path.join(resourcePath, 'static', 'package-template'); const packageJSON = { @@ -293,8 +295,8 @@ const PackagesStore = Reflux.createStore({ nylas: `>=${NylasEnv.getVersion().split('-')[0]}`, }, windowTypes: { - default: true, - composer: true, + 'default': true, + 'composer': true, }, description: "Enter a description of your package!", dependencies: {}, diff --git a/internal_packages/plugins/lib/plugins-actions.jsx b/internal_packages/plugins/lib/plugins-actions.jsx index a663ed614..35e0d4485 100644 --- a/internal_packages/plugins/lib/plugins-actions.jsx +++ b/internal_packages/plugins/lib/plugins-actions.jsx @@ -19,10 +19,8 @@ const Actions = Reflux.createActions([ 'refreshInstalledPackages', ]); -for (const key in Actions) { - if (Actions.hasOwnProperty(key)) { - Actions[key].sync = true; - } +for (const key of Object.keys(Actions)) { + Actions[key].sync = true; } export default Actions; diff --git a/internal_packages/plugins/lib/plugins-tabs-view.jsx b/internal_packages/plugins/lib/plugins-tabs-view.jsx index 4f12d9d49..492350972 100644 --- a/internal_packages/plugins/lib/plugins-tabs-view.jsx +++ b/internal_packages/plugins/lib/plugins-tabs-view.jsx @@ -11,7 +11,14 @@ class PluginsTabs extends React.Component { static displayName = 'PluginsTabs'; static propTypes = { - 'onChange': React.PropTypes.Func, + onChange: React.PropTypes.Func, + }; + + static containerRequired = false; + + static containerStyles = { + minWidth: 200, + maxWidth: 290, }; constructor() { @@ -28,13 +35,6 @@ class PluginsTabs extends React.Component { this._unsubscribers.forEach(unsubscribe => unsubscribe()); } - static containerRequired = false; - - static containerStyles = { - minWidth: 200, - maxWidth: 290, - }; - _getStateFromStores() { return { tabIndex: TabsStore.tabIndex(), @@ -48,8 +48,8 @@ class PluginsTabs extends React.Component { _renderItems() { return Tabs.map(({name, key, icon}, idx) => { const classes = classNames({ - 'tab': true, - 'active': idx === this.state.tabIndex, + tab: true, + active: idx === this.state.tabIndex, }); return (
  • PluginsActions.selectTabIndex(idx)}>{name}
  • ); }); diff --git a/internal_packages/plugins/lib/preferences-plugins.jsx b/internal_packages/plugins/lib/preferences-plugins.jsx index c83f4f661..920433614 100644 --- a/internal_packages/plugins/lib/preferences-plugins.jsx +++ b/internal_packages/plugins/lib/preferences-plugins.jsx @@ -8,6 +8,11 @@ class PluginsView extends React.Component { static displayName = 'PluginsView'; + static containerStyles = { + minWidth: 500, + maxWidth: 99999, + } + constructor() { super(); this.state = this._getStateFromStores(); @@ -22,11 +27,6 @@ class PluginsView extends React.Component { this._unsubscribers.forEach(unsubscribe => unsubscribe()); } - static containerStyles = { - minWidth: 500, - maxWidth: 99999, - } - _getStateFromStores() { return {tabIndex: TabsStore.tabIndex()}; } diff --git a/internal_packages/plugins/lib/tab-explore.jsx b/internal_packages/plugins/lib/tab-explore.jsx index 935149a32..9d4c2bcd7 100644 --- a/internal_packages/plugins/lib/tab-explore.jsx +++ b/internal_packages/plugins/lib/tab-explore.jsx @@ -67,16 +67,19 @@ class TabExplore extends React.Component { type="text" className="search" value={this.state.search} - onChange={this._onSearchChange } - placeholder="Search Packages and Themes"/> + onChange={this._onSearchChange} + placeholder="Search Packages and Themes" + /> + packages={collection.themes} + /> + packages={collection.packages} + />
    ); diff --git a/internal_packages/plugins/lib/tab-installed.jsx b/internal_packages/plugins/lib/tab-installed.jsx index fac1b59d2..f7f353021 100644 --- a/internal_packages/plugins/lib/tab-installed.jsx +++ b/internal_packages/plugins/lib/tab-installed.jsx @@ -69,7 +69,7 @@ class TabInstalled extends React.Component { devEmpty = ( {`You don't have any packages installed in ~/.nylas/dev/packages. `} These plugins are only loaded when you run the app with debug flags - enabled (via the Developer menu).

    Learn more about building + enabled (via the Developer menu).

    Learn more about building plugins with our docs.
    ); devCTA = (
    Create New Plugin...
    ); @@ -85,19 +85,23 @@ class TabInstalled extends React.Component { className="search" value={this.state.search} onChange={this._onSearchChange} - placeholder="Search Installed Plugins" /> + placeholder="Search Installed Plugins" + /> {`You don't have any plugins installed in ~/.nylas/packages.`}} /> + emptyText={searchEmpty || {`You don't have any plugins installed in ~/.nylas/packages.`}} + /> + packages={this.state.packages.example} + /> + emptyText={searchEmpty || devEmpty} + />
    {devCTA}
    diff --git a/internal_packages/preferences/lib/tabs/preferences-account-details.jsx b/internal_packages/preferences/lib/tabs/preferences-account-details.jsx index c75276e52..dd84b8d96 100644 --- a/internal_packages/preferences/lib/tabs/preferences-account-details.jsx +++ b/internal_packages/preferences/lib/tabs/preferences-account-details.jsx @@ -1,3 +1,4 @@ +/* eslint global-require: 0 */ import _ from 'underscore'; import React, {Component, PropTypes} from 'react'; import {EditableList, NewsletterSignup} from 'nylas-component-kit'; @@ -55,7 +56,7 @@ class PreferencesAccountDetails extends Component { this.props.onAccountUpdated(this.props.account, this.state.account); }; - _setState = (updates, callback = ()=>{}) => { + _setState = (updates, callback = () => {}) => { const updated = _.extend({}, this.state.account, updates); this.setState({account: updated}, callback); }; @@ -131,6 +132,7 @@ class PreferencesAccountDetails extends Component {
    ); } + return null; } @@ -140,28 +142,30 @@ class PreferencesAccountDetails extends Component { {buttonText}
    ) } + _renderSyncErrorDetails() { const {account} = this.state; if (account.hasSyncStateError()) { switch (account.syncState) { - case Account.SYNC_STATE_AUTH_FAILED: - return this._renderErrorDetail( - `Nylas N1 can no longer authenticate with ${account.emailAddress}. The password or - authentication may have changed.`, - "Reconnect", - ()=>this._reconnect()); - case Account.SYNC_STATE_STOPPED: - return this._renderErrorDetail( - `The cloud sync for ${account.emailAddress} has been disabled. Please contact Nylas support.`, - "Contact support", - ()=>this._contactSupport()); - default: - return this._renderErrorDetail( - `Nylas encountered an error while syncing mail for ${account.emailAddress}. Contact Nylas support for details.`, - "Contact support", - ()=>this._contactSupport()); + case Account.SYNC_STATE_AUTH_FAILED: + return this._renderErrorDetail( + `Nylas N1 can no longer authenticate with ${account.emailAddress}. The password or + authentication may have changed.`, + "Reconnect", + () => this._reconnect()); + case Account.SYNC_STATE_STOPPED: + return this._renderErrorDetail( + `The cloud sync for ${account.emailAddress} has been disabled. Please contact Nylas support.`, + "Contact support", + () => this._contactSupport()); + default: + return this._renderErrorDetail( + `Nylas encountered an error while syncing mail for ${account.emailAddress}. Contact Nylas support for details.`, + "Contact support", + () => this._contactSupport()); } } + return null; } render() { @@ -178,7 +182,8 @@ class PreferencesAccountDetails extends Component { type="text" value={account.label} onBlur={this._saveChanges} - onChange={this._onAccountLabelUpdated} /> + onChange={this._onAccountLabelUpdated} + />

    Aliases

    @@ -193,7 +198,8 @@ class PreferencesAccountDetails extends Component { createInputProps={{placeholder: aliasPlaceholder}} onItemCreated={this._onAccountAliasCreated} onItemEdited={this._onAccountAliasUpdated} - onDeleteItem={this._onAccountAliasRemoved} /> + onDeleteItem={this._onAccountAliasRemoved} + /> {this._renderDefaultAliasSelector(account)} diff --git a/internal_packages/preferences/lib/tabs/workspace-section.jsx b/internal_packages/preferences/lib/tabs/workspace-section.jsx index b6937c6b0..9a2902ed4 100644 --- a/internal_packages/preferences/lib/tabs/workspace-section.jsx +++ b/internal_packages/preferences/lib/tabs/workspace-section.jsx @@ -38,7 +38,12 @@ class DefaultMailClientItem extends React.Component { if (process.platform === "win32") return false; return (
    - +
    ); @@ -92,7 +97,12 @@ class LaunchSystemStartItem extends React.Component { if (!this.state.available) return false; return (
    - +
    ); diff --git a/internal_packages/theme-picker/lib/theme-option.jsx b/internal_packages/theme-picker/lib/theme-option.jsx index 9a623d60e..79a776db4 100644 --- a/internal_packages/theme-picker/lib/theme-option.jsx +++ b/internal_packages/theme-picker/lib/theme-option.jsx @@ -103,7 +103,8 @@ class ThemeOption extends React.Component { frameBorder="0" width="115px" height="70px" - flex="1" /> + flex="1" + /> ); } diff --git a/internal_packages/thread-list/lib/injects-toolbar-buttons.jsx b/internal_packages/thread-list/lib/injects-toolbar-buttons.jsx index 53ed8e795..acbf590cb 100644 --- a/internal_packages/thread-list/lib/injects-toolbar-buttons.jsx +++ b/internal_packages/thread-list/lib/injects-toolbar-buttons.jsx @@ -36,7 +36,8 @@ function InjectsToolbarButtons(ToolbarComponent, {getObservable, extraRoles = [] + exposedProps={exposedProps} + /> ) return ( { + const shouldRender = items.length > 0 - static propTypes = { - items: PropTypes.array, - injectedButtons: PropTypes.element, - }; - - render() { - const {items, injectedButtons} = this.props - const shouldRender = items.length > 0 - - return ( - - {shouldRender ? injectedButtons : undefined} - - ) - } + return ( + + {shouldRender ? injectedButtons : undefined} + + ) } +MessageListToolbar.propTypes = { + items: PropTypes.array, + injectedButtons: PropTypes.element, +}; + const toolbarProps = { getObservable, extraRoles: [`MessageList:${ToolbarRole}`], diff --git a/internal_packages/thread-list/lib/selected-items-stack.jsx b/internal_packages/thread-list/lib/selected-items-stack.jsx index 98a1784c3..68cd4eb09 100644 --- a/internal_packages/thread-list/lib/selected-items-stack.jsx +++ b/internal_packages/thread-list/lib/selected-items-stack.jsx @@ -25,12 +25,12 @@ class SelectedItemsStack extends Component { selectionCount: PropTypes.number, }; + static containerRequired = false; + onClearSelection = () => { ThreadListStore.dataSource().selection.clear() }; - static containerRequired = false; - render() { const {selectionCount} = this.props if (selectionCount <= 1) { @@ -56,7 +56,7 @@ class SelectedItemsStack extends Component { transform, zIndex: 5 - idx, } - return
    + return
    })}
    diff --git a/internal_packages/thread-list/lib/thread-list-context-menu.es6 b/internal_packages/thread-list/lib/thread-list-context-menu.es6 index 40efb5173..94e22bffb 100644 --- a/internal_packages/thread-list/lib/thread-list-context-menu.es6 +++ b/internal_packages/thread-list/lib/thread-list-context-menu.es6 @@ -1,3 +1,4 @@ +/* eslint global-require: 0*/ import _ from 'underscore' import { Thread, @@ -58,8 +59,11 @@ export default class ThreadListContextMenu { } replyAllItem() { - if (this.threadIds.length !== 1) { return null } - DatabaseStore.findBy(Message, {threadId: this.threadIds[0]}) + if (this.threadIds.length !== 1) { + return null; + } + + return DatabaseStore.findBy(Message, {threadId: this.threadIds[0]}) .order(Message.attributes.date.descending()) .limit(1) .then((message) => { @@ -76,7 +80,7 @@ export default class ThreadListContextMenu { }, } } - return null + return null; }) } diff --git a/internal_packages/thread-snooze/lib/snooze-buttons.jsx b/internal_packages/thread-snooze/lib/snooze-buttons.jsx index aa5f1db59..126c9bf38 100644 --- a/internal_packages/thread-snooze/lib/snooze-buttons.jsx +++ b/internal_packages/thread-snooze/lib/snooze-buttons.jsx @@ -27,7 +27,8 @@ class SnoozeButton extends Component { Actions.openPopover( , + closePopover={Actions.closePopover} + />, {originRect: buttonRect, direction: this.props.direction} ) }; @@ -47,12 +48,14 @@ class SnoozeButton extends Component { @@ -68,6 +71,8 @@ export class QuickActionSnooze extends Component { thread: PropTypes.object, }; + static containerRequired = false; + getBoundingClientRect = () => { // Grab the parent node because of the zoom applied to this button. If we // took this element directly, we'd have to divide everything by 2 @@ -78,8 +83,6 @@ export class QuickActionSnooze extends Component { return {height, width, top, bottom, right, left: left + 5} }; - static containerRequired = false; - render() { if (!FocusedPerspectiveStore.current().isInbox()) { return ; @@ -90,7 +93,8 @@ export class QuickActionSnooze extends Component { renderImage={false} threads={[this.props.thread]} className="btn action action-snooze" - getBoundingClientRect={this.getBoundingClientRect} /> + getBoundingClientRect={this.getBoundingClientRect} + /> ); } } @@ -110,7 +114,7 @@ export class ToolbarSnooze extends Component { return ; } return ( - + ); } } diff --git a/internal_packages/thread-snooze/lib/snooze-mail-label.jsx b/internal_packages/thread-snooze/lib/snooze-mail-label.jsx index d18f11551..b5d13609e 100644 --- a/internal_packages/thread-snooze/lib/snooze-mail-label.jsx +++ b/internal_packages/thread-snooze/lib/snooze-mail-label.jsx @@ -37,7 +37,8 @@ class SnoozeMailLabel extends Component { + mode={RetinaImg.Mode.ContentIsMask} + /> {message} ) @@ -46,7 +47,7 @@ class SnoozeMailLabel extends Component { isLockedCategory: () => true, hue: () => 259, } - return ; + return ; } return } diff --git a/internal_packages/thread-snooze/lib/snooze-popover.jsx b/internal_packages/thread-snooze/lib/snooze-popover.jsx index 343b86f4d..b29ec0470 100644 --- a/internal_packages/thread-snooze/lib/snooze-popover.jsx +++ b/internal_packages/thread-snooze/lib/snooze-popover.jsx @@ -88,10 +88,12 @@ class SnoozePopover extends Component {
    + onClick={this.onSnooze.bind(this, date, itemLabel)} + > + mode={RetinaImg.Mode.ContentIsMask} + /> {itemLabel}
    ) @@ -115,7 +117,8 @@ class SnoozePopover extends Component { + onSubmitDate={this.onSelectCustomDate} + />
    ); } diff --git a/internal_packages/thread-snooze/spec/snooze-utils-spec.es6 b/internal_packages/thread-snooze/spec/snooze-utils-spec.es6 index f9005fc79..bc6ff61c5 100644 --- a/internal_packages/thread-snooze/spec/snooze-utils-spec.es6 +++ b/internal_packages/thread-snooze/spec/snooze-utils-spec.es6 @@ -159,12 +159,12 @@ describe('Snooze Utils', function snoozeUtils() { beforeEach(() => { this.description = 'Snoozin'; this.snoozeCatsByAccount = { - '123': new Category({accountId: 123, displayName: this.name, serverId: 'sr-1'}), - '321': new Category({accountId: 321, displayName: this.name, serverId: 'sr-2'}), + 123: new Category({accountId: 123, displayName: this.name, serverId: 'sr-1'}), + 321: new Category({accountId: 321, displayName: this.name, serverId: 'sr-2'}), } this.inboxCatsByAccount = { - '123': new Category({accountId: 123, name: 'inbox', serverId: 'sr-3'}), - '321': new Category({accountId: 321, name: 'inbox', serverId: 'sr-4'}), + 123: new Category({accountId: 123, name: 'inbox', serverId: 'sr-3'}), + 321: new Category({accountId: 321, name: 'inbox', serverId: 'sr-4'}), } this.threads = [ new Thread({accountId: 123}), diff --git a/spec/extensions/composer-extension-adapter-spec.es6 b/spec/extensions/composer-extension-adapter-spec.es6 index 944ba573c..f1d45f4d6 100644 --- a/spec/extensions/composer-extension-adapter-spec.es6 +++ b/spec/extensions/composer-extension-adapter-spec.es6 @@ -76,8 +76,8 @@ describe('ComposerExtensionAdapter', function composerExtensionAdapter() { it('adapts correctly when signature is (editor, ...)', () => { const methodSpy = jasmine.createSpy('methodSpy'); const extension = { - method(editor, ev, other) { - methodSpy(editor, ev, other); + method(e, ev, other) { + methodSpy(e, ev, other); }, }; adapter.adaptContenteditableMethod(extension, 'method'); @@ -112,8 +112,8 @@ describe('ComposerExtensionAdapter', function composerExtensionAdapter() { it('adapts correctly when using mutations instead of an event', () => { const methodSpy = jasmine.createSpy('methodSpy'); const extension = { - method(editor, mutations) { - methodSpy(editor, mutations); + method(e, mutations) { + methodSpy(e, mutations); }, }; adapter.adaptContenteditableMethod(extension, 'method'); diff --git a/spec/mailbox-perspective-spec.es6 b/spec/mailbox-perspective-spec.es6 index 0d3439a7e..fc91f727a 100644 --- a/spec/mailbox-perspective-spec.es6 +++ b/spec/mailbox-perspective-spec.es6 @@ -14,12 +14,12 @@ describe('MailboxPerspective', function mailboxPerspective() { beforeEach(() => { this.accountIds = ['a1', 'a2'] this.accounts = { - 'a1': { + a1: { id: 'a1', defaultFinishedCategory: () => ({displayName: 'archive'}), categoryIcon: () => null, }, - 'a2': { + a2: { id: 'a2', defaultFinishedCategory: () => ({displayName: 'trash2'}), categoryIcon: () => null, @@ -115,17 +115,17 @@ describe('MailboxPerspective', function mailboxPerspective() { describe('tasksForRemovingItems', () => { beforeEach(() => { this.categories = { - 'a1': { - 'archive': new Category({name: 'archive', displayName: 'archive', accountId: 'a1'}), - 'inbox': new Category({name: 'inbox', displayName: 'inbox1', accountId: 'a1'}), - 'trash': new Category({name: 'trash', displayName: 'trash1', accountId: 'a1'}), - 'category': new Category({name: null, displayName: 'folder1', accountId: 'a1'}), + a1: { + archive: new Category({name: 'archive', displayName: 'archive', accountId: 'a1'}), + inbox: new Category({name: 'inbox', displayName: 'inbox1', accountId: 'a1'}), + trash: new Category({name: 'trash', displayName: 'trash1', accountId: 'a1'}), + category: new Category({name: null, displayName: 'folder1', accountId: 'a1'}), }, - 'a2': { - 'archive': new Category({name: 'all', displayName: 'all', accountId: 'a2'}), - 'inbox': new Category({name: 'inbox', displayName: 'inbox2', accountId: 'a2'}), - 'trash': new Category({name: 'trash', displayName: 'trash2', accountId: 'a2'}), - 'category': new Category({name: null, displayName: 'label2', accountId: 'a2'}), + a2: { + archive: new Category({name: 'all', displayName: 'all', accountId: 'a2'}), + inbox: new Category({name: 'inbox', displayName: 'inbox2', accountId: 'a2'}), + trash: new Category({name: 'trash', displayName: 'trash2', accountId: 'a2'}), + category: new Category({name: null, displayName: 'label2', accountId: 'a2'}), }, } this.threads = [ diff --git a/spec/stores/draft-factory-spec.es6 b/spec/stores/draft-factory-spec.es6 index 20c15a806..99e688102 100644 --- a/spec/stores/draft-factory-spec.es6 +++ b/spec/stores/draft-factory-spec.es6 @@ -266,7 +266,7 @@ describe('DraftFactory', function draftFactory() { waitsForPromise(() => { return DraftFactory.createDraftForReply({thread: fakeThread, message: fakeMessage1, type: 'reply-all'}).then((draft) => { const ccEmails = draft.cc.map(cc => cc.email); - expect(ccEmails.sort()).toEqual([ 'ben@nylas.com', 'evan@nylas.com', 'mg@nylas.com']); + expect(ccEmails.sort()).toEqual(['ben@nylas.com', 'evan@nylas.com', 'mg@nylas.com']); }); }); }); @@ -576,7 +576,7 @@ describe('DraftFactory', function draftFactory() { it("works for lowercase", () => { waitsForPromise(() => { - return DraftFactory.createDraftForMailto('mailto:asdf@asdf.com?subject=' + this.expected).then((draft) => { + return DraftFactory.createDraftForMailto(`mailto:asdf@asdf.com?subject=${this.expected}`).then((draft) => { expect(draft.subject).toBe(this.expected); }); }); @@ -584,7 +584,7 @@ describe('DraftFactory', function draftFactory() { it("works for title case", () => { waitsForPromise(() => { - return DraftFactory.createDraftForMailto('mailto:asdf@asdf.com?Subject=' + this.expected).then((draft) => { + return DraftFactory.createDraftForMailto(`mailto:asdf@asdf.com?Subject=${this.expected}`).then((draft) => { expect(draft.subject).toBe(this.expected); }); }); @@ -592,7 +592,7 @@ describe('DraftFactory', function draftFactory() { it("works for uppercase", () => { waitsForPromise(() => { - return DraftFactory.createDraftForMailto('mailto:asdf@asdf.com?SUBJECT=' + this.expected).then((draft) => { + return DraftFactory.createDraftForMailto(`mailto:asdf@asdf.com?SUBJECT=${this.expected}`).then((draft) => { expect(draft.subject).toBe(this.expected); }); }); diff --git a/src/browser/auto-update-manager.es6 b/src/browser/auto-update-manager.es6 index 1159295f4..cab32dddb 100644 --- a/src/browser/auto-update-manager.es6 +++ b/src/browser/auto-update-manager.es6 @@ -1,3 +1,4 @@ +/* eslint global-require: 0*/ import {dialog} from 'electron'; import {EventEmitter} from 'events'; import uuid from 'node-uuid'; diff --git a/src/browser/window-manager.es6 b/src/browser/window-manager.es6 index 78e87c327..cb44f957d 100644 --- a/src/browser/window-manager.es6 +++ b/src/browser/window-manager.es6 @@ -34,7 +34,7 @@ export default class WindowManager { }); const score = (win) => - win.loadSettings().mainWindow ? 1000 : win.browserWindow.id; + (win.loadSettings().mainWindow ? 1000 : win.browserWindow.id); return values.sort((a, b) => score(b) - score(a)); } diff --git a/src/components/date-input.jsx b/src/components/date-input.jsx index 400c709de..ae09a8a95 100644 --- a/src/components/date-input.jsx +++ b/src/components/date-input.jsx @@ -69,7 +69,8 @@ class DateInput extends Component { type="text" placeholder="Or, 'next Monday at 2PM'" onKeyDown={this.onInputKeyDown} - onChange={this.onInputChange}/> + onChange={this.onInputChange} + /> {dateInterpretation}
    ) diff --git a/src/components/date-picker.jsx b/src/components/date-picker.jsx index f0fcb25d5..a0b2261b3 100644 --- a/src/components/date-picker.jsx +++ b/src/components/date-picker.jsx @@ -76,13 +76,15 @@ export default class DatePicker extends React.Component { render() { const className = classnames({ 'day-text': true, - focused: this.state.focused, + 'focused': this.state.focused, }) const dayTxt = moment(this.props.value).format(DateUtils.DATE_FORMAT_llll_NO_TIME) return ( -
    diff --git a/src/components/editable-list.jsx b/src/components/editable-list.jsx index ff4347326..5ccb234bc 100644 --- a/src/components/editable-list.jsx +++ b/src/components/editable-list.jsx @@ -359,7 +359,8 @@ class EditableList extends Component { defaultValue={itemContent} onBlur={_.partial(onInputBlur, _, item, idx)} onFocus={onInputFocus} - onKeyDown={_.partial(onInputKeyDown, _, item, idx)} /> + onKeyDown={_.partial(onInputKeyDown, _, item, idx)} + /> ); }; @@ -378,7 +379,7 @@ class EditableList extends Component { return (
    - +
    ); }; @@ -411,14 +412,16 @@ class EditableList extends Component { draggable onDragStart={this._onItemDragStart} onClick={_.partial(onClick, _, item, idx)} - onDoubleClick={_.partial(onEdit, _, item, idx)}> + onDoubleClick={_.partial(onEdit, _, item, idx)} + > {itemContent} + onClick={_.partial(onEdit, _, item, idx)} + />
    ); }; @@ -447,7 +450,7 @@ class EditableList extends Component { }; render() { - let items = this.props.items.map( (item, idx) => this._renderItem(item, idx)); + let items = this.props.items.map((item, idx) => this._renderItem(item, idx)); if (this.state.creatingItem === true) { items = items.concat(this._renderCreateInput()); } @@ -460,13 +463,15 @@ class EditableList extends Component { + className={`nylas-editable-list ${this.props.className}`} + > + onDrop={this._onDrop} + > {items} {this._renderButtons()} diff --git a/src/components/mail-label-set.jsx b/src/components/mail-label-set.jsx index 2839568b4..b5547e4d8 100644 --- a/src/components/mail-label-set.jsx +++ b/src/components/mail-label-set.jsx @@ -52,7 +52,8 @@ export default class MailLabelSet extends React.Component { this._onRemoveLabel(label)} /> + onRemove={() => this._onRemoveLabel(label)} + /> ) } else { if (LabelComponentCache[label.id] === undefined) { @@ -71,7 +72,8 @@ export default class MailLabelSet extends React.Component { children={labels} matching={{role: "Thread:MailLabel"}} className="thread-injected-mail-labels" - exposedProps={{thread: thread}}/> + exposedProps={{thread: thread}} + /> ); } } diff --git a/src/components/modal.jsx b/src/components/modal.jsx index 2de818b50..2540f5b36 100644 --- a/src/components/modal.jsx +++ b/src/components/modal.jsx @@ -86,7 +86,8 @@ class Modal extends React.Component { style={containerStyle} className="modal-container" onKeyDown={this._onKeyDown} - onBlur={this._onBlur}> + onBlur={this._onBlur} + >
    {children}
    diff --git a/src/components/multiselect-toolbar.jsx b/src/components/multiselect-toolbar.jsx index 9499608da..5cd5dcee0 100644 --- a/src/components/multiselect-toolbar.jsx +++ b/src/components/multiselect-toolbar.jsx @@ -52,7 +52,8 @@ class MultiselectToolbar extends Component { @@ -68,7 +69,8 @@ class MultiselectToolbar extends Component { transitionName="selection-bar-absolute" component="div" transitionLeaveTimeout={200} - transitionEnterTimeout={200}> + transitionEnterTimeout={200} + > {selectionCount > 0 ? this.renderToolbar() : undefined} ) diff --git a/src/components/nylas-calendar/calendar-event-container.jsx b/src/components/nylas-calendar/calendar-event-container.jsx index bcb01e401..2ea0b3020 100644 --- a/src/components/nylas-calendar/calendar-event-container.jsx +++ b/src/components/nylas-calendar/calendar-event-container.jsx @@ -91,7 +91,8 @@ export default class CalendarEventContainer extends React.Component { render() { return ( -
    diff --git a/src/components/nylas-calendar/header-controls.jsx b/src/components/nylas-calendar/header-controls.jsx index 5e3f177da..5d1607cf1 100644 --- a/src/components/nylas-calendar/header-controls.jsx +++ b/src/components/nylas-calendar/header-controls.jsx @@ -24,11 +24,13 @@ export default class HeaderControls extends React.Component { _renderNextAction() { if (!this.props.nextAction) { return false; } return ( - @@ -38,11 +40,13 @@ export default class HeaderControls extends React.Component { _renderPrevAction() { if (!this.props.prevAction) { return false; } return ( - diff --git a/src/components/nylas-calendar/mini-month-view.jsx b/src/components/nylas-calendar/mini-month-view.jsx index 935ecb751..5753e27bc 100644 --- a/src/components/nylas-calendar/mini-month-view.jsx +++ b/src/components/nylas-calendar/mini-month-view.jsx @@ -79,13 +79,14 @@ export default class MiniMonthView extends React.Component { dayIter.weekday(weekday); // Locale aware! const dayStr = dayIter.format("D"); const className = classnames({ - day: true, - today: this._isSameDay(dayIter, this.today), + "day": true, + "today": this._isSameDay(dayIter, this.today), "cur-day": this._isSameDay(dayIter, valDay), "cur-month": dayIter.month() === curMonth, }) dayEls.push( -
    {dayStr}
    ) @@ -101,11 +102,13 @@ export default class MiniMonthView extends React.Component { return (
    -
    {this._shownMonthMoment().format("MMMM YYYY")} -
    diff --git a/src/components/nylas-calendar/month-view.jsx b/src/components/nylas-calendar/month-view.jsx index f35445253..771f2d6dd 100644 --- a/src/components/nylas-calendar/month-view.jsx +++ b/src/components/nylas-calendar/month-view.jsx @@ -7,10 +7,6 @@ export default class MonthView extends React.Component { changeView: React.PropTypes.func, } - constructor(props) { - super(props); - } - _onClick = () => { this.props.changeView("WeekView"); } diff --git a/src/components/nylas-calendar/nylas-calendar.jsx b/src/components/nylas-calendar/nylas-calendar.jsx index 3d8a89a02..b27da0cfb 100644 --- a/src/components/nylas-calendar/nylas-calendar.jsx +++ b/src/components/nylas-calendar/nylas-calendar.jsx @@ -70,6 +70,10 @@ export default class NylasCalendar extends React.Component { footerComponents: {day: false, week: false, month: false, year: false}, } + static containerStyles = { + height: "100%", + } + constructor(props) { super(props); this.state = { @@ -78,10 +82,6 @@ export default class NylasCalendar extends React.Component { }; } - static containerStyles = { - height: "100%", - } - _now() { return moment() } diff --git a/src/components/nylas-calendar/week-view-all-day-events.jsx b/src/components/nylas-calendar/week-view-all-day-events.jsx index 65010d2d4..193a0ead3 100644 --- a/src/components/nylas-calendar/week-view-all-day-events.jsx +++ b/src/components/nylas-calendar/week-view-all-day-events.jsx @@ -29,7 +29,9 @@ export default class WeekViewAllDayEvents extends React.Component { render() { const eventComponents = this.props.allDayEvents.map((e) => { return ( - { return ( - + concurrentEvents={this.props.eventOverlap[e.id].concurrentEvents} + /> ); }); } @@ -44,8 +47,12 @@ export default class WeekViewEventColumn extends React.Component { }); const end = moment(this.props.day).add(1, 'day').subtract(1, 'millisecond').valueOf() return ( -
    +
    {this._eventComponents()}
    ) diff --git a/src/components/nylas-calendar/week-view.jsx b/src/components/nylas-calendar/week-view.jsx index 0e9f971b3..ca19abe21 100644 --- a/src/components/nylas-calendar/week-view.jsx +++ b/src/components/nylas-calendar/week-view.jsx @@ -98,7 +98,7 @@ export default class WeekView extends React.Component { this._sub = this.props.dataSource.buildObservable({ startTime: startMoment.unix(), endTime: endMoment.unix(), - }).subscribe((state) => {this.setState(state)}) + }).subscribe((state) => { this.setState(state) }) this.setState({startMoment, endMoment}) } @@ -150,7 +150,9 @@ export default class WeekView extends React.Component { const dayUnix = day.unix(); const events = eventsByDay[dayUnix] return ( - @@ -434,7 +439,8 @@ export default class WeekView extends React.Component { > -
    -
    All Day @@ -454,7 +461,9 @@ export default class WeekView extends React.Component {
    -
    @@ -472,13 +481,16 @@ export default class WeekView extends React.Component { allDayOverlap={allDayOverlap} />
    -
    {days.map(_.partial(this._renderEventColumn, eventsByDay))} - { @@ -296,7 +296,8 @@ class OutlineViewItem extends Component { + mode={RetinaImg.Mode.ContentIsMask} + />
    ); } @@ -314,7 +315,8 @@ class OutlineViewItem extends Component { defaultValue={item.name} onBlur={this._onInputBlur} onFocus={this._onInputFocus} - onKeyDown={this._onInputKeyDown} /> + onKeyDown={this._onInputKeyDown} + /> ); } return
    {item.name}
    ; @@ -322,9 +324,9 @@ class OutlineViewItem extends Component { _renderItem(item = this.props.item, state = this.state) { const containerClass = classnames({ - 'item': true, - 'selected': item.selected, - 'editing': state.editing, + item: true, + selected: item.selected, + editing: state.editing, [item.className]: item.className, }); @@ -336,7 +338,8 @@ class OutlineViewItem extends Component { onClick={this._onClick} onDoubleClick={this._onEdit} shouldAcceptDrop={this._shouldAcceptDrop} - onDragStateChange={this._onDragStateChange} > + onDragStateChange={this._onDragStateChange} + > {this._renderCount()} {this._renderIcon()} {this._renderItemContent()} @@ -369,7 +372,8 @@ class OutlineViewItem extends Component { 0} - onCollapseToggled={this._onCollapseToggled} /> + onCollapseToggled={this._onCollapseToggled} + /> {this._renderItem()} {this._renderChildren()} diff --git a/src/components/outline-view.jsx b/src/components/outline-view.jsx index 45555ab4c..a4a8e6ac5 100644 --- a/src/components/outline-view.jsx +++ b/src/components/outline-view.jsx @@ -120,16 +120,17 @@ class OutlineView extends Component { } _renderCreateButton() { - const title = this.props.title; return ( + onMouseUp={this._onCreateButtonClicked} + > + mode={RetinaImg.Mode.ContentIsMask} + /> ); } @@ -139,9 +140,10 @@ class OutlineView extends Component { return ( true } + onDrop={() => true} onDragStateChange={this._onDragStateChange} - shouldAcceptDrop={() => true}> + shouldAcceptDrop={() => true} + > {this.props.title} @@ -149,7 +151,8 @@ class OutlineView extends Component { {collapsible ? + onClick={this._onCollapseToggled} + > {collapseLabel} : void 0 diff --git a/src/components/participants-text-field.jsx b/src/components/participants-text-field.jsx index a478537d7..ed1eebf71 100644 --- a/src/components/participants-text-field.jsx +++ b/src/components/participants-text-field.jsx @@ -1,35 +1,32 @@ import React from 'react'; import _ from 'underscore'; -import {remote} from 'electron'; +import {remote, clipboard} from 'electron'; import {Utils, Contact, ContactStore} from 'nylas-exports'; import {TokenizingTextField, Menu, InjectedComponent, InjectedComponentSet} from 'nylas-component-kit'; -class TokenRenderer extends React.Component { - - static propTypes = { - token: React.PropTypes.object, +const TokenRenderer = (props) => { + const {email, name} = props.token + let chipText = email; + if (name && (name.length > 0) && (name !== email)) { + chipText = name; } + return ( +
    + + {chipText} +
    + ); +}; - render() { - const {email, name} = this.props.token - let chipText = email; - if (name && (name.length > 0) && (name !== email)) { - chipText = name; - } - return ( -
    - - {chipText} -
    - ); - } -} +TokenRenderer.propTypes = { + token: React.PropTypes.object, +}; export default class ParticipantsTextField extends React.Component { static displayName = 'ParticipantsTextField'; @@ -173,7 +170,7 @@ export default class ParticipantsTextField extends React.Component { const menu = new MenuClass(); menu.append(new MenuItem({ label: `Copy ${participant.email}`, - click: () => require('electron').clipboard.writeText(participant.email), + click: () => clipboard.writeText(participant.email), })) menu.append(new MenuItem({ type: 'separator', diff --git a/src/components/retina-img.jsx b/src/components/retina-img.jsx index b885266b3..a01fc1609 100644 --- a/src/components/retina-img.jsx +++ b/src/components/retina-img.jsx @@ -95,12 +95,12 @@ class RetinaImg extends React.Component { resourcePath: React.PropTypes.string, } + static Mode = Mode; + shouldComponentUpdate = (nextProps) => { return !(_.isEqual(this.props, nextProps)); } - static Mode = Mode; - _pathFor = (name) => { if (!name || !_.isString(name)) return null; let pathName = name; @@ -141,18 +141,16 @@ class RetinaImg extends React.Component { className += " content-light"; } - for (const key in style) { - if (style.hasOwnProperty(key)) { - const val = style[key].toString(); - if (StylesImpactedByZoom.indexOf(key) !== -1 && val.indexOf("%") === -1) { - style[key] = val.replace('px', '') / style.zoom; - } + for (const key of Object.keys(style)) { + const val = style[key].toString(); + if (StylesImpactedByZoom.indexOf(key) !== -1 && val.indexOf("%") === -1) { + style[key] = val.replace('px', '') / style.zoom; } } const otherProps = Utils.fastOmit(this.props, Object.keys(this.constructor.propTypes)); return ( - + {this.props.name} ); } diff --git a/src/components/scrollbar-ticks.jsx b/src/components/scrollbar-ticks.jsx index 1ef3ceec5..596295b42 100644 --- a/src/components/scrollbar-ticks.jsx +++ b/src/components/scrollbar-ticks.jsx @@ -24,7 +24,7 @@ export default class ScrollbarTicks extends React.Component { percent = percentData; } else { percent = percentData.percent; - className = " " + percentData.className + className = ` ${percentData.className}`; } return `
    ` }).join("") diff --git a/src/components/selectable-table.jsx b/src/components/selectable-table.jsx index cc809da85..ca3c40053 100644 --- a/src/components/selectable-table.jsx +++ b/src/components/selectable-table.jsx @@ -56,7 +56,7 @@ export class SelectableCell extends Component { const {className} = this.props const classes = classnames({ [className]: true, - 'selected': this.isSelected(this.props), + selected: this.isSelected(this.props), }) return ( -
    -
    - ); +const Switch = (props) => { + let classnames = "slide-switch"; + if (props.checked) { + classnames += " active"; } + return ( +
    +
    +
    + ); } +Switch.propTypes = { + checked: React.PropTypes.bool, + onChange: React.PropTypes.func.isRequired, +}; + export default Switch; diff --git a/src/components/table.jsx b/src/components/table.jsx index ed3cddabf..6e11b4321 100644 --- a/src/components/table.jsx +++ b/src/components/table.jsx @@ -25,6 +25,12 @@ export function TableCell(props) { ) } +TableCell.propTypes = { + isHeader: PropTypes.bool, + className: PropTypes.string, + children: PropTypes.children, +}; + export class TableRow extends Component { static propTypes = { diff --git a/src/date-utils.es6 b/src/date-utils.es6 index 09d0930cf..e5e27ec20 100644 --- a/src/date-utils.es6 +++ b/src/date-utils.es6 @@ -17,8 +17,8 @@ const Hours = { const Days = { // The value for next monday and next weekend varies depending if the current // day is saturday or sunday. See http://momentjs.com/docs/#/get-set/day/ - NextMonday: day => day === 0 ? 1 : 8, - ThisWeekend: day => day === 6 ? 13 : 6, + NextMonday: day => (day === 0 ? 1 : 8), + ThisWeekend: day => (day === 6 ? 13 : 6), } function oclock(momentDate) { diff --git a/src/dom-walkers.es6 b/src/dom-walkers.es6 index 13c9d3239..5676c08a5 100644 --- a/src/dom-walkers.es6 +++ b/src/dom-walkers.es6 @@ -13,7 +13,7 @@ const DOMWalkers = { if (!node) { return; } if (node.childNodes.length > 0) { for (let i = node.childNodes.length - 1; i >= 0; i--) { - yield *this.walkBackwards(node.childNodes[i]); + yield* this.walkBackwards(node.childNodes[i]); } } yield node; diff --git a/src/extension-registry.es6 b/src/extension-registry.es6 index 019c7f60c..f32202347 100644 --- a/src/extension-registry.es6 +++ b/src/extension-registry.es6 @@ -1,8 +1,6 @@ import _ from 'underscore'; import {Listener, Publisher} from './flux/modules/reflux-coffee'; import {includeModule} from './flux/coffee-helpers'; -import composerExtAdapter from './extensions/composer-extension-adapter'; -import messageViewExtAdapter from './extensions/message-view-extension-adapter'; export class Registry { diff --git a/src/extensions/composer-extension-adapter.es6 b/src/extensions/composer-extension-adapter.es6 deleted file mode 100644 index 367e11232..000000000 --- a/src/extensions/composer-extension-adapter.es6 +++ /dev/null @@ -1,140 +0,0 @@ -import _ from 'underscore'; -import DOMUtils from '../dom-utils'; -import {deprecate} from '../deprecate-utils'; -import {getFunctionArgs} from './extension-utils'; - -export function isUsingOutdatedContenteditableApi(func) { - // Might not always be true, but it is our best guess - const firstArg = getFunctionArgs(func)[0]; - if (func.length > 1) return true; // Not using a named arguments hash - return ( - firstArg.includes('ev') || - firstArg.includes('node') || - firstArg.includes('Node') - ); -} - -export function isUsingOutdatedComposerApi(func) { - const firstArg = getFunctionArgs(func)[0]; - return ( - firstArg.includes('dr') || - firstArg.includes('sess') || - firstArg.includes('prox') - ); -} - -export function adaptComposerMethod(extension, method) { - const original = extension[method]; - if (!original || !isUsingOutdatedComposerApi(original)) return; - - extension[method] = (argsObj) => { - return original(argsObj.draft); - }; -} - -export function adaptContenteditableMethod(extension, method, original = extension[method]) { - // Check if it is using old API - if (!original || !isUsingOutdatedContenteditableApi(original)) return; - - let deprecatedArgs = ''; - extension[method] = (argsObj) => { - const {editor, event, mutations} = argsObj; - const eventOrMutations = event || mutations || {}; - const extraArgs = Object.keys(_.omit(argsObj, ['editor', 'event', 'mutations'])).map( - key => argsObj[key] - ); - - // This is our best guess at the function signature that is being used - const firstArg = getFunctionArgs(original)[0]; - if (firstArg.includes('editor')) { - deprecatedArgs = '(editor, ...)'; - return original(editor, eventOrMutations, ...extraArgs); - } else if (firstArg.includes('ev')) { - deprecatedArgs = '(event, editableNode, selection, ...)'; - return original(eventOrMutations, editor.rootNode, editor.currentSelection(), ...extraArgs); - } - deprecatedArgs = '(editableNode, selection, ...)'; - return original(editor.rootNode, editor.currentSelection(), eventOrMutations, ...extraArgs); - }; - - extension[method] = deprecate( - `ComposerExtension.${method}${deprecatedArgs}`, - `ComposerExtension.${method}(args = {editor, ...})`, - extension, - extension[method] - ); -} - -export function adaptOnInput(extension) { - if (extension.onContentChanged != null) return; - adaptContenteditableMethod(extension, 'onContentChanged', extension.onInput); -} - -export function adaptOnTabDown(extension) { - if (!extension.onTabDown) return; - const origOnKeyDown = extension.onKeyDown; - extension.onKeyDown = ({editor, event}) => { - if (event.key === 'Tab') { - const range = DOMUtils.getRangeInScope(editor.rootNode); - extension.onTabDown(editor.rootNode, range, event); - } else { - // At this point, onKeyDown should have already been adapted - if (origOnKeyDown != null) origOnKeyDown(editor, event); - } - }; - - extension.onKeyDown = deprecate( - 'DraftStoreExtension.onTabDown', - 'ComposerExtension.onKeyDown', - extension, - extension.onKeyDown - ); -} - -export function adaptOnMouseUp(extension) { - if (!extension.onMouseUp) return; - const origOnClick = extension.onClick; - extension.onClick = ({editor, event}) => { - const range = DOMUtils.getRangeInScope(editor.rootNode); - extension.onMouseUp(editor.rootNode, range, event); - // At this point, onClick should have already been adapted - if (origOnClick != null) origOnClick(editor, event); - }; - - extension.onClick = deprecate( - 'DraftStoreExtension.onMouseUp', - 'ComposerExtension.onClick', - extension, - extension.onClick - ); -} - -export default function adaptExtension(extension) { - const contenteditableMethods = [ - 'onContentChanged', - 'onBlur', - 'onFocus', - 'onClick', - 'onKeyDown', - 'onShowContextMenu', - ]; - contenteditableMethods.forEach( - method => adaptContenteditableMethod(extension, method) - ); - - // Special contenteditable cases - adaptOnInput(extension); - adaptOnTabDown(extension); - adaptOnMouseUp(extension); - - - const composerMethods = [ - 'warningsForSending', - 'prepareNewDraft', - ]; - composerMethods.forEach( - method => adaptComposerMethod(extension, method) - ); - - return extension; -} diff --git a/src/extensions/message-view-extension-adapter.es6 b/src/extensions/message-view-extension-adapter.es6 deleted file mode 100644 index d256c5bf6..000000000 --- a/src/extensions/message-view-extension-adapter.es6 +++ /dev/null @@ -1,21 +0,0 @@ -import {getFunctionArgs} from './extension-utils'; - -export function isUsingOutdatedAPI(func) { - // Might not always be true, but it is our best guess - const firstArg = getFunctionArgs(func)[0]; - return ( - firstArg.includes('mes') || - firstArg.includes('msg') || - firstArg.includes('body') || - firstArg.includes('draft') - ); -} - -export default function adaptExtension(extension) { - const original = extension.formatMessageBody; - if (!original || !isUsingOutdatedAPI(original)) return extension; - extension.formatMessageBody = ({message}) => { - return original(message); - }; - return extension; -} diff --git a/src/flux/models/account.es6 b/src/flux/models/account.es6 index 5a2f66fc3..758d1712e 100644 --- a/src/flux/models/account.es6 +++ b/src/flux/models/account.es6 @@ -1,3 +1,4 @@ +/* eslint global-require:0 */ import Attributes from '../attributes' import ModelWithMetadata from './model-with-metadata' diff --git a/src/flux/nylas-long-connection.es6 b/src/flux/nylas-long-connection.es6 index 5a9ba3a43..4927a7180 100644 --- a/src/flux/nylas-long-connection.es6 +++ b/src/flux/nylas-long-connection.es6 @@ -1,3 +1,4 @@ +/* eslint global-require:0 */ import _ from 'underscore' import url from 'url' import {Emitter} from 'event-kit' diff --git a/src/flux/stores/badge-store.es6 b/src/flux/stores/badge-store.es6 index 96393f40b..0b773f743 100644 --- a/src/flux/stores/badge-store.es6 +++ b/src/flux/stores/badge-store.es6 @@ -1,3 +1,4 @@ +/* eslint global-require:0 */ import NylasStore from 'nylas-store'; import FocusedPerspectiveStore from './focused-perspective-store'; import ThreadCountsStore from './thread-counts-store'; diff --git a/src/flux/stores/recently-read-store.es6 b/src/flux/stores/recently-read-store.es6 index 99cf31791..c60e12f1a 100644 --- a/src/flux/stores/recently-read-store.es6 +++ b/src/flux/stores/recently-read-store.es6 @@ -31,7 +31,7 @@ class RecentlyReadStore extends NylasStore { tasks.filter(task => task instanceof ChangeUnreadTask ).forEach(({threads}) => { - const threadIds = threads.map(t => t.id ? t.id : t); + const threadIds = threads.map(t => (t.id ? t.id : t)); this.ids = this.ids.concat(threadIds); changed = true; }); @@ -39,7 +39,7 @@ class RecentlyReadStore extends NylasStore { tasks.filter(task => task instanceof ChangeLabelsTask || task instanceof ChangeFolderTask ).forEach(({threads}) => { - const threadIds = threads.map(t => t.id ? t.id : t); + const threadIds = threads.map(t => (t.id ? t.id : t)); this.ids = this.ids.filter(id => !threadIds.includes(id)); changed = true; }); diff --git a/src/flux/stores/searchable-component-store.es6 b/src/flux/stores/searchable-component-store.es6 index afa0c8f29..33f6ae9b3 100644 --- a/src/flux/stores/searchable-component-store.es6 +++ b/src/flux/stores/searchable-component-store.es6 @@ -146,7 +146,7 @@ class SearchableComponentStore extends NylasStore { // We save the position relative to the top of the scrollAncestor // instead of the current getBoudingClientRect (which is dependent // on the current scroll position) - this.matches.map((match) => { + this.matches.forEach((match) => { match.top -= scrollTop }); } diff --git a/src/flux/tasks/change-folder-task.es6 b/src/flux/tasks/change-folder-task.es6 index 1438d86ef..1da8519b4 100644 --- a/src/flux/tasks/change-folder-task.es6 +++ b/src/flux/tasks/change-folder-task.es6 @@ -120,5 +120,6 @@ export default class ChangeFolderTask extends ChangeMailTask { if (model instanceof Message) { return {folder: model.folder ? model.folder.id : null}; } + return null; } } diff --git a/src/flux/tasks/change-mail-task.es6 b/src/flux/tasks/change-mail-task.es6 index 4f494e367..c61f9e161 100644 --- a/src/flux/tasks/change-mail-task.es6 +++ b/src/flux/tasks/change-mail-task.es6 @@ -20,7 +20,8 @@ const mapLimit = (input, numberInParallel, fn) => { let outputError = null; if (input.length === 0) { - return resolve([]); + resolve([]); + return; } const startNext = () => { @@ -299,7 +300,7 @@ export default class ChangeMailTask extends Task { // Never give the undo task the Model objects - make it look them up! // This ensures that they never revert other fields - const toIds = (arr) => _.map(arr, v => _.isString(v) ? v : v.id); + const toIds = (arr) => _.map(arr, v => (_.isString(v) ? v : v.id)); task.threads = toIds(this.threads); task.messages = (this.threads.length > 0) ? [] : toIds(this.messages); return task; @@ -307,7 +308,7 @@ export default class ChangeMailTask extends Task { objectIds() { return [].concat(this.threads, this.messages).map((v) => - _.isString(v) ? v : v.id + (_.isString(v) ? v : v.id) ); } diff --git a/src/flux/tasks/destroy-draft-task.es6 b/src/flux/tasks/destroy-draft-task.es6 index 5b216c7b6..12213aab6 100644 --- a/src/flux/tasks/destroy-draft-task.es6 +++ b/src/flux/tasks/destroy-draft-task.es6 @@ -7,9 +7,6 @@ import NylasAPI from '../nylas-api'; import BaseDraftTask from './base-draft-task'; export default class DestroyDraftTask extends BaseDraftTask { - constructor(draftClientId) { - super(draftClientId); - } shouldDequeueOtherTask(other) { return (other instanceof BaseDraftTask && other.draftClientId === this.draftClientId); diff --git a/src/flux/tasks/destroy-model-task.es6 b/src/flux/tasks/destroy-model-task.es6 index 3681ce9b2..1c84ebfd5 100644 --- a/src/flux/tasks/destroy-model-task.es6 +++ b/src/flux/tasks/destroy-model-task.es6 @@ -1,3 +1,4 @@ +/* eslint global-require:0 */ import _ from 'underscore' import Task from './task' import NylasAPI from '../nylas-api' diff --git a/src/pro b/src/pro index 074d6b995..797179d15 160000 --- a/src/pro +++ b/src/pro @@ -1 +1 @@ -Subproject commit 074d6b99501b0c1b20dbd57a18982556cb1acde2 +Subproject commit 797179d156bfeaba611e755b8c8abdc4615df0c8 diff --git a/src/searchable-components/real-dom-parser.es6 b/src/searchable-components/real-dom-parser.es6 index 43572f77c..c42487398 100644 --- a/src/searchable-components/real-dom-parser.es6 +++ b/src/searchable-components/real-dom-parser.es6 @@ -9,7 +9,7 @@ export default class RealDOMParser extends UnifiedDOMParser { } if (node && !pruneFn(node) && node.childNodes.length > 0) { for (let i = 0; i < node.childNodes.length; i++) { - yield *this._pruningDOMWalker({node: node.childNodes[i], pruneFn, filterFn}); + yield* this._pruningDOMWalker({node: node.childNodes[i], pruneFn, filterFn}); } } return; diff --git a/src/searchable-components/search-match.jsx b/src/searchable-components/search-match.jsx index 01032d3cb..80bf3c804 100644 --- a/src/searchable-components/search-match.jsx +++ b/src/searchable-components/search-match.jsx @@ -1,20 +1,21 @@ import React from 'react' -export default class SearchMatch extends React.Component { - static displayName = "SearchMatch"; - - static propTypes = { - regionId: React.PropTypes.string, - className: React.PropTypes.string, - renderIndex: React.PropTypes.number, - } - - render() { - return ( - {this.props.children} - ) - } +const SearchMatch = (props) => { + return ( + + {props.children} + + ) } +SearchMatch.propTypes = { + regionId: React.PropTypes.string, + className: React.PropTypes.string, + renderIndex: React.PropTypes.number, +}; + +export default SearchMatch; diff --git a/src/searchable-components/searchable-component-maker.jsx b/src/searchable-components/searchable-component-maker.jsx index 3d3209c49..40a84223f 100644 --- a/src/searchable-components/searchable-component-maker.jsx +++ b/src/searchable-components/searchable-component-maker.jsx @@ -8,7 +8,7 @@ class SearchableComponent { componentDidMount(superMethod, ...args) { if (superMethod) superMethod.apply(this, args); this.__regionId = Utils.generateTempId(); - this._searchableListener = SearchableComponentStore.listen(() => {this._onSearchableComponentStoreChange()}) + this._searchableListener = SearchableComponentStore.listen(() => { this._onSearchableComponentStoreChange() }) SearchableComponentStore.registerSearchRegion(this.__regionId, ReactDOM.findDOMNode(this)) } @@ -53,8 +53,9 @@ class SearchableComponent { const matchNodeMap = parser.getElementsWithNewMatchNodes(normalizedDOM, searchTerm, this.state.__searchIndex); return parser.highlightSearch(normalizedDOM, matchNodeMap) } - return vDOM + return vDOM; } + return null; } } diff --git a/src/serializable-registry.es6 b/src/serializable-registry.es6 index ccb304f13..740bdac0b 100644 --- a/src/serializable-registry.es6 +++ b/src/serializable-registry.es6 @@ -26,12 +26,10 @@ export default class SerializableRegistry { getAllConstructors() { const constructors = [] - for (const name in this._constructorFactories) { - if (this._constructorFactories.hasOwnProperty(name)) { - constructors.push(this.get(name)) - } + for (const name of Object.keys(this._constructorFactories)) { + constructors.push(this.get(name)) } - return constructors + return constructors; } isInRegistry(name) { diff --git a/src/store-registry.es6 b/src/store-registry.es6 index 35f002fed..251f6396b 100644 --- a/src/store-registry.es6 +++ b/src/store-registry.es6 @@ -10,14 +10,12 @@ class StoreRegistry extends SerializableRegistry { * takes considerable time to process. */ activateAllStores() { - for (const name in this._constructorFactories) { - if (this._constructorFactories.hasOwnProperty(name)) { - // All we need to do is hit `require` on the store. This will - // construct the object an initialize the require cache. The - // stores are now available in nylas-exports or from the node - // require cache. - this.get(name) - } + for (const name of Object.keys(this._constructorFactories)) { + // All we need to do is hit `require` on the store. This will + // construct the object an initialize the require cache. The + // stores are now available in nylas-exports or from the node + // require cache. + this.get(name) } } } diff --git a/src/system-start-service.es6 b/src/system-start-service.es6 index 6be3aae04..fb8b2227c 100644 --- a/src/system-start-service.es6 +++ b/src/system-start-service.es6 @@ -63,10 +63,10 @@ class SystemStartServiceDarwin extends SystemStartServiceBase { _launchdPlist() { return { - "Label": "com.nylas.n1", - "Program": this._launcherPath(), - "ProgramArguments": ["--background"], - "RunAtLoad": true, + Label: "com.nylas.n1", + Program: this._launcherPath(), + ProgramArguments: ["--background"], + RunAtLoad: true, } } } diff --git a/src/virtual-dom-utils.es6 b/src/virtual-dom-utils.es6 index 1c4716a7b..bf76e009f 100644 --- a/src/virtual-dom-utils.es6 +++ b/src/virtual-dom-utils.es6 @@ -12,14 +12,14 @@ const VirtualDOMUtils = { yield {element: children, parentNode: element, childOffset: 0} } else if (children.length > 0) { for (let i = 0; i < children.length; i++) { - yield *this.walk({element: children[i], parentNode: element, childOffset: i, pruneFn}) + yield* this.walk({element: children[i], parentNode: element, childOffset: i, pruneFn}) } } else { - yield *this.walk({element: children, parentNode: element, childOffset: 0, pruneFn}) + yield* this.walk({element: children, parentNode: element, childOffset: 0, pruneFn}) } } else if (_.isArray(element)) { for (let i = 0; i < element.length; i++) { - yield *this.walk({element: element[i], parentNode: element, childOffset: i}) + yield* this.walk({element: element[i], parentNode: element, childOffset: i}) } } return