From 2e7006ce24c42ec2b6642346d153429338e7334e Mon Sep 17 00:00:00 2001 From: Shin'ya Ueoka Date: Sun, 22 Dec 2019 10:01:24 +0900 Subject: npm run lint:fix --- src/console/actions/console.ts | 2 +- src/console/components/Console.tsx | 4 ++-- src/console/components/console/Completion.tsx | 10 +++++----- src/console/index.tsx | 6 +++--- src/console/reducers/index.ts | 10 +++++----- 5 files changed, 16 insertions(+), 16 deletions(-) (limited to 'src/console') 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 => { - 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 { 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 { } onChange(e: React.ChangeEvent) { - 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 { 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 { let eles = []; let index = 0; - for (let group of this.props.completions) { + for (const group of this.props.completions) { eles.push(); - for (let item of group.items) { + for (const item of group.items) { eles.push( { } } - 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( @@ -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( -- cgit v1.2.3