aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.eslintrc1
-rw-r--r--src/@types/browser/index.d.ts13
-rw-r--r--src/@types/web-ext-api/index.d.ts14
-rw-r--r--src/background/repositories/BrowserSettingRepository.ts15
-rw-r--r--src/content/presenters/FindPresenter.ts20
-rw-r--r--src/shared/Command.ts29
6 files changed, 27 insertions, 65 deletions
diff --git a/.eslintrc b/.eslintrc
index cdb4b61..8ef2463 100644
--- a/.eslintrc
+++ b/.eslintrc
@@ -29,7 +29,6 @@
"@typescript-eslint/no-empty-function": "off",
"@typescript-eslint/no-explicit-any": "off",
"@typescript-eslint/no-extra-non-null-assertion": "off",
- "@typescript-eslint/no-namespace": "off",
"@typescript-eslint/no-non-null-assertion": "off",
"@typescript-eslint/no-unused-vars": ["error", { "argsIgnorePattern": "^_" }],
"@typescript-eslint/no-use-before-define": "off"
diff --git a/src/@types/browser/index.d.ts b/src/@types/browser/index.d.ts
new file mode 100644
index 0000000..14acfe0
--- /dev/null
+++ b/src/@types/browser/index.d.ts
@@ -0,0 +1,13 @@
+// NOTE: window.find is not standard API
+// https://developer.mozilla.org/en-US/docs/Web/API/Window/find
+interface Window {
+ find(
+ aString: string,
+ aCaseSensitive?: boolean,
+ aBackwards?: boolean,
+ aWrapAround?: boolean,
+ aWholeWord?: boolean,
+ aSearchInFrames?: boolean,
+ aShowDialog?: boolean
+ ): boolean;
+}
diff --git a/src/@types/web-ext-api/index.d.ts b/src/@types/web-ext-api/index.d.ts
new file mode 100644
index 0000000..7eed334
--- /dev/null
+++ b/src/@types/web-ext-api/index.d.ts
@@ -0,0 +1,14 @@
+declare namespace browser.browserSettings.homepageOverride {
+ type BrowserSettings = {
+ value: string;
+ levelOfControl: LevelOfControlType;
+ };
+
+ type LevelOfControlType =
+ | "not_controllable"
+ | "controlled_by_other_extensions"
+ | "controllable_by_this_extension"
+ | "controlled_by_this_extension";
+
+ function get(param: { [key: string]: string }): Promise<BrowserSettings>;
+}
diff --git a/src/background/repositories/BrowserSettingRepository.ts b/src/background/repositories/BrowserSettingRepository.ts
index 272cc1e..e24874b 100644
--- a/src/background/repositories/BrowserSettingRepository.ts
+++ b/src/background/repositories/BrowserSettingRepository.ts
@@ -1,21 +1,6 @@
import { injectable } from "tsyringe";
import * as urls from "../../shared/urls";
-declare namespace browser.browserSettings.homepageOverride {
- type BrowserSettings = {
- value: string;
- levelOfControl: LevelOfControlType;
- };
-
- type LevelOfControlType =
- | "not_controllable"
- | "controlled_by_other_extensions"
- | "controllable_by_this_extension"
- | "controlled_by_this_extension";
-
- function get(param: { [key: string]: string }): Promise<BrowserSettings>;
-}
-
@injectable()
export default class BrowserSettingRepository {
async getHomepageUrls(): Promise<string[]> {
diff --git a/src/content/presenters/FindPresenter.ts b/src/content/presenters/FindPresenter.ts
index 117142c..b25190c 100644
--- a/src/content/presenters/FindPresenter.ts
+++ b/src/content/presenters/FindPresenter.ts
@@ -4,26 +4,6 @@ export default interface FindPresenter {
clearSelection(): void;
}
-// window.find(aString, aCaseSensitive, aBackwards, aWrapAround,
-// aWholeWord, aSearchInFrames);
-//
-// NOTE: window.find is not standard API
-// https://developer.mozilla.org/en-US/docs/Web/API/Window/find
-interface MyWindow extends Window {
- find(
- aString: string,
- aCaseSensitive?: boolean,
- aBackwards?: boolean,
- aWrapAround?: boolean,
- aWholeWord?: boolean,
- aSearchInFrames?: boolean,
- aShowDialog?: boolean
- ): boolean;
-}
-
-// eslint-disable-next-line no-var, vars-on-top, init-declarations
-declare var window: MyWindow;
-
export class FindPresenterImpl implements FindPresenter {
find(keyword: string, backwards: boolean): boolean {
const caseSensitive = false;
diff --git a/src/shared/Command.ts b/src/shared/Command.ts
index 05b8b83..70347bf 100644
--- a/src/shared/Command.ts
+++ b/src/shared/Command.ts
@@ -13,32 +13,3 @@ export enum Command {
Set = "set",
Help = "help",
}
-
-export namespace Command {
- export function members(): Command[] {
- return [
- Command.Open,
- Command.TabOpen,
- Command.WindowOpen,
- Command.Buffer,
- Command.BufferDelete,
- Command.BufferDeleteForce,
- Command.BuffersDelete,
- Command.BuffersDeleteForce,
- Command.AddBookmark,
- Command.Quit,
- Command.QuitAll,
- Command.Set,
- Command.Help,
- ];
- }
-
- export function valueOf(value: string): Command {
- const map = new Map(members().map((cmd) => [cmd.toString(), cmd]));
- const cmd = map.get(value);
- if (!cmd) {
- throw new Error(`unknown command '${value}`);
- }
- return cmd;
- }
-}