WIP ESLint fixes

This commit is contained in:
2025-03-28 11:35:51 +01:00
parent 4b9df95721
commit 9a905e83f7
40 changed files with 92 additions and 91 deletions

View File

@ -17,7 +17,7 @@ export function CheckboxInput(p: {
<Checkbox
disabled={!p.editable}
checked={p.checked}
onChange={(e) => p.onValueChange(e.target.checked)}
onChange={(e) => { p.onValueChange(e.target.checked); }}
/>
}
label={p.label}

View File

@ -44,7 +44,7 @@ export function IPInputWithMask(p: {
return;
}
const split = v?.split("/");
const split = v.split("/");
const ip =
p.version === 4 ? sanitizeIpV4(split[0]) : sanitizeIpV6(split[0]);
let mask = undefined;
@ -69,7 +69,7 @@ export function IPInputWithMask(p: {
function sanitizeIpV4(s: string | undefined): string | undefined {
if (s === "" || s === undefined) return s;
let split = s.split(".");
const split = s.split(".");
if (split.length > 4) split.splice(4);
let needAnotherIteration = false;
@ -106,7 +106,7 @@ function sanitizeIpV6(s: string | undefined): string | undefined {
const num = parseInt(e, 16);
if (isNaN(num)) return "0";
let s = num.toString(16);
const s = num.toString(16);
if (num > 0xffff) {
needAnotherIteration = true;
return s.slice(0, 4) + ":" + s.slice(4);

View File

@ -32,7 +32,7 @@ function sanitizeMacAddress(s: string | undefined): string | undefined {
const num = parseInt(e, 16);
if (isNaN(num)) return "0";
let s = num.toString(16).padStart(2, "0");
const s = num.toString(16).padStart(2, "0");
if (num > 0xff) {
needAnotherIteration = true;
return s.slice(0, 2) + ":" + s.slice(2);

View File

@ -12,7 +12,7 @@ export function NWFConnStateInput(p: {
label="Connection state"
value={p.value}
onValueChange={(s) => {
p.onChange?.(s as any);
p.onChange(s as any);
}}
options={[
{ label: "None", value: undefined },

View File

@ -13,7 +13,7 @@ export function NWFilterPriorityInput(p: {
value={p.value?.toString()}
type="number"
onValueChange={(v) => {
p.onChange?.(v && v !== "" ? Number(v) : undefined);
p.onChange(v && v !== "" ? Number(v) : undefined);
}}
size={ServerApi.Config.constraints.nwfilter_priority}
helperText="A lower priority value is accessed before one with a higher value"

View File

@ -66,9 +66,9 @@ export function NWFilterRules(p: {
deleteRule(n);
}}
onGoDown={
n < p.rules.length - 1 ? () => swapRules(n, n + 1) : undefined
n < p.rules.length - 1 ? () => { swapRules(n, n + 1); } : undefined
}
onGoUp={n > 0 ? () => swapRules(n, n - 1) : undefined}
onGoUp={n > 0 ? () => { swapRules(n, n - 1); } : undefined}
{...p}
/>
))}
@ -153,7 +153,7 @@ function NWRuleEdit(p: {
editable={p.editable}
onChange={p.onChange}
selector={s}
onDelete={() => deleteSelector(n)}
onDelete={() => { deleteSelector(n); }}
/>
))}
</CardContent>

View File

@ -130,7 +130,7 @@ function HostReservationWidget(p: {
value={p.host.mac}
onValueChange={(v) => {
p.host.mac = v!;
p.onChange?.();
p.onChange();
}}
/>
)}
@ -142,7 +142,7 @@ function HostReservationWidget(p: {
value={p.host.ip}
onValueChange={(v) => {
p.host.ip = v!;
p.onChange?.();
p.onChange();
}}
/>
</div>

View File

@ -12,7 +12,7 @@ export function PortInput(p: {
value={p.value?.toString() ?? ""}
type="number"
onValueChange={(v) => {
p.onChange?.(sanitizePort(v));
p.onChange(sanitizePort(v));
}}
checkValue={(v) => Number(v) <= 65535}
/>

View File

@ -24,7 +24,7 @@ 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

View File

@ -33,7 +33,7 @@ export function SelectInput(p: {
<Select
value={p.value ?? ""}
label={p.label}
onChange={(e) => p.onValueChange(e.target.value)}
onChange={(e) => { p.onValueChange(e.target.value); }}
>
{p.options.map((e) => (
<MenuItem