diff options
author | Sebastian <sebasjm@gmail.com> | 2022-03-29 09:58:06 -0300 |
---|---|---|
committer | Sebastian <sebasjm@gmail.com> | 2022-03-29 10:04:33 -0300 |
commit | 3dd1047b085fa7795f322c5829f39208465bff13 (patch) | |
tree | 19340ca9420466e7059849dbf7013901733c0fde /packages/taler-wallet-webextension/src/mui/input | |
parent | cb18b9813e5df6e315dfb1827f5f7cf304977390 (diff) | |
download | wallet-core-3dd1047b085fa7795f322c5829f39208465bff13.tar.xz |
added react eslint and fix most of the warns
Diffstat (limited to 'packages/taler-wallet-webextension/src/mui/input')
6 files changed, 20 insertions, 20 deletions
diff --git a/packages/taler-wallet-webextension/src/mui/input/FormControl.tsx b/packages/taler-wallet-webextension/src/mui/input/FormControl.tsx index d4fa0368e..8860ce20d 100644 --- a/packages/taler-wallet-webextension/src/mui/input/FormControl.tsx +++ b/packages/taler-wallet-webextension/src/mui/input/FormControl.tsx @@ -1,5 +1,5 @@ import { css } from "@linaria/core"; -import { ComponentChildren, createContext, h } from "preact"; +import { ComponentChildren, createContext, h, VNode } from "preact"; import { useContext, useState } from "preact/hooks"; // eslint-disable-next-line import/extensions import { Colors } from "../style"; @@ -58,7 +58,7 @@ export function FormControl({ size = "medium", variant = "standard", children, -}: Partial<Props>) { +}: Partial<Props>): VNode { const [filled, setFilled] = useState(false); const [focusedState, setFocused] = useState(false); const focused = @@ -141,7 +141,7 @@ const defaultContextValue: FCCProps = { variant: "outlined", }; -function withoutUndefinedProperties(obj: any) { +function withoutUndefinedProperties(obj: any): any { return Object.keys(obj).reduce((acc, key) => { const _acc: any = acc; if (obj[key] !== undefined) _acc[key] = obj[key]; diff --git a/packages/taler-wallet-webextension/src/mui/input/FormHelperText.tsx b/packages/taler-wallet-webextension/src/mui/input/FormHelperText.tsx index da10eec11..eeb9e52c0 100644 --- a/packages/taler-wallet-webextension/src/mui/input/FormHelperText.tsx +++ b/packages/taler-wallet-webextension/src/mui/input/FormHelperText.tsx @@ -1,5 +1,5 @@ import { css } from "@linaria/core"; -import { ComponentChildren, h } from "preact"; +import { ComponentChildren, h, VNode } from "preact"; // eslint-disable-next-line import/extensions import { theme } from "../style"; import { useFormControl } from "./FormControl.js"; @@ -35,7 +35,7 @@ interface Props { required?: boolean; children: ComponentChildren; } -export function FormHelperText({ children, ...props }: Props) { +export function FormHelperText({ children, ...props }: Props): VNode { const fcs = useFormControl(props); const contained = fcs.variant === "filled" || fcs.variant === "outlined"; return ( diff --git a/packages/taler-wallet-webextension/src/mui/input/FormLabel.tsx b/packages/taler-wallet-webextension/src/mui/input/FormLabel.tsx index fffef41db..3460aacde 100644 --- a/packages/taler-wallet-webextension/src/mui/input/FormLabel.tsx +++ b/packages/taler-wallet-webextension/src/mui/input/FormLabel.tsx @@ -1,5 +1,5 @@ import { css } from "@linaria/core"; -import { ComponentChildren, h } from "preact"; +import { ComponentChildren, h, VNode } from "preact"; // eslint-disable-next-line import/extensions import { Colors, theme } from "../style"; import { useFormControl } from "./FormControl.js"; @@ -41,7 +41,7 @@ export function FormLabel({ class: _class, children, ...rest -}: Props) { +}: Props): VNode { const fcs = useFormControl({ disabled, error, diff --git a/packages/taler-wallet-webextension/src/mui/input/InputBase.tsx b/packages/taler-wallet-webextension/src/mui/input/InputBase.tsx index 331d9ce95..a25366bd2 100644 --- a/packages/taler-wallet-webextension/src/mui/input/InputBase.tsx +++ b/packages/taler-wallet-webextension/src/mui/input/InputBase.tsx @@ -1,5 +1,5 @@ import { css } from "@linaria/core"; -import { h, JSX } from "preact"; +import { h, JSX, VNode } from "preact"; import { useLayoutEffect } from "preact/hooks"; // eslint-disable-next-line import/extensions import { theme } from "../style"; @@ -33,7 +33,7 @@ export function InputBaseRoot({ focused, fullWidth, children, -}: any) { +}: any): VNode { const fcs = useFormControl({}); return ( <div @@ -129,7 +129,7 @@ export function InputBaseComponent({ multiline, type, ...props -}: any) { +}: any): VNode { return ( <input disabled={disabled} @@ -160,7 +160,7 @@ export function InputBase({ value, onClick, ...props -}: any) { +}: any): VNode { const fcs = useFormControl(props); // const [focused, setFocused] = useState(false); useLayoutEffect(() => { @@ -171,7 +171,7 @@ export function InputBase({ } }, [value]); - const handleFocus = (event: JSX.TargetedFocusEvent<EventTarget>) => { + const handleFocus = (event: JSX.TargetedFocusEvent<EventTarget>): void => { // Fix a bug with IE11 where the focus/blur events are triggered // while the component is disabled. if (fcs.disabled) { @@ -189,7 +189,7 @@ export function InputBase({ fcs.onFocus(); }; - const handleBlur = () => { + const handleBlur = (): void => { // if (onBlur) { // onBlur(event); // } @@ -202,7 +202,7 @@ export function InputBase({ const handleChange = ( event: JSX.TargetedEvent<HTMLElement & { value?: string }>, - ) => { + ): void => { // if (inputPropsProp.onChange) { // inputPropsProp.onChange(event, ...args); // } @@ -215,7 +215,7 @@ export function InputBase({ const handleClick = ( event: JSX.TargetedMouseEvent<HTMLElement & { value?: string }>, - ) => { + ): void => { // if (inputRef.current && event.currentTarget === event.target) { // inputRef.current.focus(); // } @@ -254,6 +254,6 @@ export function InputBase({ ); } -export function TextareaAutoSize() { +export function TextareaAutoSize(): VNode { return <input onClick={(e) => null} />; } diff --git a/packages/taler-wallet-webextension/src/mui/input/InputLabel.tsx b/packages/taler-wallet-webextension/src/mui/input/InputLabel.tsx index 6d6aae4f3..4b51915e1 100644 --- a/packages/taler-wallet-webextension/src/mui/input/InputLabel.tsx +++ b/packages/taler-wallet-webextension/src/mui/input/InputLabel.tsx @@ -1,5 +1,5 @@ import { css } from "@linaria/core"; -import { ComponentChildren, h } from "preact"; +import { ComponentChildren, h, VNode } from "preact"; // eslint-disable-next-line import/extensions import { Colors, theme } from "../style"; import { useFormControl } from "./FormControl.js"; @@ -83,7 +83,7 @@ interface InputLabelProps { variant: "filled" | "outlined" | "standard"; children: ComponentChildren; } -export function InputLabel(props: Partial<InputLabelProps>) { +export function InputLabel(props: Partial<InputLabelProps>): VNode { const fcs = useFormControl(props); return ( <FormLabel diff --git a/packages/taler-wallet-webextension/src/mui/input/InputStandard.tsx b/packages/taler-wallet-webextension/src/mui/input/InputStandard.tsx index 9d79a7019..3eacd7984 100644 --- a/packages/taler-wallet-webextension/src/mui/input/InputStandard.tsx +++ b/packages/taler-wallet-webextension/src/mui/input/InputStandard.tsx @@ -107,7 +107,7 @@ const underlineStyle = css` } `; -function Root({ disabled, focused, error, children }: any) { +function Root({ disabled, focused, error, children }: any): VNode { return ( <InputBaseRoot disabled={disabled} @@ -120,6 +120,6 @@ function Root({ disabled, focused, error, children }: any) { ); } -function Input(props: any) { +function Input(props: any): VNode { return <InputBaseComponent {...props} />; } |