mirror of
https://seed.radicle.dev/rad:z4V1sjrXqjvFdnCUbxPFqd5p4DtH5.git
synced 2026-11-29 10:10:30 +08:00
Update eslint config to flat config
Since the legacy config is being deprecated at the end of 2024, we should start moving to the eslint flat config. I avoided the tseslint config helper function so we avoid wrapping magic. This seems to have triggered more checking since any checks in svelte files have appeared and the $$Generic type that is being deprecated had to be rewritten. Also fixes some any types that weren't caught previously
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
<script lang="ts">
|
||||
<script lang="ts" generics="CobState">
|
||||
import IconSmall from "@app/components/IconSmall.svelte";
|
||||
|
||||
import isEqual from "lodash/isEqual";
|
||||
@@ -11,8 +11,6 @@
|
||||
import Icon from "@app/components/Icon.svelte";
|
||||
import Button from "@app/components/Button.svelte";
|
||||
|
||||
type CobState = $$Generic;
|
||||
|
||||
export let state: CobState;
|
||||
export let selectedItem: [string, CobState];
|
||||
export let items: [string, CobState][];
|
||||
|
||||
@@ -122,6 +122,7 @@
|
||||
type State = "read" | "submit" | "edit";
|
||||
|
||||
let response: DiffResponse | undefined = undefined;
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
let error: any | undefined = undefined;
|
||||
let loading: boolean = false;
|
||||
let revisionState: State = "read";
|
||||
@@ -135,6 +136,7 @@
|
||||
try {
|
||||
loading = true;
|
||||
response = await api.project.getDiff(projectId, fromCommit, revisionOid);
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
} catch (err: any) {
|
||||
error = err;
|
||||
} finally {
|
||||
|
||||
@@ -35,6 +35,7 @@
|
||||
|
||||
const api = new HttpdClient(baseUrl);
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
let error: any;
|
||||
let page = 0;
|
||||
let loading = false;
|
||||
|
||||
@@ -30,6 +30,7 @@
|
||||
|
||||
let loading = false;
|
||||
let page = 0;
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
let error: any;
|
||||
let allIssues: Issue[];
|
||||
|
||||
|
||||
@@ -31,6 +31,7 @@
|
||||
|
||||
let loading = false;
|
||||
let page = 0;
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
let error: any;
|
||||
let allPatches: Patch[];
|
||||
|
||||
|
||||
@@ -73,3 +73,15 @@ export function handleError(
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
export function unreachableError(): NotFoundRoute | ErrorRoute {
|
||||
return {
|
||||
resource: "error",
|
||||
params: {
|
||||
error: undefined,
|
||||
title: "Could not load this route",
|
||||
description:
|
||||
"You stumbled on an unknown error, we aren't exactly sure what happened.",
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
@@ -23,12 +23,12 @@ import type {
|
||||
import * as Syntax from "@app/lib/syntax";
|
||||
import * as httpd from "@app/lib/httpd";
|
||||
import { HttpdClient } from "@httpd-client";
|
||||
import { ResponseError } from "@httpd-client/lib/fetcher";
|
||||
import { handleError } from "@app/views/projects/error";
|
||||
import { ResponseError, ResponseParseError } from "@httpd-client/lib/fetcher";
|
||||
import { experimental } from "@app/lib/appearance";
|
||||
import { get } from "svelte/store";
|
||||
import { handleError, unreachableError } from "@app/views/projects/error";
|
||||
import { nodePath } from "@app/views/nodes/router";
|
||||
import { unreachable } from "@app/lib/utils";
|
||||
import { get } from "svelte/store";
|
||||
import { experimental } from "@app/lib/appearance";
|
||||
|
||||
export const COMMITS_PER_PAGE = 30;
|
||||
export const PATCHES_PER_PAGE = 10;
|
||||
@@ -315,8 +315,16 @@ export async function loadProjectRoute(
|
||||
} else {
|
||||
return unreachable(route);
|
||||
}
|
||||
} catch (error: any) {
|
||||
return handleError(error, route);
|
||||
} catch (error) {
|
||||
if (
|
||||
error instanceof Error ||
|
||||
error instanceof ResponseError ||
|
||||
error instanceof ResponseParseError
|
||||
) {
|
||||
return handleError(error, route);
|
||||
} else {
|
||||
return unreachableError();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user