diff --git a/virtweb_frontend/eslint.config.js b/virtweb_frontend/eslint.config.js
index cf66efa..1fd4d8a 100644
--- a/virtweb_frontend/eslint.config.js
+++ b/virtweb_frontend/eslint.config.js
@@ -38,6 +38,7 @@ export default tseslint.config(
],
...reactX.configs["recommended-typescript"].rules,
...reactDom.configs.recommended.rules,
+ "@typescript-eslint/no-non-null-assertion": "off"
},
}
);
diff --git a/virtweb_frontend/src/App.tsx b/virtweb_frontend/src/App.tsx
index 8e7cd81..1873c3c 100644
--- a/virtweb_frontend/src/App.tsx
+++ b/virtweb_frontend/src/App.tsx
@@ -51,7 +51,7 @@ export function App() {
const context: AuthContext = {
signedIn: signedIn,
- setSignedIn: (s) => setSignedIn(s),
+ setSignedIn: (s) => { setSignedIn(s); },
};
const router = createBrowserRouter(
@@ -97,12 +97,12 @@ export function App() {
);
return (
-
+
-
+
);
}
export function useAuth(): AuthContext {
- return React.useContext(AuthContextK)!;
+ return React.use(AuthContextK)!;
}
diff --git a/virtweb_frontend/src/api/ApiClient.ts b/virtweb_frontend/src/api/ApiClient.ts
index 177ac86..49df36b 100644
--- a/virtweb_frontend/src/api/ApiClient.ts
+++ b/virtweb_frontend/src/api/ApiClient.ts
@@ -44,7 +44,7 @@ export class APIClient {
*/
static async exec(args: RequestParams): Promise {
let body: string | undefined | FormData = undefined;
- let headers: any = {};
+ const headers: any = {};
// JSON request
if (args.jsonData) {
@@ -67,17 +67,17 @@ export class APIClient {
const res: XMLHttpRequest = await new Promise((resolve, reject) => {
const xhr = new XMLHttpRequest();
xhr.upload.addEventListener("progress", (e) =>
- args.upProgress!(e.loaded / e.total)
+ { args.upProgress!(e.loaded / e.total); }
);
- xhr.addEventListener("load", () => resolve(xhr));
+ xhr.addEventListener("load", () => { resolve(xhr); });
xhr.addEventListener("error", () =>
- reject(new Error("File upload failed"))
+ { reject(new Error("File upload failed")); }
);
xhr.addEventListener("abort", () =>
- reject(new Error("File upload aborted"))
+ { reject(new Error("File upload aborted")); }
);
xhr.addEventListener("timeout", () =>
- reject(new Error("File upload timeout"))
+ { reject(new Error("File upload timeout")); }
);
xhr.open(args.method, url, true);
xhr.withCredentials = true;
diff --git a/virtweb_frontend/src/api/NWFilterApi.ts b/virtweb_frontend/src/api/NWFilterApi.ts
index 220c228..4aa9b04 100644
--- a/virtweb_frontend/src/api/NWFilterApi.ts
+++ b/virtweb_frontend/src/api/NWFilterApi.ts
@@ -140,7 +140,7 @@ export interface NWFilter {
rules: NWFilterRule[];
}
-export function NWFilterURL(n: NWFilter, edit: boolean = false): string {
+export function NWFilterURL(n: NWFilter, edit = false): string {
return `/nwfilter/${n.uuid}${edit ? "/edit" : ""}`;
}
@@ -221,7 +221,7 @@ export class NWFilterApi {
static async Delete(n: NWFilter): Promise {
await APIClient.exec({
method: "DELETE",
- uri: `/nwfilter/${n.uuid}`,
+ uri: `/nwfilter/${n.uuid!}`,
});
}
}
diff --git a/virtweb_frontend/src/api/NetworksApi.ts b/virtweb_frontend/src/api/NetworksApi.ts
index 109e3ff..ace4268 100644
--- a/virtweb_frontend/src/api/NetworksApi.ts
+++ b/virtweb_frontend/src/api/NetworksApi.ts
@@ -53,7 +53,7 @@ export interface NetworkInfo {
export type NetworkStatus = "Started" | "Stopped";
-export function NetworkURL(n: NetworkInfo, edit: boolean = false): string {
+export function NetworkURL(n: NetworkInfo, edit = false): string {
return `/net/${n.uuid}${edit ? "/edit" : ""}`;
}
diff --git a/virtweb_frontend/src/api/TokensApi.ts b/virtweb_frontend/src/api/TokensApi.ts
index daf27a4..b2a4ab4 100644
--- a/virtweb_frontend/src/api/TokensApi.ts
+++ b/virtweb_frontend/src/api/TokensApi.ts
@@ -20,7 +20,7 @@ export interface APIToken {
max_inactivity?: number;
}
-export function APITokenURL(t: APIToken, edit: boolean = false): string {
+export function APITokenURL(t: APIToken, edit = false): string {
return `/token/${t.id}${edit ? "/edit" : ""}`;
}
diff --git a/virtweb_frontend/src/hooks/providers/AlertDialogProvider.tsx b/virtweb_frontend/src/hooks/providers/AlertDialogProvider.tsx
index 520e56e..0510bd6 100644
--- a/virtweb_frontend/src/hooks/providers/AlertDialogProvider.tsx
+++ b/virtweb_frontend/src/hooks/providers/AlertDialogProvider.tsx
@@ -39,7 +39,7 @@ export function AlertDialogProvider(p: PropsWithChildren): React.ReactElement {
return (
<>
- {p.children}
+ {p.children}