From 79ff9df0411fc90c070a2c630e8b0285efc43ead Mon Sep 17 00:00:00 2001 From: Nathan Hayfield Date: Thu, 18 Jan 2024 20:09:07 +0100 Subject: [PATCH] linting so fun --- .eslintrc.js => .eslintrc.cjs | 11 +++++++++- assets/assets.d.ts | 1 - package.json | 1 + src/cli.ts | 4 ++-- src/main.dev.ts | 22 +++++++++++-------- .../components/BeforeBackActionDialog.tsx | 6 ++--- src/renderer/components/CertDetails.tsx | 20 ++++++++--------- .../components/ConfirmationDialog.tsx | 4 ++-- src/renderer/components/ConnectionRow.tsx | 4 ++-- src/renderer/components/ExportDialog.tsx | 9 ++++---- src/renderer/components/FieldWrapper.tsx | 4 ++-- src/renderer/components/TagFolderRow.tsx | 4 ++-- src/renderer/components/TextField.tsx | 6 ++--- src/renderer/components/TopBar.tsx | 2 +- src/renderer/components/TopTabs.tsx | 6 ++--- src/renderer/components/VirtualFolderRow.tsx | 4 ++-- src/renderer/icons/ClosedFolder.tsx | 6 ++--- src/renderer/icons/Connected.tsx | 6 ++--- src/renderer/icons/Delete.tsx | 6 ++--- src/renderer/icons/Disconnected.tsx | 6 ++--- src/renderer/icons/Edit.tsx | 6 ++--- src/renderer/icons/Export.tsx | 6 ++--- src/renderer/icons/ExportJSON.tsx | 6 ++--- src/renderer/icons/Logo.tsx | 6 ++--- src/renderer/icons/OpenFolder.tsx | 6 ++--- src/renderer/icons/VirtualClosedFolder.tsx | 6 ++--- src/renderer/icons/VirtualOpenFolder.tsx | 6 ++--- src/renderer/menu.ts | 4 ++-- src/renderer/pages/ConnectionView.tsx | 8 +++---- src/renderer/pages/ManageConnections.tsx | 12 +++++----- src/renderer/window.ts | 2 +- src/trayMenu/helper.ts | 11 +++++----- yarn.lock | 5 +++++ 33 files changed, 117 insertions(+), 99 deletions(-) rename .eslintrc.js => .eslintrc.cjs (61%) diff --git a/.eslintrc.js b/.eslintrc.cjs similarity index 61% rename from .eslintrc.js rename to .eslintrc.cjs index 89307977..ba90fede 100644 --- a/.eslintrc.js +++ b/.eslintrc.cjs @@ -8,7 +8,16 @@ module.exports = { // cause sometimes concat is more readable 'prefer-template': 'off', 'react-hooks/exhaustive-deps': 'off', - '@typescript-eslint/no-explicit-any': ['warn', { ignoreRestArgs: true }], + 'no-explicit-any': 'off', + 'import/no-unresolved': 'off', + 'import/extensions': 'off', + 'react/function-component-definition': 'off', + 'react/jsx-filename-extension': 'off', + 'react/no-unstable-nested-components': 'off', + 'class-methods-use-this': 'off', + 'react/jsx-no-useless-fragment': 'off', + 'no-unsafe-optional-chaining': 'off', + 'no-promise-executor-return': 'off', }, parserOptions: { ecmaVersion: 2020, diff --git a/assets/assets.d.ts b/assets/assets.d.ts index 04e77e41..9c17307d 100644 --- a/assets/assets.d.ts +++ b/assets/assets.d.ts @@ -1,4 +1,3 @@ -/* eslint-disable @typescript-eslint/no-explicit-any */ declare module '*.svg' { const content: any; export default content; diff --git a/package.json b/package.json index ad00acae..e768cb76 100644 --- a/package.json +++ b/package.json @@ -288,6 +288,7 @@ "regenerator-runtime": "^0.14.1", "source-map-support": "^0.5.19", "ts-proto": "^1.166.2", + "typescript-eslint": "^0.0.1-alpha.0", "validator": "^13.11.0" }, "devEngines": { diff --git a/src/cli.ts b/src/cli.ts index de8b39af..6648525f 100644 --- a/src/cli.ts +++ b/src/cli.ts @@ -47,11 +47,11 @@ export async function start(sentryDSN: string): Promise { const configClient = new ConfigClient( grpcAddress, - ChannelCredentials.createInsecure() + ChannelCredentials.createInsecure(), ); const listenerClient = new ListenerClient( grpcAddress, - ChannelCredentials.createInsecure() + ChannelCredentials.createInsecure(), ); return { process, configClient, listenerClient }; diff --git a/src/main.dev.ts b/src/main.dev.ts index 09ed8b54..1c320aae 100644 --- a/src/main.dev.ts +++ b/src/main.dev.ts @@ -8,8 +8,13 @@ * When running `yarn build` or `yarn build-main`, this file is compiled to * `./src/main.prod.js` using webpack. This gives us some performance wins. */ -import 'core-js/stable'; -import { app, BrowserWindow, dialog, ipcMain } from 'electron'; +import { + app, + BrowserWindow, + dialog, + ipcMain, + MessageBoxOptions, +} from 'electron'; import * as grpc from '@grpc/grpc-js'; import * as Sentry from '@sentry/electron'; import log from 'electron-log'; @@ -20,7 +25,6 @@ import path from 'path'; import fs from 'fs'; import contextMenu from 'electron-context-menu'; import createWindow from './renderer/window'; -import 'regenerator-runtime/runtime'; import { isDev, isProd, @@ -101,7 +105,7 @@ const onUncaughtException = (() => { message: 'If you would like to file a bug report please include the following Sentry Id: ' + sentryId, - } as Electron.MessageBoxOptions; + } as MessageBoxOptions; if ('spawnargs' in err) { msg.title = 'Incorrect CLI supplied.'; @@ -117,7 +121,7 @@ const onUncaughtException = (() => { process.on('uncaughtException', onUncaughtException); app.on('activate', async () => { - // On macOS it's common to re-create a window in the app when the + // On macOS, it's common to re-create a window in the app when the // dock icon is clicked and there are no other windows open. if (mainWindow === null) mainWindow = createWindow(); }); @@ -141,7 +145,7 @@ async function init(): Promise { pathname: path.join(__dirname, 'index.html'), protocol: 'file:', slashes: true, - }) + }), ); const trayMenuHelper = new Helper([], {}, [], mainWindow, null); @@ -204,7 +208,7 @@ async function init(): Promise { trayMenuHelper.setRecords(res.records); menu.tray.setContextMenu(trayMenuHelper.createContextMenu()); } - } + }, ); }); ipcMain.on(GET_UNIQUE_TAGS, (evt) => { @@ -264,7 +268,7 @@ async function init(): Promise { data: res?.data || [], filename: args.filename, }); - } + }, ); }); ipcMain.on(IMPORT, (evt) => { @@ -279,7 +283,7 @@ async function init(): Promise { } as ImportRequest, (err, res) => { evt?.sender?.send(IMPORT, { err, res }); - } + }, ); } return null; diff --git a/src/renderer/components/BeforeBackActionDialog.tsx b/src/renderer/components/BeforeBackActionDialog.tsx index 1ebfc35f..5db774c3 100644 --- a/src/renderer/components/BeforeBackActionDialog.tsx +++ b/src/renderer/components/BeforeBackActionDialog.tsx @@ -5,7 +5,7 @@ import DialogContent from '@mui/material/DialogContent'; import DialogTitle from '@mui/material/DialogTitle'; import Divider from '@mui/material/Divider'; import Typography from '@mui/material/Typography'; -import React from 'react'; +import React, { ReactElement } from 'react'; import { ipcRenderer } from 'electron'; import { VIEW_CONNECTION_LIST } from '../../shared/constants'; @@ -14,7 +14,7 @@ interface Props { onClose(): void; } -const BeforeBackActionDialog = ({ open, onClose }: Props): JSX.Element => { +function BeforeBackActionDialog({ open, onClose }: Props): ReactElement { const handleClickCancel = (evt: React.MouseEvent): void => { evt.preventDefault(); onClose(); @@ -50,5 +50,5 @@ const BeforeBackActionDialog = ({ open, onClose }: Props): JSX.Element => { ); -}; +} export default BeforeBackActionDialog; diff --git a/src/renderer/components/CertDetails.tsx b/src/renderer/components/CertDetails.tsx index 462e985f..61ec62cf 100644 --- a/src/renderer/components/CertDetails.tsx +++ b/src/renderer/components/CertDetails.tsx @@ -8,7 +8,7 @@ import List from '@mui/material/List'; import ListItem from '@mui/material/ListItem'; import Typography from '@mui/material/Typography'; import moment from 'moment'; -import React from 'react'; +import React, { ReactElement } from 'react'; import DialogActions from '@mui/material/DialogActions'; import Button from '@mui/material/Button'; @@ -24,10 +24,10 @@ interface DataPointProps { title; } -const DataPoint = ({ +function DataPoint({ children, title, -}: React.PropsWithChildren) => { +}: React.PropsWithChildren) { return ( @@ -40,13 +40,13 @@ const DataPoint = ({ ); -}; +} -const DetailViewDialog = ({ +function DetailViewDialog({ open, onClose, certInfo, -}: DetailViewDialogProps): JSX.Element => { +}: DetailViewDialogProps): ReactElement { return ( - {certInfo?.dnsNames?.map((dns_name) => ( - - {dns_name} + {certInfo?.dnsNames?.map((dnsName) => ( + + {dnsName} ))} @@ -103,5 +103,5 @@ const DetailViewDialog = ({ ); -}; +} export default DetailViewDialog; diff --git a/src/renderer/components/ConfirmationDialog.tsx b/src/renderer/components/ConfirmationDialog.tsx index 1193e844..0bee9e6b 100644 --- a/src/renderer/components/ConfirmationDialog.tsx +++ b/src/renderer/components/ConfirmationDialog.tsx @@ -1,4 +1,4 @@ -import React, { FC } from 'react'; +import React, { FC, ReactElement } from 'react'; import { Dialog, DialogTitle, @@ -20,7 +20,7 @@ const ConfirmationDialog: FC = ({ text, onConfirm, onClose, -}: ConfirmationDialogProps): JSX.Element => ( +}: ConfirmationDialogProps): ReactElement => ( {title} diff --git a/src/renderer/components/ConnectionRow.tsx b/src/renderer/components/ConnectionRow.tsx index 279b681b..af2d3e0e 100644 --- a/src/renderer/components/ConnectionRow.tsx +++ b/src/renderer/components/ConnectionRow.tsx @@ -1,4 +1,4 @@ -import * as React from 'react'; +import React, { ReactElement } from 'react'; import { Typography, Grid, @@ -47,7 +47,7 @@ const ConnectionRow: React.FC = ({ connection, connected, port, -}: ConnectionRowProps): JSX.Element => { +}: ConnectionRowProps): ReactElement => { const [menuAnchor, setMenuAnchor] = React.useState(null); const [exportFile, setExportFile] = React.useState(null); const { enqueueSnackbar } = useSnackbar(); diff --git a/src/renderer/components/ExportDialog.tsx b/src/renderer/components/ExportDialog.tsx index 49280a23..8f26eaef 100644 --- a/src/renderer/components/ExportDialog.tsx +++ b/src/renderer/components/ExportDialog.tsx @@ -1,3 +1,4 @@ +/* eslint no-unused-vars: off */ import { ipcRenderer, IpcRendererEvent } from 'electron'; import Button from '@mui/material/Button'; import Dialog from '@mui/material/Dialog'; @@ -5,7 +6,7 @@ import DialogActions from '@mui/material/DialogActions'; import DialogContent from '@mui/material/DialogContent'; import DialogTitle from '@mui/material/DialogTitle'; import Divider from '@mui/material/Divider'; -import React, { useState } from 'react'; +import React, { ReactElement, useState } from 'react'; import Typography from '@mui/material/Typography'; import Checkbox from '@mui/material/Checkbox'; import FormGroup from '@mui/material/FormGroup'; @@ -22,10 +23,10 @@ type ExportDialogProps = { onClose: () => void; exportFile: ExportFile | null; }; -const ExportDialog = ({ +function ExportDialog({ onClose, exportFile, -}: ExportDialogProps): JSX.Element => { +}: ExportDialogProps): ReactElement { const [includeTags, setIncludeTags] = useState(false); const handleClickCancel = (evt: React.MouseEvent): void => { evt.preventDefault(); @@ -73,5 +74,5 @@ const ExportDialog = ({ ); -}; +} export default ExportDialog; diff --git a/src/renderer/components/FieldWrapper.tsx b/src/renderer/components/FieldWrapper.tsx index b708990e..f9afee86 100644 --- a/src/renderer/components/FieldWrapper.tsx +++ b/src/renderer/components/FieldWrapper.tsx @@ -7,7 +7,7 @@ import { Tooltip, Box, } from '@mui/material'; -import React, { FC, ReactFragment, ReactNode } from 'react'; +import React, { FC, ReactElement, ReactFragment, ReactNode } from 'react'; import { HelpCircle } from 'react-feather'; type FieldWrapperProps = { @@ -20,7 +20,7 @@ const FieldWrapper: FC = ({ label, description, children, -}: FieldWrapperProps): JSX.Element => { +}: FieldWrapperProps): ReactElement => { return ( diff --git a/src/renderer/components/TagFolderRow.tsx b/src/renderer/components/TagFolderRow.tsx index 3688fa8c..a8288dc3 100644 --- a/src/renderer/components/TagFolderRow.tsx +++ b/src/renderer/components/TagFolderRow.tsx @@ -1,5 +1,5 @@ import * as React from 'react'; -import { PropsWithChildren } from 'react'; +import { PropsWithChildren, ReactElement } from 'react'; import { Divider, Grid, @@ -40,7 +40,7 @@ const TagFolderRow: React.FC = ({ connectedListeners, connectionIds, children, -}: PropsWithChildren): JSX.Element => { +}: PropsWithChildren): ReactElement => { const [open, setOpen] = React.useState(false); const [confirmation, setConfirmation] = React.useState(null); diff --git a/src/renderer/components/TextField.tsx b/src/renderer/components/TextField.tsx index bec8d9ae..e7cd260d 100644 --- a/src/renderer/components/TextField.tsx +++ b/src/renderer/components/TextField.tsx @@ -1,10 +1,10 @@ /* eslint-disable react/jsx-props-no-spreading */ import { TextField as MuiTextField, TextFieldProps } from '@mui/material'; -import React from 'react'; +import React, { ReactElement } from 'react'; -const TextField = (props: TextFieldProps): JSX.Element => { +function TextField(props: TextFieldProps): ReactElement { return ( ); -}; +} export default TextField; diff --git a/src/renderer/components/TopBar.tsx b/src/renderer/components/TopBar.tsx index 53d3556e..650f2de4 100644 --- a/src/renderer/components/TopBar.tsx +++ b/src/renderer/components/TopBar.tsx @@ -62,7 +62,7 @@ const TopBar: FC = () => { } isOptionEqualToValue={( option: ListenerRecord, - value: ListenerRecord + value: ListenerRecord, ) => { return option.id === value.id; }} diff --git a/src/renderer/components/TopTabs.tsx b/src/renderer/components/TopTabs.tsx index 943431b5..a8761e30 100644 --- a/src/renderer/components/TopTabs.tsx +++ b/src/renderer/components/TopTabs.tsx @@ -1,9 +1,9 @@ import { AppBar, Grid, Tab, Tabs, Toolbar, Typography } from '@mui/material'; -import React from 'react'; +import React, { ReactElement } from 'react'; import { Link } from 'react-router-dom'; import metadata from '../../meta.json'; -const TopTabs = (): JSX.Element => { +function TopTabs(): ReactElement { return ( { ); -}; +} export default TopTabs; diff --git a/src/renderer/components/VirtualFolderRow.tsx b/src/renderer/components/VirtualFolderRow.tsx index 78d201de..3a27e648 100644 --- a/src/renderer/components/VirtualFolderRow.tsx +++ b/src/renderer/components/VirtualFolderRow.tsx @@ -1,6 +1,6 @@ import * as React from 'react'; import { Typography, Grid, IconButton, Divider } from '@mui/material'; -import { PropsWithChildren } from 'react'; +import { PropsWithChildren, ReactElement } from 'react'; import VirtualClosedFolder from '../icons/VirtualClosedFolder'; import VirtualOpenFolder from '../icons/VirtualOpenFolder'; @@ -16,7 +16,7 @@ const VirtualFolderRow: React.FC = ({ totalListeners, connectedListeners, children, -}: PropsWithChildren): JSX.Element => { +}: PropsWithChildren): ReactElement => { const [open, setOpen] = React.useState(false); const toggleOpen = () => { diff --git a/src/renderer/icons/ClosedFolder.tsx b/src/renderer/icons/ClosedFolder.tsx index c850cf2a..c2550703 100644 --- a/src/renderer/icons/ClosedFolder.tsx +++ b/src/renderer/icons/ClosedFolder.tsx @@ -1,8 +1,8 @@ import { SvgIcon } from '@mui/material'; -import React from 'react'; +import React, { ReactElement } from 'react'; -const ClosedFolder = (): JSX.Element => { +function ClosedFolder(): ReactElement { return ( { /> ); -}; +} export default ClosedFolder; diff --git a/src/renderer/icons/Connected.tsx b/src/renderer/icons/Connected.tsx index ba9d44b7..666987b2 100644 --- a/src/renderer/icons/Connected.tsx +++ b/src/renderer/icons/Connected.tsx @@ -1,7 +1,7 @@ -import React from 'react'; +import React, { ReactElement } from 'react'; import { SvgIcon } from '@mui/material'; -const Connected = (): JSX.Element => { +function Connected(): ReactElement { return ( { /> ); -}; +} export default Connected; diff --git a/src/renderer/icons/Delete.tsx b/src/renderer/icons/Delete.tsx index c83c1c68..f324327c 100644 --- a/src/renderer/icons/Delete.tsx +++ b/src/renderer/icons/Delete.tsx @@ -1,7 +1,7 @@ -import React from 'react'; +import React, { ReactElement } from 'react'; import { SvgIcon } from '@mui/material'; -const Delete = (): JSX.Element => { +function Delete(): ReactElement { return ( { /> ); -}; +} export default Delete; diff --git a/src/renderer/icons/Disconnected.tsx b/src/renderer/icons/Disconnected.tsx index a32c08f8..e5f7bc80 100644 --- a/src/renderer/icons/Disconnected.tsx +++ b/src/renderer/icons/Disconnected.tsx @@ -1,7 +1,7 @@ -import React from 'react'; +import React, { ReactElement } from 'react'; import { SvgIcon } from '@mui/material'; -const Disconnected = (): JSX.Element => { +function Disconnected(): ReactElement { return ( { /> ); -}; +} export default Disconnected; diff --git a/src/renderer/icons/Edit.tsx b/src/renderer/icons/Edit.tsx index 6e041065..d6009d1f 100644 --- a/src/renderer/icons/Edit.tsx +++ b/src/renderer/icons/Edit.tsx @@ -1,7 +1,7 @@ -import React from 'react'; +import React, { ReactElement } from 'react'; import { SvgIcon } from '@mui/material'; -const Edit = (): JSX.Element => { +function Edit(): ReactElement { return ( { /> ); -}; +} export default Edit; diff --git a/src/renderer/icons/Export.tsx b/src/renderer/icons/Export.tsx index 60b37728..b9b00d84 100644 --- a/src/renderer/icons/Export.tsx +++ b/src/renderer/icons/Export.tsx @@ -1,7 +1,7 @@ -import React from 'react'; +import React, { ReactElement } from 'react'; import { SvgIcon } from '@mui/material'; -const Export = (): JSX.Element => { +function Export(): ReactElement { return ( { /> ); -}; +} export default Export; diff --git a/src/renderer/icons/ExportJSON.tsx b/src/renderer/icons/ExportJSON.tsx index 76bf6812..f2746404 100644 --- a/src/renderer/icons/ExportJSON.tsx +++ b/src/renderer/icons/ExportJSON.tsx @@ -1,7 +1,7 @@ -import React from 'react'; +import React, { ReactElement } from 'react'; import { SvgIcon } from '@mui/material'; -const Export = (): JSX.Element => { +function Export(): ReactElement { return ( { /> ); -}; +} export default Export; diff --git a/src/renderer/icons/Logo.tsx b/src/renderer/icons/Logo.tsx index 16c64340..bb33540a 100644 --- a/src/renderer/icons/Logo.tsx +++ b/src/renderer/icons/Logo.tsx @@ -1,7 +1,7 @@ import { SvgIcon } from '@mui/material'; -import React from 'react'; +import React, { ReactElement } from 'react'; -const Logo = (): JSX.Element => { +function Logo(): ReactElement { return ( @@ -74,5 +74,5 @@ const Logo = (): JSX.Element => { ); -}; +} export default Logo; diff --git a/src/renderer/icons/OpenFolder.tsx b/src/renderer/icons/OpenFolder.tsx index ed2b5f4a..932a4c30 100644 --- a/src/renderer/icons/OpenFolder.tsx +++ b/src/renderer/icons/OpenFolder.tsx @@ -1,7 +1,7 @@ -import React from 'react'; +import React, { ReactElement } from 'react'; import { SvgIcon } from '@mui/material'; -const OpenFolder = (): JSX.Element => { +function OpenFolder(): ReactElement { return ( { /> ); -}; +} export default OpenFolder; diff --git a/src/renderer/icons/VirtualClosedFolder.tsx b/src/renderer/icons/VirtualClosedFolder.tsx index 77070c89..3d29814e 100644 --- a/src/renderer/icons/VirtualClosedFolder.tsx +++ b/src/renderer/icons/VirtualClosedFolder.tsx @@ -1,7 +1,7 @@ -import React from 'react'; +import React, { ReactElement } from 'react'; import { SvgIcon } from '@mui/material'; -const VirtualClosedFolder = (): JSX.Element => { +function VirtualClosedFolder(): ReactElement { return ( { /> ); -}; +} export default VirtualClosedFolder; diff --git a/src/renderer/icons/VirtualOpenFolder.tsx b/src/renderer/icons/VirtualOpenFolder.tsx index 877c5d35..0741d0cf 100644 --- a/src/renderer/icons/VirtualOpenFolder.tsx +++ b/src/renderer/icons/VirtualOpenFolder.tsx @@ -1,7 +1,7 @@ -import React from 'react'; +import React, { ReactElement } from 'react'; import { SvgIcon } from '@mui/material'; -const VirtualOpenFolder = (): JSX.Element => { +function VirtualOpenFolder(): ReactElement { return ( { /> ); -}; +} export default VirtualOpenFolder; diff --git a/src/renderer/menu.ts b/src/renderer/menu.ts index 48d47fc5..39827513 100644 --- a/src/renderer/menu.ts +++ b/src/renderer/menu.ts @@ -226,7 +226,7 @@ export default class MenuBuilder { accelerator: 'F11', click: () => { this.mainWindow.setFullScreen( - !this.mainWindow.isFullScreen() + !this.mainWindow.isFullScreen(), ); }, }, @@ -244,7 +244,7 @@ export default class MenuBuilder { accelerator: 'F11', click: () => { this.mainWindow.setFullScreen( - !this.mainWindow.isFullScreen() + !this.mainWindow.isFullScreen(), ); }, }, diff --git a/src/renderer/pages/ConnectionView.tsx b/src/renderer/pages/ConnectionView.tsx index 4d2b6d7d..89081b53 100644 --- a/src/renderer/pages/ConnectionView.tsx +++ b/src/renderer/pages/ConnectionView.tsx @@ -1,4 +1,4 @@ -import React, { useEffect, useState } from 'react'; +import React, { ReactElement, useEffect, useState } from 'react'; import { Accordion, AccordionDetails, @@ -57,7 +57,7 @@ type SimplifiedLog = { date: string; }; -const ConnectionView = (): JSX.Element => { +function ConnectionView(): ReactElement { const [tags, setTags] = useState([] as Record['tags']); const [connection, setConnection] = useState({} as Connection); const [connected, setConnected] = useState(false); @@ -175,7 +175,7 @@ const ConnectionView = (): JSX.Element => { { variant: 'error', autoHideDuration: TOAST_LENGTH, - } + }, ); } } @@ -575,5 +575,5 @@ const ConnectionView = (): JSX.Element => { ); } return <>; -}; +} export default ConnectionView; diff --git a/src/renderer/pages/ManageConnections.tsx b/src/renderer/pages/ManageConnections.tsx index 5d6c83e5..7eab31fd 100644 --- a/src/renderer/pages/ManageConnections.tsx +++ b/src/renderer/pages/ManageConnections.tsx @@ -1,4 +1,4 @@ -import React, { useEffect, useState } from 'react'; +import React, { ReactElement, useEffect, useState } from 'react'; import { Button, CardContent, @@ -35,7 +35,7 @@ import ExportDialog, { } from '../components/ExportDialog'; import StyledCard from '../components/StyledCard'; -const ManageConnections = (): JSX.Element => { +function ManageConnections(): ReactElement { const [folderNames, setFolderNames] = useState([] as string[]); const [connections, setConnections] = useState([] as ListenerRecord[]); const [exportFile, setExportFile] = useState(null); @@ -102,7 +102,7 @@ const ManageConnections = (): JSX.Element => { autoHideDuration: TOAST_LENGTH, }); } - } + }, ); setStatuses((prevState) => { return { @@ -164,7 +164,7 @@ const ManageConnections = (): JSX.Element => { }, []); const untagged = connections?.filter( - (connection) => !connection?.tags?.length + (connection) => !connection?.tags?.length, ); return ( @@ -234,7 +234,7 @@ const ManageConnections = (): JSX.Element => { {folderNames.map((folderName) => { const folderConns = connections.filter( - (connection) => connection?.tags?.indexOf(folderName) >= 0 + (connection) => connection?.tags?.indexOf(folderName) >= 0, ); return ( { ); -}; +} export default ManageConnections; diff --git a/src/renderer/window.ts b/src/renderer/window.ts index f532b2e6..86b5faa9 100644 --- a/src/renderer/window.ts +++ b/src/renderer/window.ts @@ -7,7 +7,7 @@ Sentry.init({ dsn: 'https://56e47edf5a3c437186196bb49bb03c4c@o845499.ingest.sentry.io/6146413', }); -const createWindow = () => { +const createWindow = (): BrowserWindow | null => { const appWindow = new BrowserWindow({ show: true, width: 1024, diff --git a/src/trayMenu/helper.ts b/src/trayMenu/helper.ts index 2db75b3e..99cb94f7 100644 --- a/src/trayMenu/helper.ts +++ b/src/trayMenu/helper.ts @@ -29,7 +29,7 @@ export default class Helper { statuses: { [key: string]: ListenerStatus }, tags: string[], appWindow: BrowserWindow | null, - menu: Menubar | null + menu: Menubar | null, ) { this.records = records; this.statuses = statuses; @@ -82,7 +82,7 @@ export default class Helper { { connectionIds: filtered.map((rec) => rec.id), connected: true, - } + }, ); }, }); @@ -96,7 +96,7 @@ export default class Helper { { connectionIds: filtered.map((rec) => rec.id), connected: false, - } + }, ); }, }); @@ -106,7 +106,6 @@ export default class Helper { }); filtered.forEach((rec) => { - // eslint-disable-next-line @typescript-eslint/no-this-alias const that = this; const iconName = this.statuses[rec.id as string]?.listening ? 'connected.png' @@ -122,7 +121,7 @@ export default class Helper { { connectionIds: [rec.id], connected: !that.statuses[rec.id as string]?.listening, - } + }, ); }, }); @@ -155,7 +154,7 @@ export default class Helper { this.tags.forEach((tag) => { const conns = this.buildFolderSubmenu( - this.records.filter((rec) => rec.tags.includes(tag)) + this.records.filter((rec) => rec.tags.includes(tag)), ); template.push({ diff --git a/yarn.lock b/yarn.lock index 6a140b87..8d9d0e46 100644 --- a/yarn.lock +++ b/yarn.lock @@ -10647,6 +10647,11 @@ typedarray@^0.0.6: resolved "https://registry.yarnpkg.com/typedarray/-/typedarray-0.0.6.tgz#867ac74e3864187b1d3d47d996a78ec5c8830777" integrity sha512-/aCDEGatGvZ2BIk+HmLf4ifCJFwvKFNb9/JeZPMulfgFracn9QFcAf5GO8B/mweUjSoblS5In0cWhqpfs/5PQA== +typescript-eslint@^0.0.1-alpha.0: + version "0.0.1-alpha.0" + resolved "https://registry.yarnpkg.com/typescript-eslint/-/typescript-eslint-0.0.1-alpha.0.tgz#285d68a4e96588295cd436278801bcb6a6b916c1" + integrity sha512-1hNKM37dAWML/2ltRXupOq2uqcdRQyDFphl+341NTPXFLLLiDhErXx8VtaSLh3xP7SyHZdcCgpt9boYYVb3fQg== + typescript@^5.3.3: version "5.3.3" resolved "https://registry.yarnpkg.com/typescript/-/typescript-5.3.3.tgz#b3ce6ba258e72e6305ba66f5c9b452aaee3ffe37"