Fix most eslint warnings

This commit is contained in:
uwap 2018-01-19 21:52:53 +01:00
parent 196aa44895
commit 8d2d39cb0e
6 changed files with 16 additions and 12 deletions

View file

@ -25,7 +25,7 @@ export type AppState = {
selectedControl: ?Control,
drawerOpened: boolean,
mqttState: State,
mqttSend: (topic: string, value: any) => void,
mqttSend: (topic: string, value: Actual) => void,
mqttConnected: boolean,
};
@ -91,7 +91,7 @@ class App extends React.Component<AppProps & Classes, AppState> {
this.setState({drawerOpened: false});
}
changeState(topic: string, value: any) {
changeState(topic: string, value: Actual) {
const rawTopic = this.props.config.topics[topic].command;
if (rawTopic == null) {
return;

View file

@ -18,9 +18,10 @@ import keyOf from "utils/keyOf";
type UiItemProps<I> = {
item: I,
state: State,
onChangeState: (topic: string, nextState: any) => void
onChangeState: (topic: string, nextState: Actual) => void
};
// eslint-disable-next-line flowtype/no-weak-types
export default class UiItem<I:Object> extends React.Component<UiItemProps<I>> {
constructor(props: UiItemProps<I>) {
super(props);
@ -58,7 +59,7 @@ export class UiControl<I: UIControl> extends UiItem<I> {
super(props);
}
changeState(next: any) {
changeState(next: Actual) {
if (this.props.item.topic == null) {
throw new Error(
`Missing topic in ${this.props.item.type} "${this.props.item.text}"`
@ -131,7 +132,7 @@ export class Toggle extends UiControl<UIToggle> {
}
export class DropDown extends UiControl<UIDropDown> {
runPrimaryAction = (next?: any) => {
runPrimaryAction = (next?: Actual) => {
if (this.isEnabled()) {
const control = this.props.item;
const keys = _.keys(control.options);

View file

@ -18,7 +18,7 @@ import { Toggle, DropDown, Link, Section, Text } from "./UiItem";
export type UiItemListProps = {
controls: Array<ControlUI>,
state: State,
onChangeState: (topic: string, nextState: any) => void
onChangeState: (topic: string, nextState: Actual) => void
};
export default class UiItemList extends React.Component<UiItemListProps> {