From b57ede7d89deda7c8dd2498f31254df5adc15332 Mon Sep 17 00:00:00 2001 From: Aidan Timson Date: Sat, 20 Mar 2021 12:28:11 +0000 Subject: [PATCH 1/5] Remove tslint errors --- frontend/tsconfig.json | 1 + 1 file changed, 1 insertion(+) diff --git a/frontend/tsconfig.json b/frontend/tsconfig.json index 9d379a3c4..662a9c115 100644 --- a/frontend/tsconfig.json +++ b/frontend/tsconfig.json @@ -14,6 +14,7 @@ "resolveJsonModule": true, "isolatedModules": true, "noEmit": true, + "noImplicitAny": false, "jsx": "react-jsx" }, "include": ["src"] From 68e091ad4b6bb2bbe1a183f2df07615277e09ff0 Mon Sep 17 00:00:00 2001 From: Aidan Timson Date: Sat, 20 Mar 2021 12:31:24 +0000 Subject: [PATCH 2/5] Add more tsconfig --- frontend/tsconfig.json | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/frontend/tsconfig.json b/frontend/tsconfig.json index 662a9c115..899aeaaff 100644 --- a/frontend/tsconfig.json +++ b/frontend/tsconfig.json @@ -13,8 +13,10 @@ "moduleResolution": "node", "resolveJsonModule": true, "isolatedModules": true, - "noEmit": true, + "noEmit": false, "noImplicitAny": false, + "noImplicitReturns": false, + "noImplicitThis": false, "jsx": "react-jsx" }, "include": ["src"] From e5cbd332d886fba9582e9bcf1eab49297fb2a1e0 Mon Sep 17 00:00:00 2001 From: Aidan Timson Date: Sat, 20 Mar 2021 12:31:31 +0000 Subject: [PATCH 3/5] Set type --- frontend/src/Components/HomeAssistant/Cards/Light.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/frontend/src/Components/HomeAssistant/Cards/Light.tsx b/frontend/src/Components/HomeAssistant/Cards/Light.tsx index e7544c119..459250673 100644 --- a/frontend/src/Components/HomeAssistant/Cards/Light.tsx +++ b/frontend/src/Components/HomeAssistant/Cards/Light.tsx @@ -120,7 +120,7 @@ function Light(props: EntityProps): ReactElement | null { }); }; - const controls = []; + const controls: Array = []; if (attrClasses.includes("has-brightness")) controls.push( From bad20c83bf39ed57b0f758137c1b400ec46ba4e1 Mon Sep 17 00:00:00 2001 From: Aidan Timson Date: Sat, 20 Mar 2021 12:32:36 +0000 Subject: [PATCH 4/5] Require node types for all --- package.json | 1 + yarn.lock | 1 + 2 files changed, 2 insertions(+) diff --git a/package.json b/package.json index c14b95ec1..87f82ad26 100644 --- a/package.json +++ b/package.json @@ -16,6 +16,7 @@ "prettier-yml": "prettier --write ./**/*.yml" }, "devDependencies": { + "@types/node": "14.14.35", "@typescript-eslint/eslint-plugin": "4.18.0", "@typescript-eslint/parser": "4.18.0", "eslint": "7.22.0", diff --git a/yarn.lock b/yarn.lock index 8fcd7587c..63d2e5834 100644 --- a/yarn.lock +++ b/yarn.lock @@ -15324,6 +15324,7 @@ resolve@1.18.1: version: 0.0.0-use.local resolution: "root-workspace-0b6124@workspace:." dependencies: + "@types/node": 14.14.35 "@typescript-eslint/eslint-plugin": 4.18.0 "@typescript-eslint/parser": 4.18.0 eslint: 7.22.0 From d0f7935ae758723e0b4b681eefe59a7ee17f8df1 Mon Sep 17 00:00:00 2001 From: Aidan Timson Date: Sat, 20 Mar 2021 12:40:35 +0000 Subject: [PATCH 5/5] Remove hass reliance for configuration --- .../Configuration/Configuration.tsx | 3 +-- .../src/Components/Configuration/Item.tsx | 3 +-- .../src/Components/Configuration/Section.tsx | 5 +---- frontend/src/Components/Main.tsx | 22 +++++++------------ 4 files changed, 11 insertions(+), 22 deletions(-) diff --git a/frontend/src/Components/Configuration/Configuration.tsx b/frontend/src/Components/Configuration/Configuration.tsx index cdd031e54..5b16c7391 100644 --- a/frontend/src/Components/Configuration/Configuration.tsx +++ b/frontend/src/Components/Configuration/Configuration.tsx @@ -5,7 +5,6 @@ import CardContent from "@material-ui/core/CardContent"; import Grid from "@material-ui/core/Grid"; import Typography from "@material-ui/core/Typography"; -import { HomeAssistantEntityProps } from "../HomeAssistant/HomeAssistant"; import { sections, ConfigProps, ConfigSection } from "./Config"; import Section from "./Section"; @@ -27,7 +26,7 @@ const useStyles = makeStyles((theme: Theme) => ({ }, })); -interface ConfigurationBaseProps extends ConfigProps, HomeAssistantEntityProps { +interface ConfigurationBaseProps extends ConfigProps { handleBackupConfig: () => void; handleRestoreConfig: () => void; } diff --git a/frontend/src/Components/Configuration/Item.tsx b/frontend/src/Components/Configuration/Item.tsx index 95c1bb4fb..3befc776b 100644 --- a/frontend/src/Components/Configuration/Item.tsx +++ b/frontend/src/Components/Configuration/Item.tsx @@ -24,7 +24,6 @@ import Visibility from "@material-ui/icons/Visibility"; import VisibilityOff from "@material-ui/icons/VisibilityOff"; import { ConfigurationProps } from "./Configuration"; -import { HomeAssistantEntityProps } from "../HomeAssistant/HomeAssistant"; import { ConfigSectionItem } from "./Config"; import clone from "../../utils/clone"; import ColorAdornment from "../Utils/ColorAdornment"; @@ -61,7 +60,7 @@ const useStyles = makeStyles((theme: Theme) => ({ }, })); -interface ItemProps extends ConfigurationProps, HomeAssistantEntityProps { +interface ItemProps extends ConfigurationProps { item: ConfigSectionItem; } diff --git a/frontend/src/Components/Configuration/Section.tsx b/frontend/src/Components/Configuration/Section.tsx index 2ef438cf8..46346f35c 100644 --- a/frontend/src/Components/Configuration/Section.tsx +++ b/frontend/src/Components/Configuration/Section.tsx @@ -6,7 +6,6 @@ import Typography from "@material-ui/core/Typography"; import ReactMarkdown from "react-markdown"; import { ConfigurationProps } from "./Configuration"; -import { HomeAssistantEntityProps } from "../HomeAssistant/HomeAssistant"; import Item from "./Item"; import { ConfigSectionItem } from "./Config"; @@ -28,9 +27,7 @@ const useStyles = makeStyles((theme: Theme) => ({ }, })); -interface SectionProps extends ConfigurationProps, HomeAssistantEntityProps {} - -function Section(props: SectionProps): ReactElement { +function Section(props: ConfigurationProps): ReactElement { const classes = useStyles(); return ( diff --git a/frontend/src/Components/Main.tsx b/frontend/src/Components/Main.tsx index 6aa0ae44e..7d8ad835b 100644 --- a/frontend/src/Components/Main.tsx +++ b/frontend/src/Components/Main.tsx @@ -78,13 +78,13 @@ function Main(props: MainProps): ReactElement { }, []); useEffect(() => { - if (hassConnection === -2) { - const haUrl = localStorage.getItem("hass_url"); - if (haUrl) { - setHassUrl(haUrl); - setHassConnection(-1); - } - } + // if (hassConnection === -2) { + // const haUrl = localStorage.getItem("hass_url"); + // if (haUrl) { + // setHassUrl(haUrl); + // setHassConnection(-1); + // } + // } }, [hassConnection]); function handleUpdateConfig(path: (string | number)[], data?: unknown): void { @@ -246,16 +246,10 @@ function Main(props: MainProps): ReactElement { setEntities={setHassEntities} /> )} - {props.currentPage === "Configuration" && - hassAuth && - hassConfig && - hassEntities ? ( + {props.currentPage === "Configuration" ? (