diff options
author | Shin'ya Ueoka <ueokande@i-beam.org> | 2021-07-04 13:29:42 +0900 |
---|---|---|
committer | Shin'ya Ueoka <ueokande@i-beam.org> | 2021-07-04 13:29:42 +0900 |
commit | 6b88c15d1a6193cd090c5a1ae9b6ea06a467e171 (patch) | |
tree | e1b78080d8e10477007c9379b57a6213e6f72c6a | |
parent | 5904eeff1a75dcf83bcef7d5666a7473cc5b77de (diff) |
yarn lint:fix
23 files changed, 60 insertions, 83 deletions
diff --git a/src/background/infrastructures/ContentMessageClient.ts b/src/background/infrastructures/ContentMessageClient.ts index e889392..8c00626 100644 --- a/src/background/infrastructures/ContentMessageClient.ts +++ b/src/background/infrastructures/ContentMessageClient.ts @@ -19,7 +19,7 @@ export default class ContentMessageClient { const enabled = await browser.tabs.sendMessage(tabId, { type: messages.ADDON_ENABLED_QUERY, }); - return (enabled as any) as boolean; + return enabled as any as boolean; } async toggleAddonEnabled(tabId: number): Promise<void> { diff --git a/src/background/operators/impls/CommandOperatorFactoryChain.ts b/src/background/operators/impls/CommandOperatorFactoryChain.ts index 680a384..9408a4b 100644 --- a/src/background/operators/impls/CommandOperatorFactoryChain.ts +++ b/src/background/operators/impls/CommandOperatorFactoryChain.ts @@ -14,7 +14,8 @@ import StartFindOperator from "./StartFindOperator"; @injectable() export default class CommandOperatorFactoryChain - implements OperatorFactoryChain { + implements OperatorFactoryChain +{ constructor( @inject("TabPresenter") private readonly tabPresenter: TabPresenter, diff --git a/src/background/operators/impls/InternalOperatorFactoryChain.ts b/src/background/operators/impls/InternalOperatorFactoryChain.ts index 05615f6..00e8faf 100644 --- a/src/background/operators/impls/InternalOperatorFactoryChain.ts +++ b/src/background/operators/impls/InternalOperatorFactoryChain.ts @@ -10,7 +10,8 @@ import * as operations from "../../../shared/operations"; @injectable() export default class InternalOperatorFactoryChain - implements OperatorFactoryChain { + implements OperatorFactoryChain +{ constructor( @inject("WindowPresenter") private readonly windowPresenter: WindowPresenter, diff --git a/src/background/operators/impls/NavigateOperatorFactoryChain.ts b/src/background/operators/impls/NavigateOperatorFactoryChain.ts index 618db45..ce36e80 100644 --- a/src/background/operators/impls/NavigateOperatorFactoryChain.ts +++ b/src/background/operators/impls/NavigateOperatorFactoryChain.ts @@ -16,7 +16,8 @@ import * as operations from "../../../shared/operations"; @injectable() export default class NavigateOperatorFactoryChain - implements OperatorFactoryChain { + implements OperatorFactoryChain +{ constructor( @inject("TabPresenter") private readonly tabPresenter: TabPresenter, diff --git a/src/background/operators/impls/RepeatOperatorFactoryChain.ts b/src/background/operators/impls/RepeatOperatorFactoryChain.ts index 5038d48..a931209 100644 --- a/src/background/operators/impls/RepeatOperatorFactoryChain.ts +++ b/src/background/operators/impls/RepeatOperatorFactoryChain.ts @@ -8,7 +8,8 @@ import * as operations from "../../../shared/operations"; @injectable() export default class RepeatOperatorFactoryChain - implements OperatorFactoryChain { + implements OperatorFactoryChain +{ constructor( @inject("RepeatRepository") private readonly repeatRepository: RepeatRepository, diff --git a/src/background/presenters/ZoomPresenter.ts b/src/background/presenters/ZoomPresenter.ts index 5a3c64d..31d01c7 100644 --- a/src/background/presenters/ZoomPresenter.ts +++ b/src/background/presenters/ZoomPresenter.ts @@ -1,18 +1,5 @@ const ZOOM_SETTINGS = [ - 0.33, - 0.5, - 0.66, - 0.75, - 0.8, - 0.9, - 1.0, - 1.1, - 1.25, - 1.5, - 1.75, - 2.0, - 2.5, - 3.0, + 0.33, 0.5, 0.66, 0.75, 0.8, 0.9, 1.0, 1.1, 1.25, 1.5, 1.75, 2.0, 2.5, 3.0, ] as const; export default interface ZoomPresenter { diff --git a/src/console/completion/hooks.ts b/src/console/completion/hooks.ts index c3940c7..4402b70 100644 --- a/src/console/completion/hooks.ts +++ b/src/console/completion/hooks.ts @@ -246,49 +246,30 @@ export const useCompletions = () => { return; } - getOpenCompletions( - cmd.command, - cmd.args, - completionTypes - ).then((completions) => - dispatch(actions.setCompletions(completions)) + getOpenCompletions(cmd.command, cmd.args, completionTypes).then( + (completions) => dispatch(actions.setCompletions(completions)) ); break; case Command.Buffer: - getTabCompletions( - cmd.command, - cmd.args, - false - ).then((completions) => - dispatch(actions.setCompletions(completions)) + getTabCompletions(cmd.command, cmd.args, false).then( + (completions) => dispatch(actions.setCompletions(completions)) ); break; case Command.BufferDelete: case Command.BuffersDelete: - getTabCompletions( - cmd.command, - cmd.args, - true - ).then((completions) => - dispatch(actions.setCompletions(completions)) + getTabCompletions(cmd.command, cmd.args, true).then( + (completions) => dispatch(actions.setCompletions(completions)) ); break; case Command.BufferDeleteForce: case Command.BuffersDeleteForce: - getTabCompletions( - cmd.command, - cmd.args, - false - ).then((completions) => - dispatch(actions.setCompletions(completions)) + getTabCompletions(cmd.command, cmd.args, false).then( + (completions) => dispatch(actions.setCompletions(completions)) ); break; case Command.Set: - getPropertyCompletions( - cmd.command, - cmd.args - ).then((completions) => - dispatch(actions.setCompletions(completions)) + getPropertyCompletions(cmd.command, cmd.args).then( + (completions) => dispatch(actions.setCompletions(completions)) ); break; } @@ -314,12 +295,14 @@ export const useCompletions = () => { export const useSelectCompletion = () => { const state = React.useContext(CompletionStateContext); const dispatch = React.useContext(CompletionDispatchContext); - const next = React.useCallback(() => dispatch(actions.selectNext()), [ - dispatch, - ]); - const prev = React.useCallback(() => dispatch(actions.selectPrev()), [ - dispatch, - ]); + const next = React.useCallback( + () => dispatch(actions.selectNext()), + [dispatch] + ); + const prev = React.useCallback( + () => dispatch(actions.selectPrev()), + [dispatch] + ); const currentValue = React.useMemo(() => { if (state.select < 0) { return state.completionSource; diff --git a/src/console/components/CommandPrompt.tsx b/src/console/components/CommandPrompt.tsx index 1b6281b..0e2506c 100644 --- a/src/console/components/CommandPrompt.tsx +++ b/src/console/components/CommandPrompt.tsx @@ -21,12 +21,8 @@ const CommandPromptInner: React.FC<Props> = ({ initialInputValue }) => { const hide = useHide(); const [inputValue, setInputValue] = React.useState(initialInputValue); const { completions, updateCompletions } = useCompletions(); - const { - select, - currentValue, - selectNext, - selectPrev, - } = useSelectCompletion(); + const { select, currentValue, selectNext, selectPrev } = + useSelectCompletion(); const execCommand = useExecCommand(); useAutoResize(); diff --git a/src/console/hooks/useAutoResize.ts b/src/console/hooks/useAutoResize.ts index 4253606..26f1d76 100644 --- a/src/console/hooks/useAutoResize.ts +++ b/src/console/hooks/useAutoResize.ts @@ -10,10 +10,8 @@ const useAutoResize = () => { }, []); React.useLayoutEffect(() => { - const { - scrollWidth: width, - scrollHeight: height, - } = document.getElementById("vimvixen-console")!; + const { scrollWidth: width, scrollHeight: height } = + document.getElementById("vimvixen-console")!; consoleFrameClient.resize(width, height); if (width === prevWidth && height === prevHeight) { diff --git a/src/content/operators/impls/ClipboardOperatorFactoryChain.ts b/src/content/operators/impls/ClipboardOperatorFactoryChain.ts index 454aea1..3ae4442 100644 --- a/src/content/operators/impls/ClipboardOperatorFactoryChain.ts +++ b/src/content/operators/impls/ClipboardOperatorFactoryChain.ts @@ -12,7 +12,8 @@ import URLRepository from "./URLRepository"; @injectable() export default class ClipboardOperatorFactoryChain - implements OperatorFactoryChain { + implements OperatorFactoryChain +{ constructor( @inject("ClipboardRepository") private readonly clipboardRepository: ClipboardRepository, diff --git a/src/content/operators/impls/FollowOperatorFactoryChain.ts b/src/content/operators/impls/FollowOperatorFactoryChain.ts index 588e1a4..3867ed2 100644 --- a/src/content/operators/impls/FollowOperatorFactoryChain.ts +++ b/src/content/operators/impls/FollowOperatorFactoryChain.ts @@ -7,7 +7,8 @@ import * as operations from "../../../shared/operations"; @injectable() export default class FollowOperatorFactoryChain - implements OperatorFactoryChain { + implements OperatorFactoryChain +{ constructor( @inject("FollowMasterClient") private followMasterClient: FollowMasterClient diff --git a/src/content/operators/impls/HorizontalScrollOperator.ts b/src/content/operators/impls/HorizontalScrollOperator.ts index f813f85..41287e8 100644 --- a/src/content/operators/impls/HorizontalScrollOperator.ts +++ b/src/content/operators/impls/HorizontalScrollOperator.ts @@ -5,7 +5,8 @@ import SettingRepository from "../../repositories/SettingRepository"; export default class HorizontalScrollOperator extends AbstractScrollOperator - implements Operator { + implements Operator +{ constructor( private readonly presenter: ScrollPresenter, settingRepository: SettingRepository, diff --git a/src/content/operators/impls/PageScrollOperator.ts b/src/content/operators/impls/PageScrollOperator.ts index 377bf92..fbe4dbe 100644 --- a/src/content/operators/impls/PageScrollOperator.ts +++ b/src/content/operators/impls/PageScrollOperator.ts @@ -5,7 +5,8 @@ import SettingRepository from "../../repositories/SettingRepository"; export default class PageScrollOperator extends AbstractScrollOperator - implements Operator { + implements Operator +{ constructor( private readonly presenter: ScrollPresenter, settingRepository: SettingRepository, diff --git a/src/content/operators/impls/ScrollOperatorFactoryChain.ts b/src/content/operators/impls/ScrollOperatorFactoryChain.ts index 6847aea..8c5cea2 100644 --- a/src/content/operators/impls/ScrollOperatorFactoryChain.ts +++ b/src/content/operators/impls/ScrollOperatorFactoryChain.ts @@ -14,7 +14,8 @@ import ScrollToEndOperator from "./ScrollToEndOperator"; @injectable() export default class ScrollOperatorFactoryChain - implements OperatorFactoryChain { + implements OperatorFactoryChain +{ constructor( @inject("ScrollPresenter") private readonly scrollPresenter: ScrollPresenter, diff --git a/src/content/operators/impls/ScrollToBottomOperator.ts b/src/content/operators/impls/ScrollToBottomOperator.ts index 4db521b..d17ff46 100644 --- a/src/content/operators/impls/ScrollToBottomOperator.ts +++ b/src/content/operators/impls/ScrollToBottomOperator.ts @@ -5,7 +5,8 @@ import SettingRepository from "../../repositories/SettingRepository"; export default class ScrollToBottomOperator extends AbstractScrollOperator - implements Operator { + implements Operator +{ constructor( private readonly presenter: ScrollPresenter, settingRepository: SettingRepository diff --git a/src/content/operators/impls/ScrollToEndOperator.ts b/src/content/operators/impls/ScrollToEndOperator.ts index 8217e15..9469a29 100644 --- a/src/content/operators/impls/ScrollToEndOperator.ts +++ b/src/content/operators/impls/ScrollToEndOperator.ts @@ -5,7 +5,8 @@ import SettingRepository from "../../repositories/SettingRepository"; export default class ScrollToEndOperator extends AbstractScrollOperator - implements Operator { + implements Operator +{ constructor( private readonly presenter: ScrollPresenter, settingRepository: SettingRepository diff --git a/src/content/operators/impls/ScrollToHomeOperator.ts b/src/content/operators/impls/ScrollToHomeOperator.ts index a0d7701..f7b1bf6 100644 --- a/src/content/operators/impls/ScrollToHomeOperator.ts +++ b/src/content/operators/impls/ScrollToHomeOperator.ts @@ -5,7 +5,8 @@ import SettingRepository from "../../repositories/SettingRepository"; export default class ScrollToHomeOperator extends AbstractScrollOperator - implements Operator { + implements Operator +{ constructor( private readonly presenter: ScrollPresenter, settingRepository: SettingRepository diff --git a/src/content/operators/impls/ScrollToTopOperator.ts b/src/content/operators/impls/ScrollToTopOperator.ts index 6075758..cba59eb 100644 --- a/src/content/operators/impls/ScrollToTopOperator.ts +++ b/src/content/operators/impls/ScrollToTopOperator.ts @@ -5,7 +5,8 @@ import SettingRepository from "../../repositories/SettingRepository"; export default class ScrollToTopOperator extends AbstractScrollOperator - implements Operator { + implements Operator +{ constructor( private readonly presenter: ScrollPresenter, settingRepository: SettingRepository diff --git a/src/content/operators/impls/VerticalScrollOperator.ts b/src/content/operators/impls/VerticalScrollOperator.ts index 4ab336c..d852c28 100644 --- a/src/content/operators/impls/VerticalScrollOperator.ts +++ b/src/content/operators/impls/VerticalScrollOperator.ts @@ -5,7 +5,8 @@ import SettingRepository from "../../repositories/SettingRepository"; export default class VerticalScrollOperator extends AbstractScrollOperator - implements Operator { + implements Operator +{ constructor( private readonly presenter: ScrollPresenter, settingRepository: SettingRepository, diff --git a/src/content/presenters/ScrollPresenter.ts b/src/content/presenters/ScrollPresenter.ts index 78bec00..3f39784 100644 --- a/src/content/presenters/ScrollPresenter.ts +++ b/src/content/presenters/ScrollPresenter.ts @@ -21,12 +21,8 @@ const canBeScrolled = (element: Element): boolean => { // Check if the element's overflow and visibility permit scrolling. // Credit: https://github.com/philc/vimium/blob/bdf654aebe6f570f427c5f7bc9592cad86e642b5/content_scripts/scroller.js#L74 const isScrollableStyle = (element: Element): boolean => { - const { - overflowX, - overflowY, - overflow, - visibility, - } = window.getComputedStyle(element); + const { overflowX, overflowY, overflow, visibility } = + window.getComputedStyle(element); if ([overflow, overflowX, overflowY].includes("hidden")) { return false; } diff --git a/test/background/mock/MockBrowserSettingRepository.ts b/test/background/mock/MockBrowserSettingRepository.ts index 22e7084..9dd1b15 100644 --- a/test/background/mock/MockBrowserSettingRepository.ts +++ b/test/background/mock/MockBrowserSettingRepository.ts @@ -1,7 +1,8 @@ import BrowserSettingRepository from "../../../src/background/repositories/BrowserSettingRepository"; export default class MockBrowserSettingRepository - implements BrowserSettingRepository { + implements BrowserSettingRepository +{ constructor(private readonly homepageUrls: string[]) {} getHomepageUrls(): Promise<string[]> { diff --git a/test/content/mock/MockAddonEnabledRepository.ts b/test/content/mock/MockAddonEnabledRepository.ts index cbe248b..30454f0 100644 --- a/test/content/mock/MockAddonEnabledRepository.ts +++ b/test/content/mock/MockAddonEnabledRepository.ts @@ -1,7 +1,8 @@ import AddonEnabledRepository from "../../../src/content/repositories/AddonEnabledRepository"; export default class MockAddonEnabledRepository - implements AddonEnabledRepository { + implements AddonEnabledRepository +{ public enabled: boolean; constructor(initialValue = false) { diff --git a/test/content/operators/impls/MockConsoleFramePresenter.ts b/test/content/operators/impls/MockConsoleFramePresenter.ts index 23bc27f..3d40bb4 100644 --- a/test/content/operators/impls/MockConsoleFramePresenter.ts +++ b/test/content/operators/impls/MockConsoleFramePresenter.ts @@ -1,7 +1,8 @@ import ConsoleFramePresenter from "../../../../src/content/presenters/ConsoleFramePresenter"; export default class MockConsoleFramePresenter - implements ConsoleFramePresenter { + implements ConsoleFramePresenter +{ constructor(public attached: boolean) {} attach(): void { |