From 43a33c3ab3e742ee67f54dff9c64334c28d5869e Mon Sep 17 00:00:00 2001 From: uwap Date: Mon, 5 Oct 2020 22:02:30 +0200 Subject: [PATCH] Fix minor eslint warnings --- config/rzl/index.js | 2 +- src/components/UiItems/base.js | 6 +++--- src/components/UiItems/index.js | 3 ++- src/config/icon.js | 3 +-- src/config/types.js | 2 +- src/connectMqtt.js | 2 +- src/mqtt/context.js | 4 ++-- 7 files changed, 11 insertions(+), 11 deletions(-) diff --git a/config/rzl/index.js b/config/rzl/index.js index ef8f322..f084566 100644 --- a/config/rzl/index.js +++ b/config/rzl/index.js @@ -633,7 +633,7 @@ const config: Config = { position: [1413, 500], icon: mdi("pool"), iconColor: ({whirlpoolBubbles}) => - (parseInt(whirlpoolBubbles) > 0 ? hex("#00ff00") : hex("#000000")), + (parseInt(whirlpoolBubbles, 10) > 0 ? hex("#00ff00") : hex("#000000")), ui: [ { type: "text", diff --git a/src/components/UiItems/base.js b/src/components/UiItems/base.js index dd359a6..2b7a5b9 100644 --- a/src/components/UiItems/base.js +++ b/src/components/UiItems/base.js @@ -11,9 +11,9 @@ import { renderRawIcon } from "config/icon"; import type { Icon } from "config/icon"; export type Helpers = { - Icon: (props: Object) => React.Node, - Label: (props: Object) => React.Node, - Action: (props: Object) => React.Node + Icon: (props: { item: { +icon?: Icon }, state: State }) => React.Node, + Label: (props: {}) => React.Node, + Action: (props: {}) => React.Node }; export type BaseComponent = ( diff --git a/src/components/UiItems/index.js b/src/components/UiItems/index.js index 8c8e44f..875fd60 100644 --- a/src/components/UiItems/index.js +++ b/src/components/UiItems/index.js @@ -6,10 +6,11 @@ import Link from "./Link"; import Slider from "./Slider"; import Text from "./Text"; import Progress from "./Progress"; +import * as React from "react"; import type { ControlUI } from "config/flowtypes"; -const Control = ({item}: {item: ControlUI}) => { +const Control = ({item}: {item: ControlUI}): React.Node => { switch (item.type) { case "toggle": { return Toggle.component(item); diff --git a/src/config/icon.js b/src/config/icon.js index a8a44b1..6844980 100644 --- a/src/config/icon.js +++ b/src/config/icon.js @@ -35,9 +35,8 @@ export const mdiBattery = (topic: string) => (state: State) => { return rawMdi("battery-30"); } else if (val > 15) { return rawMdi("battery-20"); - } else { - return rawMdi("battery-10"); } + return rawMdi("battery-10"); }; export const renderRawIcon = diff --git a/src/config/types.js b/src/config/types.js index 6867807..478108d 100644 --- a/src/config/types.js +++ b/src/config/types.js @@ -17,7 +17,7 @@ export const option = (values: TypeOptionParam): TopicType => { return values.otherwise; } else { throw new Error( - `Value ${x.toString()} cannot by mapped by the option parameters given` + `Value ${x.toString()} cannot be mapped by the option parameters given` ); } }; diff --git a/src/connectMqtt.js b/src/connectMqtt.js index 0085f28..ee1af34 100644 --- a/src/connectMqtt.js +++ b/src/connectMqtt.js @@ -49,7 +49,7 @@ export default function connectMqtt( } }); return (topic: string, message: Buffer) => { - client.publish(topic, message, null, (error) => { + client.publish(topic, message, {}, (error) => { if (error == null && settings.onMessageSent != null) { settings.onMessageSent(topic, message); } diff --git a/src/mqtt/context.js b/src/mqtt/context.js index bb14c9c..1f47c9f 100644 --- a/src/mqtt/context.js +++ b/src/mqtt/context.js @@ -3,10 +3,10 @@ import React from "react"; export type MqttContextValue = { state: State, - changeState: (topic: string, value: string) => void + changeState: (topic: string, value: string) => State }; export default React.createContext({ state: {}, - changeState: (_topic, _val) => {} + changeState: (_topic, _val) => ({}) });