diff options
author | Shin'ya Ueoka <ueokande@i-beam.org> | 2018-06-28 21:41:34 +0900 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-06-28 21:41:34 +0900 |
commit | d0c23587f8ee8c1bca38f036ae8f71078d6ca937 (patch) | |
tree | 2c5cb4aea22de3de6360220a6291440c7ac18230 /src/console/reducers | |
parent | 6d0732eb80f2a2b2546e659662537bf4e40d7e5c (diff) | |
parent | 05faaced137eb3a48780806fded04fd76bd9a84e (diff) |
Merge pull request #423 from ueokande/greenkeeper/eslint-5.0.1
Update eslint
Diffstat (limited to 'src/console/reducers')
-rw-r--r-- | src/console/reducers/index.js | 51 |
1 files changed, 22 insertions, 29 deletions
diff --git a/src/console/reducers/index.js b/src/console/reducers/index.js index 2aec55c..71b0776 100644 --- a/src/console/reducers/index.js +++ b/src/console/reducers/index.js @@ -51,68 +51,61 @@ const nextConsoleText = (completions, group, item, defaults) => { return completions[group].items[item].content; }; +// eslint-disable-next-line max-lines-per-function export default function reducer(state = defaultState, action = {}) { switch (action.type) { case actions.CONSOLE_HIDE: - return Object.assign({}, state, { - mode: '', - }); + return { ...state, + mode: '', }; case actions.CONSOLE_SHOW_COMMAND: - return Object.assign({}, state, { + return { ...state, mode: 'command', consoleText: action.text, - completions: [] - }); + completions: []}; case actions.CONSOLE_SHOW_FIND: - return Object.assign({}, state, { + return { ...state, mode: 'find', consoleText: '', - completions: [] - }); + completions: []}; case actions.CONSOLE_SHOW_ERROR: - return Object.assign({}, state, { + return { ...state, mode: 'error', - messageText: action.text, - }); + messageText: action.text, }; case actions.CONSOLE_SHOW_INFO: - return Object.assign({}, state, { + return { ...state, mode: 'info', - messageText: action.text, - }); + messageText: action.text, }; case actions.CONSOLE_HIDE_COMMAND: - return Object.assign({}, state, { + return { + ...state, mode: state.mode === 'command' || state.mode === 'find' ? '' : state.mode, - }); + }; case actions.CONSOLE_SET_CONSOLE_TEXT: - return Object.assign({}, state, { - consoleText: action.consoleText, - }); + return { ...state, + consoleText: action.consoleText, }; case actions.CONSOLE_SET_COMPLETIONS: - return Object.assign({}, state, { + return { ...state, completions: action.completions, completionSource: action.completionSource, groupSelection: -1, - itemSelection: -1, - }); + itemSelection: -1, }; case actions.CONSOLE_COMPLETION_NEXT: { let next = nextSelection(state); - return Object.assign({}, state, { + return { ...state, groupSelection: next[0], itemSelection: next[1], consoleText: nextConsoleText( state.completions, next[0], next[1], - state.completionSource), - }); + state.completionSource), }; } case actions.CONSOLE_COMPLETION_PREV: { let next = prevSelection(state); - return Object.assign({}, state, { + return { ...state, groupSelection: next[0], itemSelection: next[1], consoleText: nextConsoleText( state.completions, next[0], next[1], - state.completionSource), - }); + state.completionSource), }; } default: return state; |