Skip to content

Commit

Permalink
replace default export with named export
Browse files Browse the repository at this point in the history
  • Loading branch information
ueokande committed Jul 20, 2024
1 parent db8d6b4 commit 4ca2cce
Show file tree
Hide file tree
Showing 328 changed files with 678 additions and 822 deletions.
6 changes: 6 additions & 0 deletions .eslintrc
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,12 @@
"@typescript-eslint/no-explicit-any": "off",
"@typescript-eslint/no-non-null-assertion": "off",
"@typescript-eslint/no-unused-vars": ["error", { "argsIgnorePattern": "^_" }],
"no-restricted-exports": ["error", {
"restrictDefaultExports": {
"direct": true,
"named": true
}
}],
"no-console": "error"
},
"overrides": [
Expand Down
2 changes: 1 addition & 1 deletion e2e/blacklist.test.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { test, expect } from "./lib/fixture";
import { newScrollableServer } from "./lib/servers";
import SettingRepository from "./lib/SettingRepository";
import { SettingRepository } from "./lib/SettingRepository";

const server = newScrollableServer();
const READY_STATE_SELECTOR =
Expand Down
2 changes: 1 addition & 1 deletion e2e/clipboard.test.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { test, expect } from "./lib/fixture";
import * as clipboard from "./lib/clipboard";
import SettingRepository from "./lib/SettingRepository";
import { SettingRepository } from "./lib/SettingRepository";
import { newNopServer } from "./lib/servers";

const server = newNopServer();
Expand Down
2 changes: 1 addition & 1 deletion e2e/command.test.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { test, expect } from "./lib/fixture";
import { newNopServer } from "./lib/servers";
import SettingRepository from "./lib/SettingRepository";
import { SettingRepository } from "./lib/SettingRepository";

const server = newNopServer();

Expand Down
2 changes: 1 addition & 1 deletion e2e/completion_open.test.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { test, expect } from "./lib/fixture";
import { newNopServer } from "./lib/servers";
import SettingRepository from "./lib/SettingRepository";
import { SettingRepository } from "./lib/SettingRepository";

const server = newNopServer();

Expand Down
2 changes: 1 addition & 1 deletion e2e/follow_properties.test.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { test, expect } from "./lib/fixture";
import { newSingleContentServer } from "./lib/servers";
import SettingRepository from "./lib/SettingRepository";
import { SettingRepository } from "./lib/SettingRepository";

const setupHintchars = async (api: typeof browser) => {
await new SettingRepository(api).save({
Expand Down
2 changes: 1 addition & 1 deletion e2e/lib/SettingRepository.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import type { SerializedSettings } from "../../src/settings/schema";

export default class SettingRepository {
export class SettingRepository {
constructor(private readonly api: typeof browser) {}

async save(serialized: SerializedSettings): Promise<void> {
Expand Down
16 changes: 8 additions & 8 deletions src/background/Application.ts
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
import { injectable, inject } from "inversify";
import BackgroundMessageListener from "./messaging/BackgroundMessageListener";
import FindPortListener from "./messaging/FindPortListener";
import VersionUseCase from "./usecases/VersionUseCase";
import { BackgroundMessageListener } from "./messaging/BackgroundMessageListener";
import { FindPortListener } from "./messaging/FindPortListener";
import { VersionUseCase } from "./usecases/VersionUseCase";
import type { FindRepository } from "./repositories/FindRepository";
import type { ReadyFrameRepository } from "./repositories/ReadyFrameRepository";
import SettingsEventUseCase from "./usecases/SettingsEventUseCase";
import { SettingsEventUseCase } from "./usecases/SettingsEventUseCase";
import type { FrameClient } from "./clients/FrameClient";
import AddonEnabledEventUseCase from "./usecases/AddonEnabledEventUseCase";
import { AddonEnabledEventUseCase } from "./usecases/AddonEnabledEventUseCase";
import type { LastSelectedTabRepository } from "./repositories/LastSelectedTabRepository";
import ModeUseCase from "./usecases/ModeUseCase";
import HintModeUseCase from "./usecases/HintModeUseCase";
import { ModeUseCase } from "./usecases/ModeUseCase";
import { HintModeUseCase } from "./usecases/HintModeUseCase";

@injectable()
export default class Application {
export class Application {
constructor(
@inject(BackgroundMessageListener)
private readonly backgroundMessageListener: BackgroundMessageListener,
Expand Down
4 changes: 1 addition & 3 deletions src/background/command/AddBookmarkCommand.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import type { Command, CommandContext, Completions } from "./types";
import type { ConsoleClient } from "../clients/ConsoleClient";

class AddBookmarkCommand implements Command {
export class AddBookmarkCommand implements Command {
constructor(private readonly consoleClient: ConsoleClient) {}

names(): string[] {
Expand Down Expand Up @@ -49,5 +49,3 @@ class AddBookmarkCommand implements Command {
return this.consoleClient.showInfo(sender.tabId, message);
}
}

export default AddBookmarkCommand;
6 changes: 2 additions & 4 deletions src/background/command/BufferCommand.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import type { Command, CommandContext, Completions } from "./types";
import type { LastSelectedTabRepository } from "../repositories/LastSelectedTabRepository";
import BufferCommandHelper from "./BufferCommandHelper";
import { BufferCommandHelper } from "./BufferCommandHelper";

class BufferCommand implements Command {
export class BufferCommand implements Command {
constructor(
private readonly lastSelectedTabRepository: LastSelectedTabRepository,
private readonly bufferCommandHelper = new BufferCommandHelper(
Expand Down Expand Up @@ -87,5 +87,3 @@ class BufferCommand implements Command {
await chrome.tabs.update(tabId, { active: true });
}
}

export default BufferCommand;
2 changes: 1 addition & 1 deletion src/background/command/BufferCommandHelper.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import type { Completions } from "../../shared/completions";
import type { LastSelectedTabRepository } from "../repositories/LastSelectedTabRepository";

export default class BufferCommandHelper {
export class BufferCommandHelper {
constructor(
private readonly lastSelectedTabRepository: LastSelectedTabRepository,
) {}
Expand Down
6 changes: 2 additions & 4 deletions src/background/command/BufferDeleteCommand.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import type { Command, CommandContext, Completions } from "./types";
import type BufferCommandHelper from "./BufferCommandHelper";
import type { BufferCommandHelper } from "./BufferCommandHelper";

class BufferDeleteCommand implements Command {
export class BufferDeleteCommand implements Command {
constructor(private readonly bufferCommandHelper: BufferCommandHelper) {}

names(): string[] {
Expand Down Expand Up @@ -35,5 +35,3 @@ class BufferDeleteCommand implements Command {
return chrome.tabs.remove(tabs[0].id!);
}
}

export default BufferDeleteCommand;
6 changes: 2 additions & 4 deletions src/background/command/BufferDeletesCommand.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import type { Command, CommandContext, Completions } from "./types";
import type BufferCommandHelper from "./BufferCommandHelper";
import type { BufferCommandHelper } from "./BufferCommandHelper";

class BDeletesCommand implements Command {
export class BufferDeletesCommand implements Command {
constructor(private readonly bufferCommandHelper: BufferCommandHelper) {}

names(): string[] {
Expand Down Expand Up @@ -34,5 +34,3 @@ class BDeletesCommand implements Command {
await chrome.tabs.remove(ids);
}
}

export default BDeletesCommand;
4 changes: 1 addition & 3 deletions src/background/command/HelpCommand.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import type { Command, CommandContext, Completions } from "./types";

const url = "https://ueokande.github.io/vimmatic/";

class HelpCommand implements Command {
export class HelpCommand implements Command {
names(): string[] {
return ["h", "help"];
}
Expand All @@ -27,5 +27,3 @@ class HelpCommand implements Command {
await chrome.tabs.create({ url, active: true });
}
}

export default HelpCommand;
6 changes: 2 additions & 4 deletions src/background/command/OpenCommand.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ import type { Command, CommandContext, Completions } from "./types";
import * as urls from "../../shared/urls";
import type { SearchEngineSettings } from "../settings/SearchEngineSettings";
import type { PropertySettings } from "../settings/PropertySettings";
import OpenCommandHelper from "./OpenCommandHelper";
import { OpenCommandHelper } from "./OpenCommandHelper";

class OpenCommand implements Command {
export class OpenCommand implements Command {
constructor(
private readonly searchEngineSettings: SearchEngineSettings,
propertySettings: PropertySettings,
Expand Down Expand Up @@ -40,5 +40,3 @@ class OpenCommand implements Command {
await chrome.tabs.update({ url });
}
}

export default OpenCommand;
2 changes: 1 addition & 1 deletion src/background/command/OpenCommandHelper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import type { PropertySettings } from "../settings/PropertySettings";

const COMPLETION_ITEM_LIMIT = 10;

export default class OpenCommandHelper {
export class OpenCommandHelper {
constructor(
private readonly searchEngineSettings: SearchEngineSettings,
private readonly propertySettings: PropertySettings,
Expand Down
4 changes: 1 addition & 3 deletions src/background/command/QuitAllCommand.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import type { Command, CommandContext, Completions } from "./types";

class QuitAllCommand implements Command {
export class QuitAllCommand implements Command {
names(): string[] {
return ["qa", "quitall"];
}
Expand Down Expand Up @@ -30,5 +30,3 @@ class QuitAllCommand implements Command {
await chrome.tabs.remove(ids);
}
}

export default QuitAllCommand;
4 changes: 1 addition & 3 deletions src/background/command/QuitCommand.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import type { Completions, Command, CommandContext } from "./types";

class QuitCommand implements Command {
export class QuitCommand implements Command {
names(): string[] {
return ["q", "quit"];
}
Expand Down Expand Up @@ -28,5 +28,3 @@ class QuitCommand implements Command {
await chrome.tabs.remove(sender.tabId);
}
}

export default QuitCommand;
4 changes: 1 addition & 3 deletions src/background/command/SetCommand.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ const mustNumber = (v: any): number => {
return num;
};

class SetCommand implements Command {
export class SetCommand implements Command {
constructor(
private readonly propretySettings: PropertySettings,
private readonly propertyRegsitry: PropertyRegistry,
Expand Down Expand Up @@ -160,5 +160,3 @@ class SetCommand implements Command {
}
}
}

export default SetCommand;
6 changes: 2 additions & 4 deletions src/background/command/TabOpenCommand.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ import type { Command, CommandContext, Completions } from "./types";
import * as urls from "../../shared/urls";
import type { SearchEngineSettings } from "../settings/SearchEngineSettings";
import type { PropertySettings } from "../settings/PropertySettings";
import OpenCommandHelper from "./OpenCommandHelper";
import { OpenCommandHelper } from "./OpenCommandHelper";

class TabOpenCommand implements Command {
export class TabOpenCommand implements Command {
constructor(
private readonly searchEngineSettings: SearchEngineSettings,
propertySettings: PropertySettings,
Expand Down Expand Up @@ -40,5 +40,3 @@ class TabOpenCommand implements Command {
await chrome.tabs.create({ url });
}
}

export default TabOpenCommand;
6 changes: 2 additions & 4 deletions src/background/command/WindowOpenCommand.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ import type { Completions, Command, CommandContext } from "./types";
import * as urls from "../../shared/urls";
import type { SearchEngineSettings } from "../settings/SearchEngineSettings";
import type { PropertySettings } from "../settings/PropertySettings";
import OpenCommandHelper from "./OpenCommandHelper";
import { OpenCommandHelper } from "./OpenCommandHelper";

class WindowOpenCommand implements Command {
export class WindowOpenCommand implements Command {
constructor(
private readonly searchEngineSettings: SearchEngineSettings,
propertySettings: PropertySettings,
Expand Down Expand Up @@ -40,5 +40,3 @@ class WindowOpenCommand implements Command {
await chrome.windows.create({ url });
}
}

export default WindowOpenCommand;
24 changes: 12 additions & 12 deletions src/background/command/index.ts
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
import { injectable, inject } from "inversify";
import AddBookmarkCommand from "./AddBookmarkCommand";
import BufferCommand from "./BufferCommand";
import BufferDeleteCommand from "./BufferDeleteCommand";
import BufferDeletesCommand from "./BufferDeletesCommand";
import HelpCommand from "./HelpCommand";
import OpenCommand from "./OpenCommand";
import QuitAllCommand from "./QuitAllCommand";
import QuitCommand from "./QuitCommand";
import SetCommand from "./SetCommand";
import TabOpenCommand from "./TabOpenCommand";
import WindowOpenCommand from "./WindowOpenCommand";
import BufferCommandHelper from "./BufferCommandHelper";
import { AddBookmarkCommand } from "./AddBookmarkCommand";
import { BufferCommand } from "./BufferCommand";
import { BufferDeleteCommand } from "./BufferDeleteCommand";
import { BufferDeletesCommand } from "./BufferDeletesCommand";
import { HelpCommand } from "./HelpCommand";
import { OpenCommand } from "./OpenCommand";
import { QuitAllCommand } from "./QuitAllCommand";
import { QuitCommand } from "./QuitCommand";
import { SetCommand } from "./SetCommand";
import { TabOpenCommand } from "./TabOpenCommand";
import { WindowOpenCommand } from "./WindowOpenCommand";
import { BufferCommandHelper } from "./BufferCommandHelper";
import type { PropertyRegistry } from "../property/PropertyRegistry";
import type { PropertySettings } from "../settings/PropertySettings";
import type { SearchEngineSettings } from "../settings/SearchEngineSettings";
Expand Down
4 changes: 2 additions & 2 deletions src/background/controllers/CommandController.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import { injectable, inject } from "inversify";
import type { Completions } from "../../shared/completions";
import CommandUseCase from "../usecases/CommandUseCase";
import { CommandUseCase } from "../usecases/CommandUseCase";
import type { RequestContext } from "../messaging/types";

@injectable()
export default class CommandController {
export class CommandController {
constructor(
@inject(CommandUseCase)
private readonly commandUseCase: CommandUseCase,
Expand Down
4 changes: 2 additions & 2 deletions src/background/controllers/ConsoleController.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { injectable, inject } from "inversify";
import ConsoleUseCase from "../usecases/ConsoleUseCase";
import { ConsoleUseCase } from "../usecases/ConsoleUseCase";
import type { RequestContext } from "../messaging/types";

@injectable()
export default class ConsoleController {
export class ConsoleController {
constructor(
@inject(ConsoleUseCase)
private readonly consoleUseCase: ConsoleUseCase,
Expand Down
4 changes: 2 additions & 2 deletions src/background/controllers/FindController.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import { injectable, inject } from "inversify";
import type { Completions } from "../../shared/completions";
import FindUseCase from "../usecases/FindUseCase";
import { FindUseCase } from "../usecases/FindUseCase";
import type { RequestContext } from "../messaging/types";

@injectable()
export default class FindController {
export class FindController {
constructor(
@inject(FindUseCase)
private findUseCase: FindUseCase,
Expand Down
18 changes: 9 additions & 9 deletions src/background/controllers/KeyController.ts
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
import { injectable, inject } from "inversify";
import type { RequestContext } from "../messaging/types";
import MarkJumpUseCase from "../usecases/MarkJumpUseCase";
import MarkSetUseCase from "../usecases/MarkSetUseCase";
import HintModeUseCaes from "../usecases/HintModeUseCase";
import HintKeyUseCase from "../usecases/HintKeyUseCase";
import ModeUseCase from "../usecases/ModeUseCase";
import { MarkJumpUseCase } from "../usecases/MarkJumpUseCase";
import { MarkSetUseCase } from "../usecases/MarkSetUseCase";
import { HintModeUseCase } from "../usecases/HintModeUseCase";
import { HintKeyUseCase } from "../usecases/HintKeyUseCase";
import { ModeUseCase } from "../usecases/ModeUseCase";

@injectable()
export default class KeyController {
export class KeyController {
constructor(
@inject(MarkSetUseCase)
private readonly markSetUseCase: MarkSetUseCase,
@inject(MarkJumpUseCase)
private readonly markJumpUseCase: MarkJumpUseCase,
@inject(HintModeUseCaes)
private readonly hintModeUseCaes: HintModeUseCaes,
@inject(HintModeUseCase)
private readonly hintModeUseCase: HintModeUseCase,
@inject(HintKeyUseCase)
private readonly hintKeyUseCase: HintKeyUseCase,
@inject(ModeUseCase)
Expand All @@ -30,7 +30,7 @@ export default class KeyController {
if (mode === "follow") {
const continued = await this.hintKeyUseCase.pressKey(sender.tab.id, key);
if (!continued) {
await this.hintModeUseCaes.stop(sender.tab.id);
await this.hintModeUseCase.stop(sender.tab.id);
await this.modeUseCase.resetMode(sender.tab.id);
}
} else if (mode === "mark-set") {
Expand Down
4 changes: 2 additions & 2 deletions src/background/controllers/OperationController.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import { inject, injectable } from "inversify";
import type { Operation } from "../../shared/operation";
import type { RequestContext } from "../messaging/types";
import OperationUseCase from "../usecases/OperationUseCase";
import { OperationUseCase } from "../usecases/OperationUseCase";

@injectable()
export default class OperationController {
export class OperationController {
constructor(
@inject(OperationUseCase)
private readonly operationUseCase: OperationUseCase,
Expand Down
Loading

0 comments on commit 4ca2cce

Please sign in to comment.