From 0b98a22eba4f7bbac215abd800293ac2be67b24d Mon Sep 17 00:00:00 2001 From: Shin'ya Ueoka Date: Tue, 11 Aug 2020 21:40:23 +0900 Subject: Enable @typescript-eslint/no-extra-non-null-assertion --- e2e/follow.test.ts | 4 ++-- e2e/lib/Console.ts | 4 ++-- e2e/lib/JSONOptionPage.ts | 2 +- e2e/lib/TestServer.ts | 4 ++-- e2e/mark.test.ts | 2 +- 5 files changed, 8 insertions(+), 8 deletions(-) (limited to 'e2e') diff --git a/e2e/follow.test.ts b/e2e/follow.test.ts index 5fb6c58..90f9a59 100644 --- a/e2e/follow.test.ts +++ b/e2e/follow.test.ts @@ -164,7 +164,7 @@ describe("follow test", () => { await page.sendKeys("a"); const tagName = (await webdriver.executeScript( - () => document.activeElement!!.tagName + () => document.activeElement!.tagName )) as string; assert.strictEqual(tagName.toLowerCase(), "input"); }); @@ -188,7 +188,7 @@ describe("follow test", () => { await page.sendKeys("a"); const tagName = (await webdriver.executeScript( - () => document.activeElement!!.tagName + () => document.activeElement!.tagName )) as string; assert.strictEqual(tagName.toLowerCase(), "input"); }); diff --git a/e2e/lib/Console.ts b/e2e/lib/Console.ts index 0bae2f7..de61d66 100644 --- a/e2e/lib/Console.ts +++ b/e2e/lib/Console.ts @@ -62,12 +62,12 @@ export class Console { const objs = []; for (const li of Array.from(items)) { if (li.classList.contains("vimvixen-console-completion-title")) { - objs.push({ type: "title", text: li.textContent!!.trim() }); + objs.push({ type: "title", text: li.textContent!.trim() }); } else if ("vimvixen-console-completion-item") { const highlight = li.classList.contains( "vimvixen-completion-selected" ); - objs.push({ type: "item", text: li.textContent!!.trim(), highlight }); + objs.push({ type: "item", text: li.textContent!.trim(), highlight }); } else { throw new Error(`unexpected class: ${li.className}`); } diff --git a/e2e/lib/JSONOptionPage.ts b/e2e/lib/JSONOptionPage.ts index 1c2db5b..0f2b0a7 100644 --- a/e2e/lib/JSONOptionPage.ts +++ b/e2e/lib/JSONOptionPage.ts @@ -15,7 +15,7 @@ export default class JSONOptionPage { ); await textarea.sendKeys(" "); await this.webdriver.executeScript(() => - document.querySelector("textarea")!!.blur() + document.querySelector("textarea")!.blur() ); } diff --git a/e2e/lib/TestServer.ts b/e2e/lib/TestServer.ts index e0c711b..dc86ba2 100644 --- a/e2e/lib/TestServer.ts +++ b/e2e/lib/TestServer.ts @@ -41,7 +41,7 @@ export default class TestServer { this.http = http.createServer(this.app); return new Promise((resolve) => { - this.http!!.listen(this.port, this.address, () => { + this.http!.listen(this.port, this.address, () => { resolve(); }); }); @@ -52,7 +52,7 @@ export default class TestServer { return Promise.resolve(); } return new Promise((resolve) => { - this.http!!.close(() => { + this.http!.close(() => { this.http = undefined; resolve(); }); diff --git a/e2e/mark.test.ts b/e2e/mark.test.ts index d7ec26c..0f09d82 100644 --- a/e2e/mark.test.ts +++ b/e2e/mark.test.ts @@ -86,7 +86,7 @@ describe("mark test", () => { handles = await webdriver.getAllWindowHandles(); assert.strictEqual(handles.length, 2); }); - await webdriver.switchTo().window(handles!![0]); + await webdriver.switchTo().window(handles![0]); page = await Page.navigateTo(webdriver, server.url("/#second")); await page.sendKeys("'", "A"); -- cgit v1.2.3 From 7e8c99d43a402b9e025a710a00879d557ac5b071 Mon Sep 17 00:00:00 2001 From: Shin'ya Ueoka Date: Tue, 11 Aug 2020 21:46:46 +0900 Subject: Enable eslint:recommended and prettier/react --- .eslintrc | 4 +++- e2e/lib/Console.ts | 2 +- e2e/repeat_n_times.test.ts | 2 -- 3 files changed, 4 insertions(+), 4 deletions(-) (limited to 'e2e') diff --git a/.eslintrc b/.eslintrc index dcdef09..5eb19bb 100644 --- a/.eslintrc +++ b/.eslintrc @@ -7,9 +7,11 @@ }, "extends": [ + "eslint:recommended", "plugin:@typescript-eslint/recommended", "plugin:react/recommended", - "plugin:prettier/recommended" + "plugin:prettier/recommended", + "prettier/react" ], "plugins": [ "@typescript-eslint", diff --git a/e2e/lib/Console.ts b/e2e/lib/Console.ts index de61d66..2c128d1 100644 --- a/e2e/lib/Console.ts +++ b/e2e/lib/Console.ts @@ -63,7 +63,7 @@ export class Console { for (const li of Array.from(items)) { if (li.classList.contains("vimvixen-console-completion-title")) { objs.push({ type: "title", text: li.textContent!.trim() }); - } else if ("vimvixen-console-completion-item") { + } else if (li.classList.contains("vimvixen-console-completion-item")) { const highlight = li.classList.contains( "vimvixen-completion-selected" ); diff --git a/e2e/repeat_n_times.test.ts b/e2e/repeat_n_times.test.ts index 303aa34..5a9b172 100644 --- a/e2e/repeat_n_times.test.ts +++ b/e2e/repeat_n_times.test.ts @@ -23,8 +23,6 @@ describe("tab test", () => { webdriver = lanthan.getWebDriver(); browser = lanthan.getWebExtBrowser(); await server.start(); - - browser = browser; }); after(async () => { -- cgit v1.2.3