Skip to content

Commit

Permalink
fixed frontend eslint errors
Browse files Browse the repository at this point in the history
  • Loading branch information
bigabig committed Oct 15, 2024
1 parent e642dd2 commit f1f3f0e
Show file tree
Hide file tree
Showing 9 changed files with 17 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@ export const isValidHttpUrl = (string: string) => {

try {
url = new URL(string);
} catch (_) {
} catch (e) {
console.error(e);
return false;
}

Expand Down
6 changes: 3 additions & 3 deletions frontend/src/views/analysis/ConceptsOverTime/CotaView.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { CircularProgress, Portal, Typography } from "@mui/material";
import { useContext } from "react";
import { useParams } from "react-router-dom";
import CotaHooks from "../../../api/CotaHooks";
import { AppBarContext } from "../../../layouts/TwoBarLayout";
import CotaViewContent from "./CotaViewContent";
import CotaHooks from "../../../api/CotaHooks.ts";
import { AppBarContext } from "../../../layouts/TwoBarLayout.tsx";
import CotaViewContent from "./CotaViewContent.tsx";

function CotaView() {
// global client state
Expand Down
4 changes: 1 addition & 3 deletions frontend/src/views/annotation/DocumentRenderer/ImageMenu.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,13 @@ import { useOpenSnackbar } from "../../../components/SnackbarDialog/useOpenSnack
import { useAppDispatch } from "../../../plugins/ReduxHooks.ts";
import { ImageSearchActions } from "../../search/ImageSearch/imageSearchSlice.ts";

interface ImageMenuProps {}

export interface ImageMenuHandle {
open: (position: PopoverPosition, image: number | null | undefined) => void;
close: () => void;
}

// eslint-disable-next-line no-empty-pattern
const ImageMenu = forwardRef<ImageMenuHandle, ImageMenuProps>(({}, ref) => {
const ImageMenu = forwardRef<ImageMenuHandle>((_, ref) => {
const navigate = useNavigate();

// local state
Expand Down
2 changes: 2 additions & 0 deletions frontend/src/views/tools/AutoLogbook/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ export const action2TargetTitle = (action: ActionRead): string | null | undefine
return undefined;
}
} catch (e) {
console.error(e);
return undefined;
}
};
Expand All @@ -94,6 +95,7 @@ export const parseActionState = (input: string | null | undefined | null) => {
try {
return JSON.parse(input);
} catch (e) {
console.error(e);
throw new Error("Could not parse state as JSON (json is invalid)!");
}
};
Expand Down
4 changes: 1 addition & 3 deletions frontend/src/views/whiteboard/toolbar/EdgeEditMenu.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,6 @@ import SliderTool from "./tools/SliderTool.tsx";
import SolidDashedDottedTool from "./tools/SolidDashedDottedTool.tsx";
import TypographyVariantTool from "./tools/TypographyVariantTool.tsx";

interface EdgeEditMenuProps {}

const arrow2icon: Record<string, React.ReactElement> = {
noarrow: <HorizontalRuleIcon />,
arrow: <KeyboardArrowRightIcon />,
Expand All @@ -55,7 +53,7 @@ export interface EdgeEditMenuHandle {
close: () => void;
}

const EdgeEditMenu = forwardRef<EdgeEditMenuHandle, EdgeEditMenuProps>((_, ref) => {
const EdgeEditMenu = forwardRef<EdgeEditMenuHandle>((_, ref) => {
const reactFlowInstance = useReactFlow<DATSNodeData, CustomEdgeData>();
const [edges, setEdges] = useState<Edge<CustomEdgeData>[]>([]);

Expand Down
4 changes: 1 addition & 3 deletions frontend/src/views/whiteboard/toolbar/NodeEditMenu.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,12 @@ import SliderTool from "./tools/SliderTool.tsx";
import SolidDashedDottedTool from "./tools/SolidDashedDottedTool.tsx";
import TypographyVariantTool from "./tools/TypographyVariantTool.tsx";

interface NodeEditMenuProps {}

export interface NodeEditMenuHandle {
open: (nodes: Node[]) => void;
close: () => void;
}

const NodeEditMenu = forwardRef<NodeEditMenuHandle, NodeEditMenuProps>((_, ref) => {
const NodeEditMenu = forwardRef<NodeEditMenuHandle>((_, ref) => {
const reactFlowInstance = useReactFlow<BackgroundColorData | TextData | BorderData>();
const [nodes, setNodes] = useState<Node<BackgroundColorData | TextData | BorderData>[]>([]);

Expand Down
4 changes: 3 additions & 1 deletion frontend/src/views/whiteboard/toolbar/tools/ColorTool.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,9 @@ interface ColorToolProps {
function ColorTool({ caption, color, onColorChange }: ColorToolProps) {
let timeout: NodeJS.Timeout | undefined;
const handleColorChange: React.ChangeEventHandler<HTMLInputElement> = (event) => {
timeout && clearTimeout(timeout);
if (timeout) {
clearTimeout(timeout);
}
timeout = setTimeout(() => {
const color = event.target.value;
onColorChange(color);
Expand Down
4 changes: 3 additions & 1 deletion frontend/src/views/whiteboard/toolbar/tools/NumberTool.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,9 @@ interface NumberToolProps {
function NumberTool({ value, onValueChange, min, max }: NumberToolProps) {
let timeout: NodeJS.Timeout | undefined;
const handleStrokeWidthChange: React.ChangeEventHandler<HTMLInputElement> = (event) => {
timeout && clearTimeout(timeout);
if (timeout) {
clearTimeout(timeout);
}
timeout = setTimeout(() => {
onValueChange(parseInt(event.target.value));
}, 333);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
import { TextData } from "../base/TextData.ts";

export interface TextNodeData extends TextData {}
export type TextNodeData = TextData;

0 comments on commit f1f3f0e

Please sign in to comment.