diff options
author | Shin'ya Ueoka <ueokande@i-beam.org> | 2019-12-22 10:01:24 +0900 |
---|---|---|
committer | Shin'ya Ueoka <ueokande@i-beam.org> | 2019-12-22 10:48:39 +0900 |
commit | 2e7006ce24c42ec2b6642346d153429338e7334e (patch) | |
tree | f1eb9e843ab4ec5d7d3f08fff8c858174b6f1284 /src/console | |
parent | 0881f92d20cb7b4f5a75671df739c3eaa3cd0ff0 (diff) |
npm run lint:fix
Diffstat (limited to 'src/console')
-rw-r--r-- | src/console/actions/console.ts | 2 | ||||
-rw-r--r-- | src/console/components/Console.tsx | 4 | ||||
-rw-r--r-- | src/console/components/console/Completion.tsx | 10 | ||||
-rw-r--r-- | src/console/index.tsx | 6 | ||||
-rw-r--r-- | src/console/reducers/index.ts | 10 |
5 files changed, 16 insertions, 16 deletions
diff --git a/src/console/actions/console.ts b/src/console/actions/console.ts index d03f52c..f7fa7a2 100644 --- a/src/console/actions/console.ts +++ b/src/console/actions/console.ts @@ -69,7 +69,7 @@ const setConsoleText = (consoleText: string): actions.ConsoleAction => { }; const getCompletions = async(text: string): Promise<actions.ConsoleAction> => { - let completions = await browser.runtime.sendMessage({ + const completions = await browser.runtime.sendMessage({ type: messages.CONSOLE_QUERY_COMPLETIONS, text, }); diff --git a/src/console/components/Console.tsx b/src/console/components/Console.tsx index 1743d15..eafe2a7 100644 --- a/src/console/components/Console.tsx +++ b/src/console/components/Console.tsx @@ -34,7 +34,7 @@ class Console extends React.Component<Props> { e.stopPropagation(); e.preventDefault(); - let value = (e.target as HTMLInputElement).value; + const value = (e.target as HTMLInputElement).value; if (this.props.mode === 'command') { return this.props.dispatch(consoleActions.enterCommand(value)); } else if (this.props.mode === 'find') { @@ -101,7 +101,7 @@ class Console extends React.Component<Props> { } onChange(e: React.ChangeEvent<HTMLInputElement>) { - let text = e.target.value; + const text = e.target.value; this.props.dispatch(consoleActions.setConsoleText(text)); if (this.props.mode === 'command') { this.props.dispatch(consoleActions.getCompletions(text)); diff --git a/src/console/components/console/Completion.tsx b/src/console/components/console/Completion.tsx index 169a39c..e2fa1de 100644 --- a/src/console/components/console/Completion.tsx +++ b/src/console/components/console/Completion.tsx @@ -35,11 +35,11 @@ class Completion extends React.Component<Props, State> { return null; } - let viewSelect = (() => { + const viewSelect = (() => { let index = 0; for (let i = 0; i < nextProps.completions.length; ++i) { ++index; - let g = nextProps.completions[i]; + const g = nextProps.completions[i]; if (nextProps.select + i + 1 < index + g.items.length) { return nextProps.select + i + 1; } @@ -64,12 +64,12 @@ class Completion extends React.Component<Props, State> { let eles = []; let index = 0; - for (let group of this.props.completions) { + for (const group of this.props.completions) { eles.push(<CompletionTitle key={`group-${index}`} title={ group.name } />); - for (let item of group.items) { + for (const item of group.items) { eles.push(<CompletionItem key={`item-${index}`} icon={item.icon} @@ -81,7 +81,7 @@ class Completion extends React.Component<Props, State> { } } - let viewOffset = this.state.viewOffset; + const viewOffset = this.state.viewOffset; eles = eles.slice(viewOffset, viewOffset + this.props.size); return ( diff --git a/src/console/index.tsx b/src/console/index.tsx index b655154..1209ec2 100644 --- a/src/console/index.tsx +++ b/src/console/index.tsx @@ -14,7 +14,7 @@ const store = createStore( ); window.addEventListener('load', () => { - let wrapper = document.getElementById('vimvixen-console'); + const wrapper = document.getElementById('vimvixen-console'); ReactDOM.render( <Provider store={store} > <Console></Console> @@ -23,7 +23,7 @@ window.addEventListener('load', () => { }); const onMessage = (message: any): any => { - let msg = messages.valueOf(message); + const msg = messages.valueOf(message); switch (msg.type) { case messages.CONSOLE_SHOW_COMMAND: return store.dispatch(consoleActions.showCommand(msg.command)); @@ -39,5 +39,5 @@ const onMessage = (message: any): any => { }; browser.runtime.onMessage.addListener(onMessage); -let port = browser.runtime.connect(undefined, { name: 'vimvixen-console' }); +const port = browser.runtime.connect(undefined, { name: 'vimvixen-console' }); port.onMessage.addListener(onMessage); diff --git a/src/console/reducers/index.ts b/src/console/reducers/index.ts index b6be483..048a24f 100644 --- a/src/console/reducers/index.ts +++ b/src/console/reducers/index.ts @@ -28,7 +28,7 @@ const nextSelection = (state: State): number => { return 0; } - let length = state.completions + const length = state.completions .map(g => g.items.length) .reduce((x, y) => x + y); if (state.select + 1 < length) { @@ -38,7 +38,7 @@ const nextSelection = (state: State): number => { }; const prevSelection = (state: State): number => { - let length = state.completions + const length = state.completions .map(g => g.items.length) .reduce((x, y) => x + y); if (state.select < 0) { @@ -51,7 +51,7 @@ const nextConsoleText = (completions: any[], select: number, defaults: any) => { if (select < 0) { return defaults; } - let items = completions.map(g => g.items).reduce((g1, g2) => g1.concat(g2)); + const items = completions.map(g => g.items).reduce((g1, g2) => g1.concat(g2)); return items[select].content; }; @@ -96,14 +96,14 @@ export default function reducer( completionSource: action.completionSource, select: -1 }; case actions.CONSOLE_COMPLETION_NEXT: { - let select = nextSelection(state); + const select = nextSelection(state); return { ...state, select: select, consoleText: nextConsoleText( state.completions, select, state.completionSource) }; } case actions.CONSOLE_COMPLETION_PREV: { - let select = prevSelection(state); + const select = prevSelection(state); return { ...state, select: select, consoleText: nextConsoleText( |