From 2fdcead39dbc64464503f29c09d509e8e8b1b7c4 Mon Sep 17 00:00:00 2001 From: stevewang Date: Tue, 2 Jun 2020 14:37:28 +0800 Subject: [PATCH 1/3] chore(): update eslint config --- .eslintrc | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/.eslintrc b/.eslintrc index 767faaf..27ae785 100644 --- a/.eslintrc +++ b/.eslintrc @@ -6,16 +6,19 @@ ], "extends": [ "eslint:recommended", - "plugin:@typescript-eslint/eslint-recommended", "plugin:@typescript-eslint/recommended", "plugin:react/recommended", "prettier", "prettier/@typescript-eslint" ], "env": { + "browser": true, "es6": true, "jest": true }, + "globals": { + "chrome": true + }, "parserOptions": { "ecmaVersion": 9, "sourceType": "module" From 537e5bc216293a4014548312ccd3c9bee59d59d8 Mon Sep 17 00:00:00 2001 From: stevewang Date: Tue, 2 Jun 2020 14:38:17 +0800 Subject: [PATCH 2/3] fix(): fix cases --- src/panel/components/EvaluationsPanel.spec.tsx | 2 +- src/panel/components/EvaluationsPanel.tsx | 2 +- src/panel/components/TransformationsPanel.spec.tsx | 2 +- src/panel/components/TransformationsPanel.tsx | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/panel/components/EvaluationsPanel.spec.tsx b/src/panel/components/EvaluationsPanel.spec.tsx index cd2ef17..332abea 100644 --- a/src/panel/components/EvaluationsPanel.spec.tsx +++ b/src/panel/components/EvaluationsPanel.spec.tsx @@ -46,7 +46,7 @@ describe("EvaluationsPanel", () => { it("should toggle string-wrap", () => { const wrapper = shallow(); expect(wrapper.hasClass("string-wrap")).toBe(false); - wrapper.find("[label='String Wrap']").invoke("onChange")({ + wrapper.find("[label='String wrap']").invoke("onChange")({ target: { checked: true, }, diff --git a/src/panel/components/EvaluationsPanel.tsx b/src/panel/components/EvaluationsPanel.tsx index 2c7aeff..d503d35 100644 --- a/src/panel/components/EvaluationsPanel.tsx +++ b/src/panel/components/EvaluationsPanel.tsx @@ -89,7 +89,7 @@ export function EvaluationsPanel(): React.ReactElement { /> diff --git a/src/panel/components/TransformationsPanel.spec.tsx b/src/panel/components/TransformationsPanel.spec.tsx index 2daa309..070780c 100644 --- a/src/panel/components/TransformationsPanel.spec.tsx +++ b/src/panel/components/TransformationsPanel.spec.tsx @@ -38,7 +38,7 @@ describe("TransformationsPanel", () => { it("should toggle string-wrap", () => { const wrapper = shallow(); expect(wrapper.hasClass("string-wrap")).toBe(false); - wrapper.find("[label='String Wrap']").invoke("onChange")({ + wrapper.find("[label='String wrap']").invoke("onChange")({ target: { checked: true, }, diff --git a/src/panel/components/TransformationsPanel.tsx b/src/panel/components/TransformationsPanel.tsx index 034dc1b..3788483 100644 --- a/src/panel/components/TransformationsPanel.tsx +++ b/src/panel/components/TransformationsPanel.tsx @@ -60,7 +60,7 @@ export function TransformationsPanel(): React.ReactElement { /> From 7c6dc36e15ba9c9cce2f92f5eaf74f23c58997f0 Mon Sep 17 00:00:00 2001 From: stevewang Date: Tue, 2 Jun 2020 14:39:24 +0800 Subject: [PATCH 3/3] fix(): remove useless code and comments --- src/panel/components/EvaluationsPanel.tsx | 7 +------ src/panel/components/TransformationsPanel.tsx | 7 +------ 2 files changed, 2 insertions(+), 12 deletions(-) diff --git a/src/panel/components/EvaluationsPanel.tsx b/src/panel/components/EvaluationsPanel.tsx index d503d35..14d3d4a 100644 --- a/src/panel/components/EvaluationsPanel.tsx +++ b/src/panel/components/EvaluationsPanel.tsx @@ -10,7 +10,6 @@ import classNames from "classnames"; import { PanelSelector } from "./PanelSelector"; import { useEvaluationsContext } from "../libs/EvaluationsContext"; import { PropList, PropItem } from "./PropList"; -import { Storage } from "../libs/Storage"; export function EvaluationsPanel(): React.ReactElement { const { @@ -52,12 +51,8 @@ export function EvaluationsPanel(): React.ReactElement { const handleToggleLogs = React.useCallback( (event: React.FormEvent) => { savePreserveLogs((event.target as HTMLInputElement).checked); - // Storage.setItem( - // "preserveLogs", - // (event.target as HTMLInputElement).checked - // ); }, - [] + [savePreserveLogs] ); return ( diff --git a/src/panel/components/TransformationsPanel.tsx b/src/panel/components/TransformationsPanel.tsx index 3788483..c1df036 100644 --- a/src/panel/components/TransformationsPanel.tsx +++ b/src/panel/components/TransformationsPanel.tsx @@ -4,7 +4,6 @@ import classNames from "classnames"; import { PanelSelector } from "./PanelSelector"; import { useTransformationsContext } from "../libs/TransformationsContext"; import { PropItem } from "./PropList"; -import { Storage } from "../libs/Storage"; export function TransformationsPanel(): React.ReactElement { const { @@ -29,12 +28,8 @@ export function TransformationsPanel(): React.ReactElement { const handleToggleLogs = React.useCallback( (event: React.FormEvent) => { savePreserveLogs((event.target as HTMLInputElement).checked); - // Storage.setItem( - // "preserveLogs", - // (event.target as HTMLInputElement).checked - // ); }, - [] + [savePreserveLogs] ); return (