Fix all ESLint errors
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
2025-03-28 12:25:04 +01:00
parent 3bf8859ff9
commit f5202f596d
21 changed files with 74 additions and 44 deletions

View File

@ -19,7 +19,7 @@ export function AsyncWidget(p: {
}): React.ReactElement {
const [state, setState] = useState(State.Loading);
const counter = useRef<any | null>(null);
const counter = useRef<any>(null);
const load = async () => {
try {

View File

@ -31,9 +31,11 @@ export function ConfigImportExportButtons(p: {
fileEl.click();
// Wait for a file to be chosen
await new Promise((res, _rej) =>
{ fileEl.addEventListener("change", () => { res(null); }); }
);
await new Promise((res) => {
fileEl.addEventListener("change", () => {
res(null);
});
});
if ((fileEl.files?.length ?? 0) === 0) return null;

View File

@ -23,7 +23,7 @@ export function StateActionButton<S>(p: {
p.onExecuted();
} catch (e) {
console.error(e);
alert("Failed to perform action! " + e);
alert(`Failed to perform action! ${e}`);
}
};

View File

@ -1,3 +1,4 @@
/* eslint-disable react-x/no-array-index-key */
import { Box, Tab, Tabs } from "@mui/material";
export interface TabWidgetOption<E> {
@ -24,7 +25,9 @@ export function TabsWidget<E>(p: {
<Box sx={{ borderBottom: 1, borderColor: "divider" }}>
<Tabs
value={currTabIndex}
onChange={(_ev, newVal) => { updateActiveTab(newVal); }}
onChange={(_ev, newVal) => {
updateActiveTab(newVal);
}}
>
{activeOptions.map((o, index) => (
<Tab key={index} label={o.label} style={{ color: o.color }} />

View File

@ -1,3 +1,4 @@
/* eslint-disable @typescript-eslint/prefer-nullish-coalescing */
import { Paper, Typography } from "@mui/material";
import React, { PropsWithChildren } from "react";
import Grid from "@mui/material/Grid";

View File

@ -1,3 +1,4 @@
/* eslint-disable @typescript-eslint/no-unnecessary-condition */
import React from "react";
import { TextInput } from "./TextInput";
@ -32,7 +33,7 @@ export function IPInputWithMask(p: {
const currValue =
p.ipAndMask ??
(p.ip ?? "") + (p.mask || showSlash.current ? "/" : "") + (p.mask ?? "");
`${p.ip ?? ""}${p.mask || showSlash.current ? "/" : ""}${p.mask ?? ""}`;
const { onValueChange, ...props } = p;
return (

View File

@ -1,3 +1,5 @@
/* eslint-disable react-x/no-array-index-key */
/* eslint-disable react-hooks/exhaustive-deps */
import React from "react";
import { useNavigate } from "react-router-dom";
import { NWFilter, NWFilterURL } from "../../api/NWFilterApi";

View File

@ -25,9 +25,7 @@ export function NWFilterSelectInput(p: {
value={selectedValue}
onDelete={p.editable ? () => p.onChange?.(undefined) : undefined}
onClick={
!p.editable && selectedValue
? () => navigate(NWFilterURL(selectedValue))
: undefined
!p.editable ? () => navigate(NWFilterURL(selectedValue)) : undefined
}
/>
);
@ -48,7 +46,7 @@ export function NWFilterSelectInput(p: {
renderInput={(params) => (
<TextField {...params} variant="standard" label={p.label} />
)}
renderOption={(_props, option, _state) => (
renderOption={(_props, option) => (
<NWFilterItem
dense
onClick={() => {

View File

@ -24,10 +24,13 @@ export function RadioGroupInput(p: {
<RadioGroup
row
value={p.value}
onChange={(_ev, v) => { p.onValueChange(v); }}
onChange={(_ev, v) => {
p.onValueChange(v);
}}
>
{p.options.map((o) => (
<FormControlLabel
key={o.value}
disabled={!p.editable}
value={o.value}
control={<Radio />}

View File

@ -1,3 +1,4 @@
/* eslint-disable react-x/no-array-index-key */
import { mdiNetworkOutline } from "@mdi/js";
import Icon from "@mdi/react";
import DeleteIcon from "@mui/icons-material/Delete";
@ -51,7 +52,6 @@ export function VMNetworksList(p: {
{p.vm.networks.map((n, num) => (
<EditSection key={num}>
<NetworkInfoWidget
key={num}
network={n}
removeFromList={() => {
p.vm.networks.splice(num, 1);