updates eslint config, fixes linting errors

This commit is contained in:
Mose Müller
2024-07-08 08:30:55 +02:00
parent a2ee8d02d6
commit fb251649a0
27 changed files with 1739 additions and 161 deletions

View File

@ -4,7 +4,7 @@ import { Form, Button, InputGroup, Spinner } from "react-bootstrap";
import { DocStringComponent } from "./DocStringComponent";
import { LevelName } from "./NotificationsComponent";
type AsyncMethodProps = {
interface AsyncMethodProps {
fullAccessPath: string;
value: "RUNNING" | null;
docString: string | null;
@ -13,7 +13,7 @@ type AsyncMethodProps = {
displayName: string;
id: string;
render: boolean;
};
}
export const AsyncMethodComponent = React.memo((props: AsyncMethodProps) => {
const {

View File

@ -4,7 +4,7 @@ import { DocStringComponent } from "./DocStringComponent";
import { LevelName } from "./NotificationsComponent";
import { SerializedObject } from "../types/SerializedObject";
type ButtonComponentProps = {
interface ButtonComponentProps {
fullAccessPath: string;
value: boolean;
readOnly: boolean;
@ -14,7 +14,7 @@ type ButtonComponentProps = {
changeCallback?: (value: SerializedObject, callback?: (ack: unknown) => void) => void;
displayName: string;
id: string;
};
}
export const ButtonComponent = React.memo((props: ButtonComponentProps) => {
const {

View File

@ -1,9 +1,9 @@
import React, { useEffect, useState } from "react";
import { Toast, Button, ToastContainer } from "react-bootstrap";
type ConnectionToastProps = {
interface ConnectionToastProps {
connectionStatus: string;
};
}
/**
* ConnectionToast Component

View File

@ -6,13 +6,13 @@ import { GenericComponent } from "./GenericComponent";
import { LevelName } from "./NotificationsComponent";
import { SerializedObject } from "../types/SerializedObject";
type DataServiceProps = {
interface DataServiceProps {
props: DataServiceJSON;
isInstantUpdate: boolean;
addNotification: (message: string, levelname?: LevelName) => void;
displayName: string;
id: string;
};
}
export type DataServiceJSON = Record<string, SerializedObject>;

View File

@ -3,14 +3,14 @@ import { LevelName } from "./NotificationsComponent";
import { DataServiceComponent, DataServiceJSON } from "./DataServiceComponent";
import { MethodComponent } from "./MethodComponent";
type DeviceConnectionProps = {
interface DeviceConnectionProps {
fullAccessPath: string;
props: DataServiceJSON;
isInstantUpdate: boolean;
addNotification: (message: string, levelname?: LevelName) => void;
displayName: string;
id: string;
};
}
export const DeviceConnectionComponent = React.memo(
({

View File

@ -4,13 +4,13 @@ import { GenericComponent } from "./GenericComponent";
import { LevelName } from "./NotificationsComponent";
import { SerializedObject } from "../types/SerializedObject";
type DictComponentProps = {
interface DictComponentProps {
value: Record<string, SerializedObject>;
docString: string | null;
isInstantUpdate: boolean;
addNotification: (message: string, levelname?: LevelName) => void;
id: string;
};
}
export const DictComponent = React.memo((props: DictComponentProps) => {
const { value, docString, isInstantUpdate, addNotification, id } = props;

View File

@ -1,9 +1,9 @@
import { Badge, Tooltip, OverlayTrigger } from "react-bootstrap";
import React from "react";
type DocStringProps = {
interface DocStringProps {
docString?: string | null;
};
}
export const DocStringComponent = React.memo((props: DocStringProps) => {
const { docString } = props;

View File

@ -4,7 +4,7 @@ import { DocStringComponent } from "./DocStringComponent";
import { LevelName } from "./NotificationsComponent";
import { SerializedObject } from "../types/SerializedObject";
export type EnumSerialization = {
export interface EnumSerialization {
type: "Enum" | "ColouredEnum";
full_access_path: string;
name: string;
@ -12,15 +12,15 @@ export type EnumSerialization = {
readonly: boolean;
doc: string | null;
enum: Record<string, string>;
};
}
type EnumComponentProps = {
interface EnumComponentProps {
attribute: EnumSerialization;
addNotification: (message: string, levelname?: LevelName) => void;
displayName: string;
id: string;
changeCallback?: (value: SerializedObject, callback?: (ack: unknown) => void) => void;
};
}
export const EnumComponent = React.memo((props: EnumComponentProps) => {
const { attribute, addNotification, displayName, id } = props;

View File

@ -18,11 +18,11 @@ import { DictComponent } from "./DictComponent";
import { parseFullAccessPath } from "../utils/stateUtils";
import { SerializedObject } from "../types/SerializedObject";
type GenericComponentProps = {
interface GenericComponentProps {
attribute: SerializedObject;
isInstantUpdate: boolean;
addNotification: (message: string, levelname?: LevelName) => void;
};
}
const getPathFromPathParts = (pathParts: string[]): string => {
let path = "";

View File

@ -4,7 +4,7 @@ import { DocStringComponent } from "./DocStringComponent";
import { ChevronDown, ChevronRight } from "react-bootstrap-icons";
import { LevelName } from "./NotificationsComponent";
type ImageComponentProps = {
interface ImageComponentProps {
fullAccessPath: string;
value: string;
docString: string | null;
@ -12,7 +12,7 @@ type ImageComponentProps = {
addNotification: (message: string, levelname?: LevelName) => void;
displayName: string;
id: string;
};
}
export const ImageComponent = React.memo((props: ImageComponentProps) => {
const { fullAccessPath, value, docString, format, addNotification, displayName, id } =

View File

@ -4,13 +4,13 @@ import { GenericComponent } from "./GenericComponent";
import { LevelName } from "./NotificationsComponent";
import { SerializedObject } from "../types/SerializedObject";
type ListComponentProps = {
interface ListComponentProps {
value: SerializedObject[];
docString: string | null;
isInstantUpdate: boolean;
addNotification: (message: string, levelname?: LevelName) => void;
id: string;
};
}
export const ListComponent = React.memo((props: ListComponentProps) => {
const { value, docString, isInstantUpdate, addNotification, id } = props;

View File

@ -4,14 +4,14 @@ import { Button, Form } from "react-bootstrap";
import { DocStringComponent } from "./DocStringComponent";
import { LevelName } from "./NotificationsComponent";
type MethodProps = {
interface MethodProps {
fullAccessPath: string;
docString: string | null;
addNotification: (message: string, levelname?: LevelName) => void;
displayName: string;
id: string;
render: boolean;
};
}
export const MethodComponent = React.memo((props: MethodProps) => {
const { fullAccessPath, docString, addNotification, displayName, id } = props;

View File

@ -2,18 +2,18 @@ import React from "react";
import { ToastContainer, Toast } from "react-bootstrap";
export type LevelName = "CRITICAL" | "ERROR" | "WARNING" | "INFO" | "DEBUG";
export type Notification = {
export interface Notification {
id: number;
timeStamp: string;
message: string;
levelname: LevelName;
};
}
type NotificationProps = {
interface NotificationProps {
showNotification: boolean;
notifications: Notification[];
removeNotificationById: (id: number) => void;
};
}
export const Notifications = React.memo((props: NotificationProps) => {
const { showNotification, notifications, removeNotificationById } = props;

View File

@ -8,27 +8,27 @@ import { QuantityMap } from "../types/QuantityMap";
// TODO: add button functionality
export type QuantityObject = {
export interface QuantityObject {
type: "Quantity";
readonly: boolean;
value: QuantityMap;
doc: string | null;
};
export type IntObject = {
}
export interface IntObject {
type: "int";
readonly: boolean;
value: number;
doc: string | null;
};
export type FloatObject = {
}
export interface FloatObject {
type: "float";
readonly: boolean;
value: number;
doc: string | null;
};
}
export type NumberObject = IntObject | FloatObject | QuantityObject;
type NumberComponentProps = {
interface NumberComponentProps {
type: "float" | "int" | "Quantity";
fullAccessPath: string;
value: number;
@ -40,7 +40,7 @@ type NumberComponentProps = {
changeCallback?: (value: SerializedObject, callback?: (ack: unknown) => void) => void;
displayName?: string;
id: string;
};
}
// TODO: highlight the digit that is being changed by setting both selectionStart and
// selectionEnd

View File

@ -7,7 +7,7 @@ import { LevelName } from "./NotificationsComponent";
import { SerializedObject } from "../types/SerializedObject";
import { QuantityMap } from "../types/QuantityMap";
type SliderComponentProps = {
interface SliderComponentProps {
fullAccessPath: string;
min: NumberObject;
max: NumberObject;
@ -20,7 +20,7 @@ type SliderComponentProps = {
changeCallback?: (value: SerializedObject, callback?: (ack: unknown) => void) => void;
displayName: string;
id: string;
};
}
export const SliderComponent = React.memo((props: SliderComponentProps) => {
const renderCount = useRef(0);
@ -122,7 +122,7 @@ export const SliderComponent = React.memo((props: SliderComponentProps) => {
const deconstructNumberDict = (
numberDict: NumberObject,
): [number, boolean, string | undefined] => {
let numberMagnitude: number = 0;
let numberMagnitude = 0;
let numberUnit: string | undefined = undefined;
const numberReadOnly = numberDict.readonly;

View File

@ -7,7 +7,7 @@ import { SerializedObject } from "../types/SerializedObject";
// TODO: add button functionality
type StringComponentProps = {
interface StringComponentProps {
fullAccessPath: string;
value: string;
readOnly: boolean;
@ -17,7 +17,7 @@ type StringComponentProps = {
changeCallback?: (value: SerializedObject, callback?: (ack: unknown) => void) => void;
displayName: string;
id: string;
};
}
export const StringComponent = React.memo((props: StringComponentProps) => {
const {