diff --git a/.eslintrc.json b/.eslintrc.json index 263e4f6..ab2573f 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -28,6 +28,7 @@ "warn", "allman" ], - "indent": "warn" + "indent": "warn", + "semi": "error" } } \ No newline at end of file diff --git a/src/components/InputElements.tsx b/src/components/InputElements.tsx index 0e58ff9..8f961c3 100644 --- a/src/components/InputElements.tsx +++ b/src/components/InputElements.tsx @@ -1,26 +1,26 @@ -import React, { Children, useRef, useState } from "react"; +import React, { useRef, useState } from "react"; import ClickDetector from "../util/ClickDetector"; import { DropdownBaseProps, DropdownItemProps } from "../@types/Components"; import '../css/components/InputElements.css'; -export const FileSelector = ({ cb }: { cb: (file: File) => void }) => +export const FileSelector = ({ cb }: { cb: (file: File) => void }) => { - if (!cb) + if (!cb) throw new Error('Missing callback'); const [file, setFile] = useState(null); - const onDragOver: React.MouseEventHandler = (event) => + const onDragOver: React.MouseEventHandler = (event) => { event.stopPropagation(); event.preventDefault(); }; - const onDrop: React.DragEventHandler = (event) => + const onDrop: React.DragEventHandler = (event) => { event.preventDefault(); const { dataTransfer } = event; - if (!dataTransfer.files.length) + if (!dataTransfer.files.length) return; const [file] = dataTransfer.files; @@ -33,9 +33,9 @@ export const FileSelector = ({ cb }: { cb: (file: File) => void }) => or Click to select a file

{file ? `Selected: ${file.name}` : null}

- + { - if (!event.target.files) + if (!event.target.files) return; const [f] = event.target.files; setFile(f); @@ -53,7 +53,7 @@ export type InputElementProperties = { placeholder?: string } -export const ToggleSwitch = ({ value, onChange, inputRef, children }: InputElementProperties) => +export const ToggleSwitch = ({ value, onChange, inputRef, children }: InputElementProperties) => { return ; }; -export const VerticalToggleSwitch = ({ value, onChange, inputRef, children }: InputElementProperties) => +export const VerticalToggleSwitch = ({ value, onChange, inputRef, children }: InputElementProperties) => { return