Fix ESLint issues
This commit is contained in:
@@ -1,23 +1,26 @@
|
||||
import js from '@eslint/js'
|
||||
import globals from 'globals'
|
||||
import reactHooks from 'eslint-plugin-react-hooks'
|
||||
import reactRefresh from 'eslint-plugin-react-refresh'
|
||||
import tseslint from 'typescript-eslint'
|
||||
import { defineConfig, globalIgnores } from 'eslint/config'
|
||||
import js from "@eslint/js";
|
||||
import globals from "globals";
|
||||
import reactHooks from "eslint-plugin-react-hooks";
|
||||
import reactRefresh from "eslint-plugin-react-refresh";
|
||||
import tseslint from "typescript-eslint";
|
||||
import { defineConfig, globalIgnores } from "eslint/config";
|
||||
|
||||
export default defineConfig([
|
||||
globalIgnores(['dist']),
|
||||
globalIgnores(["dist"]),
|
||||
{
|
||||
files: ['**/*.{ts,tsx}'],
|
||||
files: ["**/*.{ts,tsx}"],
|
||||
extends: [
|
||||
js.configs.recommended,
|
||||
tseslint.configs.recommended,
|
||||
reactHooks.configs['recommended-latest'],
|
||||
reactHooks.configs["recommended-latest"],
|
||||
reactRefresh.configs.vite,
|
||||
],
|
||||
languageOptions: {
|
||||
ecmaVersion: 2020,
|
||||
globals: globals.browser,
|
||||
},
|
||||
rules: {
|
||||
"react-refresh/only-export-components": "off",
|
||||
},
|
||||
},
|
||||
])
|
||||
]);
|
||||
|
||||
@@ -257,7 +257,7 @@ function SyncThreadStatus(): React.ReactElement {
|
||||
const interval = setInterval(loadStatus, 1000);
|
||||
|
||||
return () => clearInterval(interval);
|
||||
}, []);
|
||||
});
|
||||
|
||||
return (
|
||||
<>
|
||||
|
||||
@@ -1,64 +1,34 @@
|
||||
import React from "react";
|
||||
import { JsonView, darkStyles } from "react-json-view-lite";
|
||||
import "react-json-view-lite/dist/index.css";
|
||||
import { WsApi, type WsMessage } from "../api/WsApi";
|
||||
import { useSnackbar } from "../hooks/contexts_provider/SnackbarProvider";
|
||||
import { time } from "../utils/DateUtils";
|
||||
import { type WsMessage } from "../api/WsApi";
|
||||
import { useUserInfo } from "../widgets/dashboard/BaseAuthenticatedPage";
|
||||
import { MatrixGWRouteContainer } from "../widgets/MatrixGWRouteContainer";
|
||||
import { MatrixWS, WSState } from "../widgets/messages/MatrixWS";
|
||||
import { NotLinkedAccountMessage } from "../widgets/NotLinkedAccountMessage";
|
||||
|
||||
const State = {
|
||||
Closed: "Closed",
|
||||
Connected: "Connected",
|
||||
Error: "Error",
|
||||
} as const;
|
||||
|
||||
type TimestampedMessages = WsMessage & { time: number };
|
||||
|
||||
export function WSDebugRoute(): React.ReactElement {
|
||||
const user = useUserInfo();
|
||||
if (!user.info.matrix_account_connected) return <NotLinkedAccountMessage />;
|
||||
|
||||
const snackbar = useSnackbar();
|
||||
|
||||
const [state, setState] = React.useState<string>(State.Closed);
|
||||
const wsRef = React.useRef<WebSocket | undefined>(undefined);
|
||||
|
||||
const [state, setState] = React.useState<string>(WSState.Closed);
|
||||
const [messages, setMessages] = React.useState<TimestampedMessages[]>([]);
|
||||
|
||||
React.useEffect(() => {
|
||||
const ws = new WebSocket(WsApi.WsURL);
|
||||
wsRef.current = ws;
|
||||
const handleMessage = (msg: WsMessage) => {
|
||||
setMessages((l) => [...l, msg]);
|
||||
};
|
||||
|
||||
ws.onopen = () => setState(State.Connected);
|
||||
ws.onerror = (e) => {
|
||||
console.error(`WS Debug error!`, e);
|
||||
snackbar(`WebSocket error! ${e}`);
|
||||
setState(State.Error);
|
||||
};
|
||||
ws.onclose = () => {
|
||||
setState(State.Closed);
|
||||
wsRef.current = undefined;
|
||||
};
|
||||
|
||||
ws.onmessage = (msg) => {
|
||||
const dec = JSON.parse(msg.data);
|
||||
setMessages((l) => {
|
||||
return [{ time: time(), ...dec }, ...l];
|
||||
});
|
||||
};
|
||||
|
||||
return () => ws.close();
|
||||
}, []);
|
||||
if (!user.info.matrix_account_connected) return <NotLinkedAccountMessage />;
|
||||
|
||||
return (
|
||||
<MatrixGWRouteContainer label={"WebSocket Debug"}>
|
||||
<div>
|
||||
State:{" "}
|
||||
<span style={{ color: state == State.Connected ? "green" : "red" }}>
|
||||
<span style={{ color: state == WSState.Connected ? "green" : "red" }}>
|
||||
{state}
|
||||
</span>
|
||||
<MatrixWS onStateChange={setState} onMessage={handleMessage} />
|
||||
</div>
|
||||
{messages.map((msg, id) => (
|
||||
<div style={{ margin: "10px", backgroundColor: "black" }}>
|
||||
|
||||
@@ -6,7 +6,6 @@ import { svgIconClasses } from "@mui/material/SvgIcon";
|
||||
import { typographyClasses } from "@mui/material/Typography";
|
||||
import { gray, green, red } from "../themePrimitives";
|
||||
|
||||
/* eslint-disable import/prefer-default-export */
|
||||
export const dataDisplayCustomizations: Components<Theme> = {
|
||||
MuiList: {
|
||||
styleOverrides: {
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
import { type Theme, alpha, type Components } from "@mui/material/styles";
|
||||
import { gray, orange } from "../themePrimitives";
|
||||
|
||||
/* eslint-disable import/prefer-default-export */
|
||||
export const feedbackCustomizations: Components<Theme> = {
|
||||
MuiAlert: {
|
||||
styleOverrides: {
|
||||
|
||||
@@ -8,7 +8,6 @@ import CheckRoundedIcon from "@mui/icons-material/CheckRounded";
|
||||
import RemoveRoundedIcon from "@mui/icons-material/RemoveRounded";
|
||||
import { gray, brand } from "../themePrimitives";
|
||||
|
||||
/* eslint-disable import/prefer-default-export */
|
||||
export const inputsCustomizations: Components<Theme> = {
|
||||
MuiButtonBase: {
|
||||
defaultProps: {
|
||||
|
||||
@@ -9,7 +9,6 @@ import { tabClasses } from "@mui/material/Tab";
|
||||
import UnfoldMoreRoundedIcon from "@mui/icons-material/UnfoldMoreRounded";
|
||||
import { gray, brand } from "../themePrimitives";
|
||||
|
||||
/* eslint-disable import/prefer-default-export */
|
||||
export const navigationCustomizations: Components<Theme> = {
|
||||
MuiMenuItem: {
|
||||
styleOverrides: {
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
import { alpha, type Theme, type Components } from "@mui/material/styles";
|
||||
import { gray } from "../themePrimitives";
|
||||
|
||||
/* eslint-disable import/prefer-default-export */
|
||||
export const surfacesCustomizations: Components<Theme> = {
|
||||
MuiAccordion: {
|
||||
defaultProps: {
|
||||
|
||||
@@ -24,8 +24,6 @@ declare module "@mui/material/styles" {
|
||||
900: string;
|
||||
}
|
||||
|
||||
interface PaletteColor extends ColorRange {}
|
||||
|
||||
interface Palette {
|
||||
baseShadow: string;
|
||||
}
|
||||
@@ -405,10 +403,10 @@ export const shape = {
|
||||
borderRadius: 8,
|
||||
};
|
||||
|
||||
// @ts-ignore
|
||||
const defaultShadows: Shadows = [
|
||||
"none",
|
||||
"var(--template-palette-baseShadow)",
|
||||
...defaultTheme.shadows.slice(2),
|
||||
];
|
||||
] as never;
|
||||
|
||||
export const shadows = defaultShadows;
|
||||
|
||||
@@ -10,7 +10,7 @@ const State = {
|
||||
type State = keyof typeof State;
|
||||
|
||||
export function AsyncWidget(p: {
|
||||
loadKey: any;
|
||||
loadKey: unknown;
|
||||
load: () => Promise<void>;
|
||||
errMsg: string;
|
||||
build: () => React.ReactElement;
|
||||
@@ -19,7 +19,7 @@ export function AsyncWidget(p: {
|
||||
}): React.ReactElement {
|
||||
const [state, setState] = useState<number>(State.Loading);
|
||||
|
||||
const counter = useRef<any>(null);
|
||||
const counter = useRef<unknown>(null);
|
||||
|
||||
const load = async () => {
|
||||
try {
|
||||
|
||||
Reference in New Issue
Block a user