From 709cc97e64aa1c8d868bb934da51f203aa494d42 Mon Sep 17 00:00:00 2001 From: Johanna Szepanski <johanna.szepanski@softhouse.se> Date: Fri, 22 Nov 2024 14:41:06 +0100 Subject: [PATCH] added recommended settings for eslint-import-plugin and fixed all complaints --- .eslintrc | 33 ++++++++++++++----- package-lock.json | 2 +- package.json | 2 +- src/App.jsx | 4 +-- .../AdministerUndeployment.jsx | 6 ++-- .../IOC/AdministerUndeployment/index.js | 3 +- .../IOC/ChangeHostAdmin/ChangeHostAdmin.jsx | 8 ++--- src/components/IOC/ChangeHostAdmin/index.js | 3 +- src/components/IOC/IOCAdmin/IOCAdmin.jsx | 14 ++++---- src/components/IOC/IOCAdmin/index.js | 3 +- src/components/IOC/IOCDelete/IOCDelete.jsx | 6 ++-- src/components/IOC/IOCDelete/index.js | 3 +- .../IOC/IOCDetailAdmin/IOCDetailAdmin.jsx | 8 ++--- src/components/IOC/IOCDetailAdmin/index.js | 3 +- src/components/IOC/IOCDetails/IOCDetails.jsx | 2 +- .../IOC/IOCLiveStatus/IOCLiveStatus.jsx | 2 +- src/components/IOC/IOCManage/IOCManage.jsx | 2 +- src/components/IOC/IOCService/IOCService.jsx | 2 +- src/components/IOC/IOCTable/IOCTable.jsx | 6 ++-- src/components/IOC/IOCTable/index.js | 1 - .../auth/AccessControl/AccessControl.jsx | 8 ++--- src/components/auth/AccessControl/index.js | 3 +- .../auth/AccessDenied/AccessDenied.jsx | 4 +-- src/components/auth/AccessDenied/index.js | 3 +- src/components/auth/TokenRenew/TokenRenew.jsx | 4 +-- src/components/auth/TokenRenew/index.js | 3 +- src/components/common/Popover/index.js | 1 - src/components/common/Status/Status.jsx | 2 +- src/components/navigation/Menu/MenuDrawer.jsx | 2 +- src/components/navigation/Menu/index.js | 1 - .../NavigationMenu/CreateIOCButton.jsx | 4 +-- .../NavigationMenu/LoginControls.jsx | 8 ++--- .../NavigationMenu/NavigationMenu.jsx | 4 +-- .../navigation/NavigationMenu/index.js | 3 +- .../navigation/NotFoundView/NotFoundView.tsx | 4 +-- .../navigation/NotFoundView/index.ts | 3 +- src/mocks/AppHarness.jsx | 2 +- .../views/Navigation/NotFoundView.stories.jsx | 2 +- src/typings.d.ts | 4 +-- src/views/IOC/IOCDetailsAccessControl.jsx | 2 +- src/views/IOC/IOCDetailsContainer.jsx | 2 +- src/views/IOC/IOCDetailsView.jsx | 2 +- src/views/IOC/IOCListView.tsx | 2 +- .../UserPage/UserDetailsAccessControl.jsx | 2 +- src/views/UserPage/UserDetailsContainer.jsx | 2 +- .../host/details/HostDetailsAccessControl.jsx | 2 +- .../host/details/HostDetailsContainer.jsx | 2 +- src/views/host/details/HostDetailsView.jsx | 2 +- src/views/host/details/HostIocSection.jsx | 2 +- src/views/jobs/JobDetailsAccessControl.jsx | 2 +- src/views/jobs/JobDetailsContainer.jsx | 2 +- src/views/jobs/JobLogAccessControl.jsx | 2 +- src/views/records/RecordDetailsView.jsx | 2 +- 53 files changed, 104 insertions(+), 102 deletions(-) diff --git a/.eslintrc b/.eslintrc index 79d61f94..a8a5252b 100644 --- a/.eslintrc +++ b/.eslintrc @@ -16,7 +16,8 @@ "plugin:@typescript-eslint/recommended", "plugin:cypress/recommended", "plugin:prettier/recommended", - "plugin:import/typescript" + "plugin:import/typescript", + "plugin:import/recommended" ], "settings": { "react": { @@ -41,7 +42,29 @@ }, "rules": { "react/prop-types": "off", - "no-duplicate-imports": "error", + "import/order": [ + "error", + { + "groups": [ + "external", + "index", + "sibling", + "parent", + "internal", + "builtin", + "object", + "type" + ] + } + ], + "import/export": "error", + "import/default": "error", + "import/named": "error", + "import/namespace": "error", + "import/no-named-as-default": 2, + "import/no-named-as-default-member": 2, + "import/no-unresolved": ["error", { "caseSensitive": false, "commonjs": true, "amd": true }], + "import/no-duplicates": "error", "consistent-this": [ "error", "self" @@ -55,12 +78,6 @@ "null": "ignore" } ], - "import/no-unresolved": [ - 2, - { - "caseSensitive": false - } - ], "no-console": [ "error", { diff --git a/package-lock.json b/package-lock.json index 8d18305d..37321929 100644 --- a/package-lock.json +++ b/package-lock.json @@ -47,7 +47,7 @@ "eslint-formatter-gitlab": "^4.0.0", "eslint-import-resolver-typescript": "^3.6.3", "eslint-plugin-cypress": "^2.15.1", - "eslint-plugin-import": "^2.30.0", + "eslint-plugin-import": "^2.31.0", "eslint-plugin-prettier": "^5.2.1", "eslint-plugin-react": "^7.37.1", "eslint-plugin-react-hooks": "^5.0.0", diff --git a/package.json b/package.json index f5f79353..72a1ad91 100644 --- a/package.json +++ b/package.json @@ -76,7 +76,7 @@ "eslint-formatter-gitlab": "^4.0.0", "eslint-import-resolver-typescript": "^3.6.3", "eslint-plugin-cypress": "^2.15.1", - "eslint-plugin-import": "^2.30.0", + "eslint-plugin-import": "^2.31.0", "eslint-plugin-prettier": "^5.2.1", "eslint-plugin-react": "^7.37.1", "eslint-plugin-react-hooks": "^5.0.0", diff --git a/src/App.jsx b/src/App.jsx index 1e3dcbd5..cf32f89b 100644 --- a/src/App.jsx +++ b/src/App.jsx @@ -4,7 +4,7 @@ import { StyledEngineProvider, CssBaseline } from "@mui/material"; import { ThemeProvider } from "@mui/material/styles"; import { theme } from "./style/Theme"; import { IOCListView } from "./views/IOC/IOCListView"; -import NavigationMenu from "./components/navigation/NavigationMenu"; +import { NavigationMenu } from "./components/navigation/NavigationMenu"; import { IOCDetailsAccessControl } from "./views/IOC/IOCDetailsAccessControl"; import { JobDetailsAccessControl } from "./views/jobs/JobDetailsAccessControl"; import { UserProvider } from "./api/UserProvider"; @@ -12,7 +12,7 @@ import { HostListView } from "./views/host/HostListView"; import { HostDetailsAccessControl } from "./views/host/details/HostDetailsAccessControl"; import { HelpView } from "./views/help/HelpView"; import { SnackbarProvider } from "notistack"; -import TokenRenew from "./components/auth/TokenRenew"; +import { TokenRenew } from "./components/auth/TokenRenew"; import { NotFoundView } from "./components/navigation/NotFoundView"; import { AppErrorBoundary, GlobalAppBarContext } from "@ess-ics/ce-ui-common"; import { LoginView } from "./views/login/LoginView"; diff --git a/src/components/IOC/AdministerUndeployment/AdministerUndeployment.jsx b/src/components/IOC/AdministerUndeployment/AdministerUndeployment.jsx index 296bb4f1..c2873efc 100644 --- a/src/components/IOC/AdministerUndeployment/AdministerUndeployment.jsx +++ b/src/components/IOC/AdministerUndeployment/AdministerUndeployment.jsx @@ -10,10 +10,10 @@ import { } from "@mui/material"; import { ConfirmationDialog, useAPIMethod } from "@ess-ics/ce-ui-common"; import Alert from "@mui/material/Alert"; -import AccessControl from "../../auth/AccessControl"; +import { AccessControl } from "../../auth/AccessControl"; import { apiContext } from "../../../api/DeployApi"; -export default function AdministerUndeployment({ ioc, buttonDisabled }) { +export const AdministerUndeployment = ({ ioc, buttonDisabled }) => { const navigate = useNavigate(); // for the dialog @@ -156,4 +156,4 @@ export default function AdministerUndeployment({ ioc, buttonDisabled }) { </> </AccessControl> ); -} +}; diff --git a/src/components/IOC/AdministerUndeployment/index.js b/src/components/IOC/AdministerUndeployment/index.js index fe2a4e6b..2a1e02bf 100644 --- a/src/components/IOC/AdministerUndeployment/index.js +++ b/src/components/IOC/AdministerUndeployment/index.js @@ -1,4 +1,3 @@ -import AdministerUndeployment from "./AdministerUndeployment"; +import { AdministerUndeployment } from "./AdministerUndeployment"; export { AdministerUndeployment }; -export default AdministerUndeployment; diff --git a/src/components/IOC/ChangeHostAdmin/ChangeHostAdmin.jsx b/src/components/IOC/ChangeHostAdmin/ChangeHostAdmin.jsx index 0208f5ba..ed1335c9 100644 --- a/src/components/IOC/ChangeHostAdmin/ChangeHostAdmin.jsx +++ b/src/components/IOC/ChangeHostAdmin/ChangeHostAdmin.jsx @@ -1,5 +1,5 @@ import { useState, useEffect, useCallback, useContext, useMemo } from "react"; -import AccessControl from "../../auth/AccessControl"; +import { AccessControl } from "../../auth/AccessControl"; import { ConfirmationDialog, useAPIMethod } from "@ess-ics/ce-ui-common"; import { Box, @@ -15,13 +15,13 @@ import { import { useTypingTimer } from "../../common/SearchBoxFilter/TypingTimer"; import { apiContext } from "../../../api/DeployApi"; -export default function ChangeHostAdmin({ +export const ChangeHostAdmin = ({ ioc, getIOC, resetTab, buttonDisabled, setButtonDisabled -}) { +}) => { const initHost = useMemo( () => ({ fqdn: ioc.activeDeployment.host.fqdn, @@ -246,4 +246,4 @@ export default function ChangeHostAdmin({ </AccessControl> </> ); -} +}; diff --git a/src/components/IOC/ChangeHostAdmin/index.js b/src/components/IOC/ChangeHostAdmin/index.js index 82c5de12..fb1c092f 100644 --- a/src/components/IOC/ChangeHostAdmin/index.js +++ b/src/components/IOC/ChangeHostAdmin/index.js @@ -1,4 +1,3 @@ -import ChangeHostAdmin from "./ChangeHostAdmin"; +import { ChangeHostAdmin } from "./ChangeHostAdmin"; export { ChangeHostAdmin }; -export default ChangeHostAdmin; diff --git a/src/components/IOC/IOCAdmin/IOCAdmin.jsx b/src/components/IOC/IOCAdmin/IOCAdmin.jsx index a574f48e..253d7c13 100644 --- a/src/components/IOC/IOCAdmin/IOCAdmin.jsx +++ b/src/components/IOC/IOCAdmin/IOCAdmin.jsx @@ -1,15 +1,15 @@ -import AdministerUndeployment from "../AdministerUndeployment"; -import IOCDelete from "../IOCDelete"; -import IOCDetailAdmin from "../IOCDetailAdmin"; -import ChangeHostAdmin from "../ChangeHostAdmin"; +import { AdministerUndeployment } from "../AdministerUndeployment"; +import { IOCDelete } from "../IOCDelete"; +import { IOCDetailAdmin } from "../IOCDetailAdmin"; +import { ChangeHostAdmin } from "../ChangeHostAdmin"; -export default function IOCAdmin({ +export const IOCAdmin = ({ ioc, getIOC, resetTab, buttonDisabled, setButtonDisabled -}) { +}) => { return ( <> <IOCDetailAdmin @@ -39,4 +39,4 @@ export default function IOCAdmin({ /> </> ); -} +}; diff --git a/src/components/IOC/IOCAdmin/index.js b/src/components/IOC/IOCAdmin/index.js index 86b22226..cfd069c6 100644 --- a/src/components/IOC/IOCAdmin/index.js +++ b/src/components/IOC/IOCAdmin/index.js @@ -1,4 +1,3 @@ -import IOCAdmin from "./IOCAdmin"; +import { IOCAdmin } from "./IOCAdmin"; export { IOCAdmin }; -export default IOCAdmin; diff --git a/src/components/IOC/IOCDelete/IOCDelete.jsx b/src/components/IOC/IOCDelete/IOCDelete.jsx index 3aa06ac2..15fa9fef 100644 --- a/src/components/IOC/IOCDelete/IOCDelete.jsx +++ b/src/components/IOC/IOCDelete/IOCDelete.jsx @@ -4,10 +4,10 @@ import { useCustomSnackbar } from "../../common/snackbar"; import { Box, Button, Grid, Tooltip, Typography } from "@mui/material"; import { ConfirmDangerActionDialog, useAPIMethod } from "@ess-ics/ce-ui-common"; import Alert from "@mui/material/Alert"; -import AccessControl from "../../auth/AccessControl"; +import { AccessControl } from "../../auth/AccessControl"; import { apiContext } from "../../../api/DeployApi"; -export default function IOCDelete({ ioc, buttonDisabled, setButtonDisabled }) { +export const IOCDelete = ({ ioc, buttonDisabled, setButtonDisabled }) => { const navigate = useNavigate(); const showSnackBar = useCustomSnackbar(); @@ -147,4 +147,4 @@ export default function IOCDelete({ ioc, buttonDisabled, setButtonDisabled }) { </Box> </> ); -} +}; diff --git a/src/components/IOC/IOCDelete/index.js b/src/components/IOC/IOCDelete/index.js index a2d977a0..8aee2484 100644 --- a/src/components/IOC/IOCDelete/index.js +++ b/src/components/IOC/IOCDelete/index.js @@ -1,4 +1,3 @@ -import IOCDelete from "./IOCDelete"; +import { IOCDelete } from "./IOCDelete"; export { IOCDelete }; -export default IOCDelete; diff --git a/src/components/IOC/IOCDetailAdmin/IOCDetailAdmin.jsx b/src/components/IOC/IOCDetailAdmin/IOCDetailAdmin.jsx index 5b07764c..65e5d081 100644 --- a/src/components/IOC/IOCDetailAdmin/IOCDetailAdmin.jsx +++ b/src/components/IOC/IOCDetailAdmin/IOCDetailAdmin.jsx @@ -11,7 +11,7 @@ import { Alert } from "@mui/material"; import { useTypingTimer } from "../../common/SearchBoxFilter/TypingTimer"; -import AccessControl from "../../auth/AccessControl"; +import { AccessControl } from "../../auth/AccessControl"; import { apiContext } from "../../../api/DeployApi"; const createRequestParams = (query) => { @@ -20,13 +20,13 @@ const createRequestParams = (query) => { }; }; -export default function IOCDetailAdmin({ +export const IOCDetailAdmin = ({ ioc, getIOC, resetTab, buttonDisabled, setButtonDisabled -}) { +}) => { const [gitId, setGitId] = useState(ioc.gitProjectId); const [nameQuery, onNameKeyUp] = useTypingTimer({ interval: 500 }); const [repoQuery, onRepoKeyUp] = useTypingTimer({ interval: 500 }); @@ -346,4 +346,4 @@ export default function IOCDetailAdmin({ </Box> </> ); -} +}; diff --git a/src/components/IOC/IOCDetailAdmin/index.js b/src/components/IOC/IOCDetailAdmin/index.js index ceb065fd..2e05ebf7 100644 --- a/src/components/IOC/IOCDetailAdmin/index.js +++ b/src/components/IOC/IOCDetailAdmin/index.js @@ -1,4 +1,3 @@ -import IOCDetailAdmin from "./IOCDetailAdmin"; +import { IOCDetailAdmin } from "./IOCDetailAdmin"; export { IOCDetailAdmin }; -export default IOCDetailAdmin; diff --git a/src/components/IOC/IOCDetails/IOCDetails.jsx b/src/components/IOC/IOCDetails/IOCDetails.jsx index 79f7269a..c9289725 100644 --- a/src/components/IOC/IOCDetails/IOCDetails.jsx +++ b/src/components/IOC/IOCDetails/IOCDetails.jsx @@ -7,7 +7,7 @@ import { AlertBannerList } from "@ess-ics/ce-ui-common"; import { IOCStatus } from "../IOCStatus"; -import AccessControl from "../../auth/AccessControl"; +import { AccessControl } from "../../auth/AccessControl"; const defaultSubset = ({ name, diff --git a/src/components/IOC/IOCLiveStatus/IOCLiveStatus.jsx b/src/components/IOC/IOCLiveStatus/IOCLiveStatus.jsx index 73698a33..6201c5f6 100644 --- a/src/components/IOC/IOCLiveStatus/IOCLiveStatus.jsx +++ b/src/components/IOC/IOCLiveStatus/IOCLiveStatus.jsx @@ -9,7 +9,7 @@ import { IOCDetails } from "../IOCDetails"; import { LokiPanel } from "../../common/Loki/LokiPanel"; import { RecordSearch } from "../../records/RecordSearch"; import { GitRefLink } from "../../common/Git/GitRefLink"; -import AccessControl from "../../auth/AccessControl"; +import { AccessControl } from "../../auth/AccessControl"; import { useSearchParams } from "react-router-dom"; export function IOCLiveStatus({ ioc }) { diff --git a/src/components/IOC/IOCManage/IOCManage.jsx b/src/components/IOC/IOCManage/IOCManage.jsx index 87f127ba..d49ffad3 100644 --- a/src/components/IOC/IOCManage/IOCManage.jsx +++ b/src/components/IOC/IOCManage/IOCManage.jsx @@ -9,7 +9,7 @@ import { ExternalLink, InternalLink } from "@ess-ics/ce-ui-common"; -import AccessControl from "../../auth/AccessControl"; +import { AccessControl } from "../../auth/AccessControl"; import { DeploymentStatus } from "../../../api/DataTypes"; import { IOCService } from "../IOCService"; import { JobTable } from "../../Job"; diff --git a/src/components/IOC/IOCService/IOCService.jsx b/src/components/IOC/IOCService/IOCService.jsx index dfb89e12..72d5e106 100644 --- a/src/components/IOC/IOCService/IOCService.jsx +++ b/src/components/IOC/IOCService/IOCService.jsx @@ -9,7 +9,7 @@ import { useState, useEffect, useCallback } from "react"; import { ConfirmationDialog } from "@ess-ics/ce-ui-common"; import Alert from "@mui/material/Alert"; import { initRequestParams } from "../../common/Helper"; -import AccessControl from "../../auth/AccessControl"; +import { AccessControl } from "../../auth/AccessControl"; import { useNavigate } from "react-router-dom"; import { useStartJobMutation } from "../../../store/deployApi"; import { getErrorMessage } from "../../common/Alerts/AlertsData"; diff --git a/src/components/IOC/IOCTable/IOCTable.jsx b/src/components/IOC/IOCTable/IOCTable.jsx index 57544295..26c289b1 100644 --- a/src/components/IOC/IOCTable/IOCTable.jsx +++ b/src/components/IOC/IOCTable/IOCTable.jsx @@ -134,13 +134,13 @@ function createTableRowForExploreIocs(ioc) { }; } -export function IOCTable({ +export const IOCTable = ({ iocs, rowType = "explore", loading, pagination, onPage -}) { +}) => { const tableTypeSpecifics = { host: [hostDetailsColumns, createTableRowForHostDetails], explore: [exploreIocsColumns, createTableRowForExploreIocs] @@ -159,4 +159,4 @@ export function IOCTable({ disableHover /> ); -} +}; diff --git a/src/components/IOC/IOCTable/index.js b/src/components/IOC/IOCTable/index.js index ff82ea63..67893b41 100644 --- a/src/components/IOC/IOCTable/index.js +++ b/src/components/IOC/IOCTable/index.js @@ -1,4 +1,3 @@ import { IOCTable } from "./IOCTable"; export { IOCTable }; -export default IOCTable; diff --git a/src/components/auth/AccessControl/AccessControl.jsx b/src/components/auth/AccessControl/AccessControl.jsx index 27511dc6..12346962 100644 --- a/src/components/auth/AccessControl/AccessControl.jsx +++ b/src/components/auth/AccessControl/AccessControl.jsx @@ -1,6 +1,6 @@ import { useContext } from "react"; import { userContext } from "@ess-ics/ce-ui-common"; -import AccessDenied from "../AccessDenied"; +import { AccessDenied } from "../AccessDenied"; const checkPermissions = (userRoles, allowedRoles) => { if (allowedRoles.length === 0) { @@ -22,12 +22,12 @@ const checkUser = (user, userRoles, allowedUsersWithRoles) => { ); }; -export default function AccessControl({ +export const AccessControl = ({ allowedRoles, allowedUsersWithRoles, children, renderNoAccess -}) { +}) => { const { user, userRoles } = useContext(userContext); const permitted = @@ -40,4 +40,4 @@ export default function AccessControl({ return <AccessDenied />; } return renderNoAccess(); -} +}; diff --git a/src/components/auth/AccessControl/index.js b/src/components/auth/AccessControl/index.js index 1b9542b3..cfe914a9 100644 --- a/src/components/auth/AccessControl/index.js +++ b/src/components/auth/AccessControl/index.js @@ -1,4 +1,3 @@ -import AccessControl from "./AccessControl"; +import { AccessControl } from "./AccessControl"; export { AccessControl }; -export default AccessControl; diff --git a/src/components/auth/AccessDenied/AccessDenied.jsx b/src/components/auth/AccessDenied/AccessDenied.jsx index 644053bc..22f41e48 100644 --- a/src/components/auth/AccessDenied/AccessDenied.jsx +++ b/src/components/auth/AccessDenied/AccessDenied.jsx @@ -1,7 +1,7 @@ import { ServerErrorPage } from "@ess-ics/ce-ui-common"; import env from "../../../config/env"; -export default function AccessDenied() { +export const AccessDenied = () => { return ( <ServerErrorPage message="You do not have permission to access this page. Please contact an administrator to request access" @@ -9,4 +9,4 @@ export default function AccessDenied() { supportHref={env.SUPPORT_URL} /> ); -} +}; diff --git a/src/components/auth/AccessDenied/index.js b/src/components/auth/AccessDenied/index.js index 69a86dc0..e07b1c4c 100644 --- a/src/components/auth/AccessDenied/index.js +++ b/src/components/auth/AccessDenied/index.js @@ -1,4 +1,3 @@ -import AccessDenied from "./AccessDenied"; +import { AccessDenied } from "./AccessDenied"; export { AccessDenied }; -export default AccessDenied; diff --git a/src/components/auth/TokenRenew/TokenRenew.jsx b/src/components/auth/TokenRenew/TokenRenew.jsx index 7524be8f..833e451c 100644 --- a/src/components/auth/TokenRenew/TokenRenew.jsx +++ b/src/components/auth/TokenRenew/TokenRenew.jsx @@ -3,7 +3,7 @@ import { apiContext } from "../../../api/DeployApi"; import { userContext, useAPIMethod, usePolling } from "@ess-ics/ce-ui-common"; import env from "../../../config/env"; -export default function TokenRenew() { +export const TokenRenew = () => { const { user } = useContext(userContext); const client = useContext(apiContext); @@ -29,4 +29,4 @@ export default function TokenRenew() { usePolling(renewTokenWhenLoggedIn, loading, env.TOKEN_RENEW_INTERVAL, abort); return null; -} +}; diff --git a/src/components/auth/TokenRenew/index.js b/src/components/auth/TokenRenew/index.js index 8c42ce86..f5e3069c 100644 --- a/src/components/auth/TokenRenew/index.js +++ b/src/components/auth/TokenRenew/index.js @@ -1,4 +1,3 @@ -import TokenRenew from "./TokenRenew"; +import { TokenRenew } from "./TokenRenew"; export { TokenRenew }; -export default TokenRenew; diff --git a/src/components/common/Popover/index.js b/src/components/common/Popover/index.js index 7dca380e..0ecb05cc 100644 --- a/src/components/common/Popover/index.js +++ b/src/components/common/Popover/index.js @@ -1,4 +1,3 @@ import { Popover } from "./Popover"; export { Popover }; -export default Popover; diff --git a/src/components/common/Status/Status.jsx b/src/components/common/Status/Status.jsx index 9c45ef85..8d26d900 100644 --- a/src/components/common/Status/Status.jsx +++ b/src/components/common/Status/Status.jsx @@ -1,6 +1,6 @@ import { useState, useEffect } from "react"; import { LabeledIcon } from "@ess-ics/ce-ui-common"; -import Popover from "../../common/Popover"; +import { Popover } from "../../common/Popover"; import { object, bool, array, func } from "prop-types"; import { useTheme, Skeleton } from "@mui/material"; import { PlayCircleFilled, PauseCircleFilled } from "@mui/icons-material"; diff --git a/src/components/navigation/Menu/MenuDrawer.jsx b/src/components/navigation/Menu/MenuDrawer.jsx index 4bb4efc6..65365f24 100644 --- a/src/components/navigation/Menu/MenuDrawer.jsx +++ b/src/components/navigation/Menu/MenuDrawer.jsx @@ -1,5 +1,5 @@ import { styled } from "@mui/material/styles"; -import clsx from "clsx"; +import { clsx } from "clsx"; import { Container, Drawer, diff --git a/src/components/navigation/Menu/index.js b/src/components/navigation/Menu/index.js index 37107386..19f7df62 100644 --- a/src/components/navigation/Menu/index.js +++ b/src/components/navigation/Menu/index.js @@ -1,4 +1,3 @@ import { MenuDrawer } from "./MenuDrawer"; export { MenuDrawer }; -export default MenuDrawer; diff --git a/src/components/navigation/NavigationMenu/CreateIOCButton.jsx b/src/components/navigation/NavigationMenu/CreateIOCButton.jsx index b531ab33..55c5fba1 100644 --- a/src/components/navigation/NavigationMenu/CreateIOCButton.jsx +++ b/src/components/navigation/NavigationMenu/CreateIOCButton.jsx @@ -2,7 +2,7 @@ import { useContext } from "react"; import { userContext, IconMenuButton } from "@ess-ics/ce-ui-common"; import { useNavigate } from "react-router-dom"; -export function CreateIOCButton() { +export const CreateIOCButton = () => { const { user } = useContext(userContext); const navigate = useNavigate(); @@ -16,4 +16,4 @@ export function CreateIOCButton() { }; return user ? <IconMenuButton {...iconMenuButtonProps} /> : null; -} +}; diff --git a/src/components/navigation/NavigationMenu/LoginControls.jsx b/src/components/navigation/NavigationMenu/LoginControls.jsx index 77d58a68..066e67fc 100644 --- a/src/components/navigation/NavigationMenu/LoginControls.jsx +++ b/src/components/navigation/NavigationMenu/LoginControls.jsx @@ -14,7 +14,7 @@ const propTypes = { user: string }; -export function ProfileMenu({ user }) { +export const ProfileMenu = ({ user }) => { const { userRoles, logout } = useContext(userContext); const navigate = useNavigate(); @@ -66,9 +66,9 @@ export function ProfileMenu({ user }) { }; return <IconMenuButton {...profileMenuProps} />; -} +}; -export function LoginControls() { +export const LoginControls = () => { const [loginFormOpen, setLoginFormOpen] = useState(false); const { user, login, loginError, resetLoginError } = useContext(userContext); const userRef = useRef(user); @@ -116,6 +116,6 @@ export function LoginControls() { /> </> ); -} +}; ProfileMenu.propTypes = propTypes.menuListItem; diff --git a/src/components/navigation/NavigationMenu/NavigationMenu.jsx b/src/components/navigation/NavigationMenu/NavigationMenu.jsx index f970a82e..2402dedd 100644 --- a/src/components/navigation/NavigationMenu/NavigationMenu.jsx +++ b/src/components/navigation/NavigationMenu/NavigationMenu.jsx @@ -92,7 +92,7 @@ const menuItemsAll = [ makeLink("Log", "/jobs", <Assignment />) ]; -const NavigationMenu = ({ children }) => { +export const NavigationMenu = ({ children }) => { const [drawerOpen, setDrawerOpen] = useState(false); const navigate = useNavigate(); const goHome = () => { @@ -175,5 +175,3 @@ const NavigationMenu = ({ children }) => { </GlobalAppBar> ); }; - -export default NavigationMenu; diff --git a/src/components/navigation/NavigationMenu/index.js b/src/components/navigation/NavigationMenu/index.js index e7d2ee67..c8a03a5c 100644 --- a/src/components/navigation/NavigationMenu/index.js +++ b/src/components/navigation/NavigationMenu/index.js @@ -1,4 +1,3 @@ -import NavigationMenu from "./NavigationMenu"; +import { NavigationMenu } from "./NavigationMenu"; export { NavigationMenu }; -export default NavigationMenu; diff --git a/src/components/navigation/NotFoundView/NotFoundView.tsx b/src/components/navigation/NotFoundView/NotFoundView.tsx index 24403598..1571c4db 100644 --- a/src/components/navigation/NotFoundView/NotFoundView.tsx +++ b/src/components/navigation/NotFoundView/NotFoundView.tsx @@ -11,7 +11,7 @@ interface NotFoundProps { status: string; } -export default function NotFoundView({ message, status }: NotFoundProps) { +export const NotFoundView = ({ message, status }: NotFoundProps) => { return ( <RootPaper> <ServerErrorPage @@ -21,7 +21,7 @@ export default function NotFoundView({ message, status }: NotFoundProps) { /> </RootPaper> ); -} +}; NotFoundView.defaultProps = { status: "404" diff --git a/src/components/navigation/NotFoundView/index.ts b/src/components/navigation/NotFoundView/index.ts index b21b7fdb..296f5c0d 100644 --- a/src/components/navigation/NotFoundView/index.ts +++ b/src/components/navigation/NotFoundView/index.ts @@ -1,4 +1,3 @@ -import NotFoundView from "./NotFoundView"; +import { NotFoundView } from "./NotFoundView"; export { NotFoundView }; -export default NotFoundView; diff --git a/src/mocks/AppHarness.jsx b/src/mocks/AppHarness.jsx index 51b59a7c..e9ee04aa 100644 --- a/src/mocks/AppHarness.jsx +++ b/src/mocks/AppHarness.jsx @@ -3,7 +3,7 @@ import { Container, CssBaseline, StyledEngineProvider } from "@mui/material"; import { ThemeProvider } from "@mui/material/styles"; import { theme } from "../style/Theme"; import { UserProvider } from "../api/UserProvider"; -import NavigationMenu from "../components/navigation/NavigationMenu"; +import { NavigationMenu } from "../components/navigation/NavigationMenu"; import { MemoryRouter } from "react-router-dom"; import { DeployAPIProvider } from "../api/APIProvider"; import { TestUserProvider, UserImpersonator } from "./UserImpersonator"; diff --git a/src/stories/views/Navigation/NotFoundView.stories.jsx b/src/stories/views/Navigation/NotFoundView.stories.jsx index 6863c398..22f3139b 100644 --- a/src/stories/views/Navigation/NotFoundView.stories.jsx +++ b/src/stories/views/Navigation/NotFoundView.stories.jsx @@ -1,5 +1,5 @@ import { AppHarness } from "../../../mocks/AppHarness"; -import NotFoundView from "../../../components/navigation/NotFoundView"; +import { NotFoundView } from "../../../components/navigation/NotFoundView"; export default { title: "Views/Navigation/NotFoundView" diff --git a/src/typings.d.ts b/src/typings.d.ts index 054cc31c..0a50ac47 100644 --- a/src/typings.d.ts +++ b/src/typings.d.ts @@ -1,9 +1,9 @@ declare module "@ess-ics/ce-ui-common"; declare module "*.svg" { - import { FunctionComponent, SVGProps, SVGSVGElement } from "react"; + import { FunctionComponent, SVGAttributes } from "react"; export const ReactComponent: FunctionComponent< - SVGProps<SVGSVGElement> & { title?: string } + Element<SVGAttributes> & { title?: string } >; const content: string; export default content; diff --git a/src/views/IOC/IOCDetailsAccessControl.jsx b/src/views/IOC/IOCDetailsAccessControl.jsx index 7712fe25..c2e57ad0 100644 --- a/src/views/IOC/IOCDetailsAccessControl.jsx +++ b/src/views/IOC/IOCDetailsAccessControl.jsx @@ -1,5 +1,5 @@ import { RootPaper } from "@ess-ics/ce-ui-common"; -import AccessControl from "../../components/auth/AccessControl"; +import { AccessControl } from "../../components/auth/AccessControl"; import { IOCDetailsContainer } from "./IOCDetailsContainer"; import { useParams } from "react-router-dom"; diff --git a/src/views/IOC/IOCDetailsContainer.jsx b/src/views/IOC/IOCDetailsContainer.jsx index b8e38f54..c1aff221 100644 --- a/src/views/IOC/IOCDetailsContainer.jsx +++ b/src/views/IOC/IOCDetailsContainer.jsx @@ -1,7 +1,7 @@ import { useEffect, useContext, useState, useMemo } from "react"; import { IOCDetailsView } from "./IOCDetailsView"; import { LinearProgress } from "@mui/material"; -import NotFoundView from "../../components/navigation/NotFoundView/NotFoundView"; +import { NotFoundView } from "../../components/navigation/NotFoundView/NotFoundView"; import { onFetchEntityError } from "../../components/common/Helper"; import { useAPIMethod } from "@ess-ics/ce-ui-common"; import { apiContext } from "../../api/DeployApi"; diff --git a/src/views/IOC/IOCDetailsView.jsx b/src/views/IOC/IOCDetailsView.jsx index 7e3da872..98d8a077 100644 --- a/src/views/IOC/IOCDetailsView.jsx +++ b/src/views/IOC/IOCDetailsView.jsx @@ -4,7 +4,7 @@ import { useCallback, useContext, useEffect, useMemo, useState } from "react"; import { IOCLiveStatus } from "../../components/IOC/IOCLiveStatus"; import { IOCManage } from "../../components/IOC/IOCManage"; import { useNavigate } from "react-router-dom"; -import IOCAdmin from "../../components/IOC/IOCAdmin"; +import { IOCAdmin } from "../../components/IOC/IOCAdmin"; import { applicationTitle, initRequestParams diff --git a/src/views/IOC/IOCListView.tsx b/src/views/IOC/IOCListView.tsx index 1d5d8ed1..b7acf9f1 100644 --- a/src/views/IOC/IOCListView.tsx +++ b/src/views/IOC/IOCListView.tsx @@ -14,7 +14,7 @@ import { useSearchParams } from "react-router-dom"; import { GlobalAppBarContext, OnPageParams } from "../../types/common"; import { ApiAlertError } from "../../components/common/Alerts/ApiAlertError"; import { Container, Grid, Tabs, Tab } from "@mui/material"; -import IOCTable from "../../components/IOC/IOCTable"; +import { IOCTable } from "../../components/IOC/IOCTable"; import { ROWS_PER_PAGE } from "../../constants"; export const IOCListView = () => { diff --git a/src/views/UserPage/UserDetailsAccessControl.jsx b/src/views/UserPage/UserDetailsAccessControl.jsx index fc47f6c6..a919e320 100644 --- a/src/views/UserPage/UserDetailsAccessControl.jsx +++ b/src/views/UserPage/UserDetailsAccessControl.jsx @@ -1,5 +1,5 @@ import { RootPaper } from "@ess-ics/ce-ui-common"; -import AccessControl from "../../components/auth/AccessControl"; +import { AccessControl } from "../../components/auth/AccessControl"; import { UserDetailsContainer } from "./UserDetailsContainer"; export function UserDetailsAccessControl() { diff --git a/src/views/UserPage/UserDetailsContainer.jsx b/src/views/UserPage/UserDetailsContainer.jsx index df888bda..7ef664c5 100644 --- a/src/views/UserPage/UserDetailsContainer.jsx +++ b/src/views/UserPage/UserDetailsContainer.jsx @@ -1,7 +1,7 @@ import { useContext, useEffect, useMemo, useState } from "react"; import { UserPageView } from "./UserPageView"; import { LinearProgress } from "@mui/material"; -import NotFoundView from "../../components/navigation/NotFoundView/NotFoundView"; +import { NotFoundView } from "../../components/navigation/NotFoundView/NotFoundView"; import { useParams } from "react-router-dom"; import { userContext, useAPIMethod } from "@ess-ics/ce-ui-common"; import { apiContext } from "../../api/DeployApi"; diff --git a/src/views/host/details/HostDetailsAccessControl.jsx b/src/views/host/details/HostDetailsAccessControl.jsx index 2bb2fbaa..5f6ba4cb 100644 --- a/src/views/host/details/HostDetailsAccessControl.jsx +++ b/src/views/host/details/HostDetailsAccessControl.jsx @@ -1,5 +1,5 @@ import { RootPaper } from "@ess-ics/ce-ui-common"; -import AccessControl from "../../../components/auth/AccessControl"; +import { AccessControl } from "../../../components/auth/AccessControl"; import { HostDetailsContainer } from "./HostDetailsContainer"; import { useParams } from "react-router-dom"; diff --git a/src/views/host/details/HostDetailsContainer.jsx b/src/views/host/details/HostDetailsContainer.jsx index 6d066eef..5a39b086 100644 --- a/src/views/host/details/HostDetailsContainer.jsx +++ b/src/views/host/details/HostDetailsContainer.jsx @@ -2,7 +2,7 @@ import { useState, useMemo, useContext, useEffect } from "react"; import { HostDetailsView } from "./HostDetailsView"; import { LinearProgress } from "@mui/material"; import { onFetchEntityError } from "../../../components/common/Helper"; -import NotFoundView from "../../../components/navigation/NotFoundView/NotFoundView"; +import { NotFoundView } from "../../../components/navigation/NotFoundView/NotFoundView"; import { apiContext } from "../../../api/DeployApi"; import { useAPIMethod } from "@ess-ics/ce-ui-common"; diff --git a/src/views/host/details/HostDetailsView.jsx b/src/views/host/details/HostDetailsView.jsx index 325ea578..3150e91e 100644 --- a/src/views/host/details/HostDetailsView.jsx +++ b/src/views/host/details/HostDetailsView.jsx @@ -11,7 +11,7 @@ import { import { LokiPanel } from "../../../components/common/Loki/LokiPanel"; import { useNavigate } from "react-router-dom"; import { applicationTitle } from "../../../components/common/Helper"; -import AccessControl from "../../../components/auth/AccessControl"; +import { AccessControl } from "../../../components/auth/AccessControl"; import { HostDetailsTable } from "./HostDetailsTable"; import { HostStatus } from "../../../components/host/HostStatus"; import { HostJobsSection } from "./HostJobsSection"; diff --git a/src/views/host/details/HostIocSection.jsx b/src/views/host/details/HostIocSection.jsx index a19228f2..3e6402cb 100644 --- a/src/views/host/details/HostIocSection.jsx +++ b/src/views/host/details/HostIocSection.jsx @@ -1,5 +1,5 @@ import { useEffect, useContext, useCallback } from "react"; -import IOCTable from "../../../components/IOC/IOCTable"; +import { IOCTable } from "../../../components/IOC/IOCTable"; import { string } from "prop-types"; import { apiContext } from "../../../api/DeployApi"; import { Typography } from "@mui/material"; diff --git a/src/views/jobs/JobDetailsAccessControl.jsx b/src/views/jobs/JobDetailsAccessControl.jsx index b60bfd21..67810e66 100644 --- a/src/views/jobs/JobDetailsAccessControl.jsx +++ b/src/views/jobs/JobDetailsAccessControl.jsx @@ -1,5 +1,5 @@ import { RootPaper } from "@ess-ics/ce-ui-common"; -import AccessControl from "../../components/auth/AccessControl"; +import { AccessControl } from "../../components/auth/AccessControl"; import { JobDetailsContainer } from "./JobDetailsContainer"; import { useParams } from "react-router-dom"; diff --git a/src/views/jobs/JobDetailsContainer.jsx b/src/views/jobs/JobDetailsContainer.jsx index 4bc8bc56..52a92bcf 100644 --- a/src/views/jobs/JobDetailsContainer.jsx +++ b/src/views/jobs/JobDetailsContainer.jsx @@ -1,7 +1,7 @@ import { useState, useContext, useMemo, useEffect } from "react"; import { JobDetailsView } from "./JobDetailsView"; import { LinearProgress } from "@mui/material"; -import NotFoundView from "../../components/navigation/NotFoundView/NotFoundView"; +import { NotFoundView } from "../../components/navigation/NotFoundView/NotFoundView"; import { onFetchEntityError } from "../../components/common/Helper"; import { useAPIMethod, usePolling } from "@ess-ics/ce-ui-common"; import { apiContext } from "../../api/DeployApi"; diff --git a/src/views/jobs/JobLogAccessControl.jsx b/src/views/jobs/JobLogAccessControl.jsx index 8cc5b5d7..76ee9850 100644 --- a/src/views/jobs/JobLogAccessControl.jsx +++ b/src/views/jobs/JobLogAccessControl.jsx @@ -1,5 +1,5 @@ import { useContext, useEffect } from "react"; -import AccessControl from "../../components/auth/AccessControl"; +import { AccessControl } from "../../components/auth/AccessControl"; import { GlobalAppBarContext } from "@ess-ics/ce-ui-common"; import { JobListView } from "./JobListView"; import { applicationTitle } from "../../components/common/Helper"; diff --git a/src/views/records/RecordDetailsView.jsx b/src/views/records/RecordDetailsView.jsx index d6340fba..ea2895ce 100644 --- a/src/views/records/RecordDetailsView.jsx +++ b/src/views/records/RecordDetailsView.jsx @@ -16,7 +16,7 @@ import { onFetchEntityError } from "../../components/common/Helper"; import { useParams, useNavigate } from "react-router-dom"; -import NotFoundView from "../../components/navigation/NotFoundView/NotFoundView"; +import { NotFoundView } from "../../components/navigation/NotFoundView/NotFoundView"; import { apiContext } from "../../api/DeployApi"; -- GitLab