From c3e4cbebe4c4c218b278a19223547f04877c14e1 Mon Sep 17 00:00:00 2001 From: Leo Lamprecht Date: Fri, 29 Jul 2016 22:40:46 +0200 Subject: [PATCH] Fix code style --- lib/reducers/sessions.js | 14 ++--- lib/reducers/ui.js | 122 ++++++++++++++++++------------------- lib/utils/plugins.js | 126 +++++++++++++++++++-------------------- 3 files changed, 131 insertions(+), 131 deletions(-) diff --git a/lib/reducers/sessions.js b/lib/reducers/sessions.js index 84ad585a..feda28e2 100644 --- a/lib/reducers/sessions.js +++ b/lib/reducers/sessions.js @@ -67,14 +67,14 @@ const reducer = (state = initialState, action) => { case SESSION_PTY_DATA: return state - .set('write', Write(action)) - .merge({ - sessions: { - [action.uid]: { - cleared: false + .set('write', Write(action)) + .merge({ + sessions: { + [action.uid]: { + cleared: false + } } - } - }, { deep: true }); + }, { deep: true }); case SESSION_PTY_EXIT: if (state.sessions[action.uid]) { diff --git a/lib/reducers/ui.js b/lib/reducers/ui.js index c20698c2..0d67fac2 100644 --- a/lib/reducers/ui.js +++ b/lib/reducers/ui.js @@ -75,73 +75,73 @@ const reducer = (state = initial, action) => { case CONFIG_RELOAD: const { config } = action; state_ = state - // we unset the user font size override if the - // font size changed from the config - .merge((() => { - const ret = {}; + // we unset the user font size override if the + // font size changed from the config + .merge((() => { + const ret = {}; - if (state.fontSizeOverride && config.fontSize !== state.fontSize) { - ret.fontSizeOverride = null; - } + if (state.fontSizeOverride && config.fontSize !== state.fontSize) { + ret.fontSizeOverride = null; + } - if (null != config.fontSize) { - ret.fontSize = config.fontSize; - } + if (null != config.fontSize) { + ret.fontSize = config.fontSize; + } - if (null != config.fontFamily) { - ret.fontFamily = config.fontFamily; - } + if (null != config.fontFamily) { + ret.fontFamily = config.fontFamily; + } - if (null != config.cursorColor) { - ret.cursorColor = config.cursorColor; - } + if (null != config.cursorColor) { + ret.cursorColor = config.cursorColor; + } - if (allowedCursorShapes.includes(config.cursorShape)) { - ret.cursorShape = config.cursorShape; - } + if (allowedCursorShapes.includes(config.cursorShape)) { + ret.cursorShape = config.cursorShape; + } - if (null != config.borderColor) { - ret.borderColor = config.borderColor; - } + if (null != config.borderColor) { + ret.borderColor = config.borderColor; + } - if (null != config.padding) { - ret.padding = config.padding; - } + if (null != config.padding) { + ret.padding = config.padding; + } - if (null != config.foregroundColor) { - ret.foregroundColor = config.foregroundColor; - } + if (null != config.foregroundColor) { + ret.foregroundColor = config.foregroundColor; + } - if (null != config.backgroundColor) { - ret.backgroundColor = config.backgroundColor; - } + if (null != config.backgroundColor) { + ret.backgroundColor = config.backgroundColor; + } - if (null != config.css) { - ret.css = config.css; - } + if (null != config.css) { + ret.css = config.css; + } - if (null != config.termCSS) { - ret.termCSS = config.termCSS; - } + if (null != config.termCSS) { + ret.termCSS = config.termCSS; + } - if (null != config.colors) { - if (Array.isArray(config.colors)) { - const stateColors = Array.isArray(state.colors) - ? state.colors - : values(state.colors); + if (null != config.colors) { + if (Array.isArray(config.colors)) { + const stateColors = Array.isArray(state.colors) + ? state.colors + : values(state.colors); - if (stateColors.toString() !== config.colors.toString()) { - ret.colors = config.colors; - } - } else { - if (JSON.stringify(state.colors) !== JSON.stringify(config.colors)) { - ret.colors = config.colors; + if (stateColors.toString() !== config.colors.toString()) { + ret.colors = config.colors; + } + } else { + if (JSON.stringify(state.colors) !== JSON.stringify(config.colors)) { + ret.colors = config.colors; + } } } - } - return ret; - })()); + return ret; + })()); break; case SESSION_ADD: @@ -162,16 +162,16 @@ const reducer = (state = initial, action) => { case SESSION_PTY_EXIT: state_ = state - .updateIn(['openAt'], (times) => { - const times_ = times.asMutable(); - delete times_[action.uid]; - return times_; - }) - .updateIn(['activityMarkers'], (markers) => { - const markers_ = markers.asMutable(); - delete markers_[action.uid]; - return markers_; - }); + .updateIn(['openAt'], (times) => { + const times_ = times.asMutable(); + delete times_[action.uid]; + return times_; + }) + .updateIn(['activityMarkers'], (markers) => { + const markers_ = markers.asMutable(); + delete markers_[action.uid]; + return markers_; + }); break; case SESSION_SET_ACTIVE: diff --git a/lib/utils/plugins.js b/lib/utils/plugins.js index 2cd49cba..da178f54 100644 --- a/lib/utils/plugins.js +++ b/lib/utils/plugins.js @@ -63,87 +63,87 @@ const loadModules = () => { termPropsDecorators = []; modules = paths.plugins.concat(paths.localPlugins) - .map((path) => { - let mod; - const pluginName = getPluginName(path); + .map((path) => { + let mod; + const pluginName = getPluginName(path); - // window.require allows us to ensure this doesn't get - // in the way of our build - try { - mod = window.require(path); - } catch (err) { - console.error(err.stack); - notify('Plugin load error', `"${pluginName}" failed to load in the renderer process. Check Developer Tools for details.`); - return; - } + // window.require allows us to ensure this doesn't get + // in the way of our build + try { + mod = window.require(path); + } catch (err) { + console.error(err.stack); + notify('Plugin load error', `"${pluginName}" failed to load in the renderer process. Check Developer Tools for details.`); + return; + } - for (const i in mod) { - mod[i]._pluginName = pluginName; - } + for (const i in mod) { + mod[i]._pluginName = pluginName; + } - if (mod.middleware) { - middlewares.push(mod.middleware); - } + if (mod.middleware) { + middlewares.push(mod.middleware); + } - if (mod.reduceUI) { - uiReducers.push(mod.reduceUI); - } + if (mod.reduceUI) { + uiReducers.push(mod.reduceUI); + } - if (mod.reduceSessions) { - sessionsReducers.push(mod.reduceSessions); - } + if (mod.reduceSessions) { + sessionsReducers.push(mod.reduceSessions); + } - if (mod.mapTermsState) { - connectors.Terms.state.push(mod.mapTermsState); - } + if (mod.mapTermsState) { + connectors.Terms.state.push(mod.mapTermsState); + } - if (mod.mapTermsDispatch) { - connectors.Terms.dispatch.push(mod.mapTermsDispatch); - } + if (mod.mapTermsDispatch) { + connectors.Terms.dispatch.push(mod.mapTermsDispatch); + } - if (mod.mapHeaderState) { - connectors.Header.state.push(mod.mapHeaderState); - } + if (mod.mapHeaderState) { + connectors.Header.state.push(mod.mapHeaderState); + } - if (mod.mapHeaderDispatch) { - connectors.Header.dispatch.push(mod.mapHeaderDispatch); - } + if (mod.mapHeaderDispatch) { + connectors.Header.dispatch.push(mod.mapHeaderDispatch); + } - if (mod.mapHyperTermState) { - connectors.HyperTerm.state.push(mod.mapHyperTermState); - } + if (mod.mapHyperTermState) { + connectors.HyperTerm.state.push(mod.mapHyperTermState); + } - if (mod.mapHyperTermDispatch) { - connectors.HyperTerm.dispatch.push(mod.mapHyperTermDispatch); - } + if (mod.mapHyperTermDispatch) { + connectors.HyperTerm.dispatch.push(mod.mapHyperTermDispatch); + } - if (mod.mapNotificationsState) { - connectors.Notifications.state.push(mod.mapNotificationsState); - } + if (mod.mapNotificationsState) { + connectors.Notifications.state.push(mod.mapNotificationsState); + } - if (mod.mapNotificationsDispatch) { - connectors.Notifications.dispatch.push(mod.mapNotificationsDispatch); - } + if (mod.mapNotificationsDispatch) { + connectors.Notifications.dispatch.push(mod.mapNotificationsDispatch); + } - if (mod.getTermProps) { - termPropsDecorators.push(mod.getTermProps); - } + if (mod.getTermProps) { + termPropsDecorators.push(mod.getTermProps); + } - if (mod.getTabProps) { - tabPropsDecorators.push(mod.getTabProps); - } + if (mod.getTabProps) { + tabPropsDecorators.push(mod.getTabProps); + } - if (mod.getTabsProps) { - tabsPropsDecorators.push(mod.getTabsProps); - } + if (mod.getTabsProps) { + tabsPropsDecorators.push(mod.getTabsProps); + } - if (mod.onRendererWindow) { - mod.onRendererWindow(window); - } + if (mod.onRendererWindow) { + mod.onRendererWindow(window); + } - return mod; - }) - .filter((mod) => !!mod); + return mod; + }) + .filter((mod) => !!mod); }; // load modules for initial decoration