From 518968fa34702229deb5b65a363e40641c94974f Mon Sep 17 00:00:00 2001 From: Peter Makowski Date: Tue, 7 May 2024 10:59:53 +0200 Subject: [PATCH] chore: upgrade prettier to v3 (#5424) --- .prettierrc | 2 +- package.json | 4 +- .../DhcpFormFields/DhcpFormFields.tsx | 4 +- .../components/PageContent/PageContent.tsx | 8 +-- .../components/node/NodeLogs/hooks.test.tsx | 5 +- .../ControllerStatusCard.tsx | 4 +- src/app/base/hooks/base.test.tsx | 8 +-- src/app/base/hooks/node-networking.test.tsx | 5 +- src/app/base/hooks/node.test.tsx | 5 +- src/app/base/hooks/urls.test.tsx | 19 +++--- .../ServiceStatus/ServiceStatus.tsx | 8 +-- .../AddInterface/AddInterface.tsx | 5 +- .../EditInterface/EditInterface.tsx | 5 +- src/app/intro/hooks.test.tsx | 5 +- .../components/VfResources/VfResources.tsx | 2 +- src/app/kvm/hooks.test.tsx | 11 ++-- src/app/machines/hooks.test.tsx | 5 +- .../MachineTests/MachineTests.tsx | 2 +- .../AllCheckbox/AllCheckbox.tsx | 4 +- .../GroupCheckbox/GroupCheckbox.tsx | 4 +- src/app/machines/views/MachineList/hooks.ts | 2 +- src/app/settings/hooks.test.tsx | 5 +- src/app/store/general/types/base.ts | 10 +-- src/app/store/general/utils/hooks.test.tsx | 5 +- src/app/store/machine/utils/hooks.test.tsx | 40 +++++++----- src/app/store/machine/utils/hooks.tsx | 6 +- src/app/store/subnet/hooks.test.tsx | 5 +- src/app/store/utils/selectors.ts | 4 +- src/app/store/utils/slice.ts | 8 +-- src/app/utils/formatErrors.ts | 2 +- src/app/utils/search/filter-items.ts | 2 +- src/testing/utils.tsx | 5 +- yarn.lock | 62 +++++++++---------- 33 files changed, 139 insertions(+), 132 deletions(-) diff --git a/.prettierrc b/.prettierrc index 0967ef424b..7e20cbf938 100644 --- a/.prettierrc +++ b/.prettierrc @@ -1 +1 @@ -{} +{"trailingComma": "es5"} diff --git a/package.json b/package.json index 9b16563986..963e36bb5d 100644 --- a/package.json +++ b/package.json @@ -132,7 +132,7 @@ "eslint-plugin-cypress": "2.15.2", "eslint-plugin-no-only-tests": "3.1.0", "eslint-plugin-playwright": "1.6.0", - "eslint-plugin-prettier": "4.2.1", + "eslint-plugin-prettier": "5.1.3", "eslint-plugin-storybook": "0.8.0", "eslint-plugin-unused-imports": "3.1.0", "formik-devtools-extension": "0.1.8", @@ -145,7 +145,7 @@ "nodemon": "3.1.0", "npm-package-json-lint": "7.1.0", "postcss-normalize": "10.0.1", - "prettier": "2.8.8", + "prettier": "3.2.5", "redux-mock-store": "1.5.4", "redux-saga-test-plan": "4.0.6", "sass": "1.75.0", diff --git a/src/app/base/components/DhcpFormFields/DhcpFormFields.tsx b/src/app/base/components/DhcpFormFields/DhcpFormFields.tsx index 00ec7327ab..f711e0f6c8 100644 --- a/src/app/base/components/DhcpFormFields/DhcpFormFields.tsx +++ b/src/app/base/components/DhcpFormFields/DhcpFormFields.tsx @@ -58,8 +58,8 @@ const generateOptions = ( type === "iprange" && "start_ip" in model ? `${model?.start_ip} - ${model?.end_ip}` : type === "subnet" - ? ("name" in model && model.name) || "" - : ("fqdn" in model && model.fqdn) || "", + ? ("name" in model && model.name) || "" + : ("fqdn" in model && model.fqdn) || "", })) ) : null; diff --git a/src/app/base/components/PageContent/PageContent.tsx b/src/app/base/components/PageContent/PageContent.tsx index dd5efba575..853b9e388b 100644 --- a/src/app/base/components/PageContent/PageContent.tsx +++ b/src/app/base/components/PageContent/PageContent.tsx @@ -55,15 +55,15 @@ const PageContent = ({ isSettingsPage ? settingsNavItems : isPreferencesPage - ? preferencesNavItems - : [] + ? preferencesNavItems + : [] } title={ isSettingsPage ? "Settings" : isPreferencesPage - ? "My preferences" - : "" + ? "My preferences" + : "" } /> diff --git a/src/app/base/components/node/NodeLogs/hooks.test.tsx b/src/app/base/components/node/NodeLogs/hooks.test.tsx index a1e577eb1a..187250f776 100644 --- a/src/app/base/components/node/NodeLogs/hooks.test.tsx +++ b/src/app/base/components/node/NodeLogs/hooks.test.tsx @@ -19,8 +19,9 @@ const mockStore = configureStore(); const generateWrapper = (store: MockStoreEnhanced) => - ({ children }: { children: ReactNode }) => - {children}; + ({ children }: { children: ReactNode }) => ( + {children} + ); describe("machine utils", () => { let state: RootState; diff --git a/src/app/base/components/node/OverviewCard/ControllerStatusCard/ControllerStatusCard.tsx b/src/app/base/components/node/OverviewCard/ControllerStatusCard/ControllerStatusCard.tsx index 35a5b5fdaf..6d1f3bea88 100644 --- a/src/app/base/components/node/OverviewCard/ControllerStatusCard/ControllerStatusCard.tsx +++ b/src/app/base/components/node/OverviewCard/ControllerStatusCard/ControllerStatusCard.tsx @@ -56,8 +56,8 @@ const getImageSyncStatus = ( !status ? Labels.NoStatus : checkingImages - ? Labels.CheckingImages - : status + ? Labels.CheckingImages + : status } /> ); diff --git a/src/app/base/hooks/base.test.tsx b/src/app/base/hooks/base.test.tsx index 28270656e1..e9b432af01 100644 --- a/src/app/base/hooks/base.test.tsx +++ b/src/app/base/hooks/base.test.tsx @@ -64,7 +64,7 @@ describe("useScrollOnRender", () => { html.scrollTop = 10; } const { result } = renderHook(() => useScrollOnRender()); - targetNode.getBoundingClientRect = () => ({ y: 10 } as DOMRect); + targetNode.getBoundingClientRect = () => ({ y: 10 }) as DOMRect; result.current(targetNode); expect(scrollToSpy).not.toHaveBeenCalled(); }); @@ -74,7 +74,7 @@ describe("useScrollOnRender", () => { html.scrollTop = 100; } const { result } = renderHook(() => useScrollOnRender()); - targetNode.getBoundingClientRect = () => ({ y: 1000 } as DOMRect); + targetNode.getBoundingClientRect = () => ({ y: 1000 }) as DOMRect; result.current(targetNode); expect(scrollToSpy).toHaveBeenCalledWith({ top: 1000, @@ -88,7 +88,7 @@ describe("useScrollOnRender", () => { html.scrollTop = 1000; } const { result } = renderHook(() => useScrollOnRender()); - targetNode.getBoundingClientRect = () => ({ y: 10 } as DOMRect); + targetNode.getBoundingClientRect = () => ({ y: 10 }) as DOMRect; result.current(targetNode); expect(scrollToSpy).toHaveBeenCalledWith({ top: 10, @@ -103,7 +103,7 @@ describe("useScrollOnRender", () => { } const { result } = renderHook(() => useScrollOnRender()); targetNode.getBoundingClientRect = () => - ({ height: 400, y: 400 } as DOMRect); + ({ height: 400, y: 400 }) as DOMRect; result.current(targetNode); expect(scrollToSpy).toHaveBeenCalledWith({ top: 400, diff --git a/src/app/base/hooks/node-networking.test.tsx b/src/app/base/hooks/node-networking.test.tsx index da5a4ff7bb..868006757b 100644 --- a/src/app/base/hooks/node-networking.test.tsx +++ b/src/app/base/hooks/node-networking.test.tsx @@ -16,8 +16,9 @@ const mockStore = configureStore(); const generateWrapper = (store: MockStoreEnhanced) => - ({ children }: { children: ReactNode }) => - {children}; + ({ children }: { children: ReactNode }) => ( + {children} + ); describe("machine hook utils", () => { let state: RootState; diff --git a/src/app/base/hooks/node.test.tsx b/src/app/base/hooks/node.test.tsx index fafc55455a..ccd58d0259 100644 --- a/src/app/base/hooks/node.test.tsx +++ b/src/app/base/hooks/node.test.tsx @@ -24,8 +24,9 @@ const mockStore = configureStore(); const generateWrapper = (store: MockStoreEnhanced) => - ({ children }: { children: ReactNode }) => - {children}; + ({ children }: { children: ReactNode }) => ( + {children} + ); describe("node hooks", () => { describe("useIsRackControllerConnected", () => { diff --git a/src/app/base/hooks/urls.test.tsx b/src/app/base/hooks/urls.test.tsx index 0d96beecde..0f6cb484e5 100644 --- a/src/app/base/hooks/urls.test.tsx +++ b/src/app/base/hooks/urls.test.tsx @@ -13,16 +13,15 @@ const mockStore = configureStore(); const generateWrapper = (pathname: string, route: string) => - ({ children }: { children: ReactNode }) => - ( - - - - {children}} path={route} /> - - - - ); + ({ children }: { children: ReactNode }) => ( + + + + {children}} path={route} /> + + + + ); describe("url hooks", () => { describe("useGetURLId", () => { diff --git a/src/app/controllers/views/ControllerDetails/ControllerSummary/ServicesCard/ServiceStatus/ServiceStatus.tsx b/src/app/controllers/views/ControllerDetails/ControllerSummary/ServicesCard/ServiceStatus/ServiceStatus.tsx index 88ab601241..bbf5684158 100644 --- a/src/app/controllers/views/ControllerDetails/ControllerSummary/ServicesCard/ServiceStatus/ServiceStatus.tsx +++ b/src/app/controllers/views/ControllerDetails/ControllerSummary/ServicesCard/ServiceStatus/ServiceStatus.tsx @@ -13,10 +13,10 @@ const ServiceStatus = ({ service }: Props): JSX.Element => { service.status === ServiceStatusType.RUNNING ? "success" : service.status === ServiceStatusType.DEAD - ? "error" - : service.status === ServiceStatusType.DEGRADED - ? "warning" - : null; + ? "error" + : service.status === ServiceStatusType.DEGRADED + ? "warning" + : null; return ( diff --git a/src/app/devices/views/DeviceDetails/DeviceNetwork/AddInterface/AddInterface.tsx b/src/app/devices/views/DeviceDetails/DeviceNetwork/AddInterface/AddInterface.tsx index b9e25ace17..d722040925 100644 --- a/src/app/devices/views/DeviceDetails/DeviceNetwork/AddInterface/AddInterface.tsx +++ b/src/app/devices/views/DeviceDetails/DeviceNetwork/AddInterface/AddInterface.tsx @@ -32,9 +32,8 @@ const AddInterface = ({ closeForm, systemId }: Props): JSX.Element => { useSelector((state: RootState) => deviceSelectors.eventErrorsForDevices(state, systemId, "createInterface") ).length > 0; - const [createdInterface, resetCreatedInterface] = useCycled( - !creatingInterface - ); + const [createdInterface, resetCreatedInterface] = + useCycled(!creatingInterface); const saved = createdInterface && !createInterfaceErrored; const onRenderRef = useScrollOnRender(); diff --git a/src/app/devices/views/DeviceDetails/DeviceNetwork/EditInterface/EditInterface.tsx b/src/app/devices/views/DeviceDetails/DeviceNetwork/EditInterface/EditInterface.tsx index e00978c724..2846f75bec 100644 --- a/src/app/devices/views/DeviceDetails/DeviceNetwork/EditInterface/EditInterface.tsx +++ b/src/app/devices/views/DeviceDetails/DeviceNetwork/EditInterface/EditInterface.tsx @@ -46,9 +46,8 @@ const EditInterface = ({ useSelector((state: RootState) => deviceSelectors.eventErrorsForDevices(state, systemId, "updateInterface") ).length > 0; - const [updatedInterface, resetUpdatedInterface] = useCycled( - !updatingInterface - ); + const [updatedInterface, resetUpdatedInterface] = + useCycled(!updatingInterface); const saved = updatedInterface && !updateInterfaceErrored; if (!isDeviceDetails(device) || !nic) { return ; diff --git a/src/app/intro/hooks.test.tsx b/src/app/intro/hooks.test.tsx index a6cbf4a24f..a8fb5ab9e3 100644 --- a/src/app/intro/hooks.test.tsx +++ b/src/app/intro/hooks.test.tsx @@ -15,8 +15,9 @@ const mockStore = configureStore(); const generateWrapper = (store: MockStoreEnhanced) => - ({ children }: { children: ReactNode }) => - {children}; + ({ children }: { children: ReactNode }) => ( + {children} + ); describe("hooks", () => { let state: RootState; diff --git a/src/app/kvm/components/VfResources/VfResources.tsx b/src/app/kvm/components/VfResources/VfResources.tsx index 04c77a17b6..ddcdbdfaa4 100644 --- a/src/app/kvm/components/VfResources/VfResources.tsx +++ b/src/app/kvm/components/VfResources/VfResources.tsx @@ -23,7 +23,7 @@ const VfResources = ({ [ PodResource["allocated_tracked"], PodResource["free"], - PodResource["allocated_other"] + PodResource["allocated_other"], ] >( ([allocated, free, other], { virtual_functions }) => { diff --git a/src/app/kvm/hooks.test.tsx b/src/app/kvm/hooks.test.tsx index 9767ae20fb..90aef72195 100644 --- a/src/app/kvm/hooks.test.tsx +++ b/src/app/kvm/hooks.test.tsx @@ -17,12 +17,11 @@ const mockStore = configureStore(); const generateWrapper = (store: MockStoreEnhanced, pathname = "") => - ({ children }: { children: ReactNode }) => - ( - - {children} - - ); + ({ children }: { children: ReactNode }) => ( + + {children} + + ); describe("kvm hooks", () => { describe("useActivePod", () => { diff --git a/src/app/machines/hooks.test.tsx b/src/app/machines/hooks.test.tsx index 169a69e528..f296616897 100644 --- a/src/app/machines/hooks.test.tsx +++ b/src/app/machines/hooks.test.tsx @@ -19,8 +19,9 @@ vi.mock("@canonical/react-components/dist/hooks", () => ({ const generateWrapper = (store: MockStoreEnhanced) => - ({ children }: { children: ReactNode }) => - {children}; + ({ children }: { children: ReactNode }) => ( + {children} + ); describe("machine utils", () => { let state: RootState; diff --git a/src/app/machines/views/MachineDetails/MachineTests/MachineTests.tsx b/src/app/machines/views/MachineDetails/MachineTests/MachineTests.tsx index 806fa6eb41..9e0cf2cbdc 100644 --- a/src/app/machines/views/MachineDetails/MachineTests/MachineTests.tsx +++ b/src/app/machines/views/MachineDetails/MachineTests/MachineTests.tsx @@ -116,7 +116,7 @@ const MachineTests = (): JSX.Element => { ).map( ([physical_blockdevice, scriptResults]: [ string, - ScriptResult[] + ScriptResult[], ]) => { const { model, name, serial } = scriptResults[0]?.parameters?.storage?.value || {}; diff --git a/src/app/machines/views/MachineList/MachineListTable/AllCheckbox/AllCheckbox.tsx b/src/app/machines/views/MachineList/MachineListTable/AllCheckbox/AllCheckbox.tsx index 2b4f44c319..8a816c2c03 100644 --- a/src/app/machines/views/MachineList/MachineListTable/AllCheckbox/AllCheckbox.tsx +++ b/src/app/machines/views/MachineList/MachineListTable/AllCheckbox/AllCheckbox.tsx @@ -38,8 +38,8 @@ const AllCheckbox = ({ callId, filter }: Props): JSX.Element => { allSelected ? Checked.Checked : someSelected - ? Checked.Mixed - : Checked.Unchecked + ? Checked.Mixed + : Checked.Unchecked } onGenerateSelected={(checked) => generateSelectedAll({ checked, filter }) diff --git a/src/app/machines/views/MachineList/MachineListTable/GroupCheckbox/GroupCheckbox.tsx b/src/app/machines/views/MachineList/MachineListTable/GroupCheckbox/GroupCheckbox.tsx index 80fdbcb45f..c1ba815994 100644 --- a/src/app/machines/views/MachineList/MachineListTable/GroupCheckbox/GroupCheckbox.tsx +++ b/src/app/machines/views/MachineList/MachineListTable/GroupCheckbox/GroupCheckbox.tsx @@ -47,8 +47,8 @@ const GroupCheckbox = ({ allSelected || groupSelected ? Checked.Checked : childrenSelected - ? Checked.Mixed - : Checked.Unchecked + ? Checked.Mixed + : Checked.Unchecked } isDisabled={group?.count === 0 || allSelected} onGenerateSelected={(checked) => { diff --git a/src/app/machines/views/MachineList/hooks.ts b/src/app/machines/views/MachineList/hooks.ts index 2e003ced30..1b873e9fa4 100644 --- a/src/app/machines/views/MachineList/hooks.ts +++ b/src/app/machines/views/MachineList/hooks.ts @@ -76,7 +76,7 @@ export const useResponsiveColumns = () => { export const useGrouping = (): [ FetchGroupKey, - (group: FetchGroupKey | null) => void + (group: FetchGroupKey | null) => void, ] => { const dispatch = useDispatch(); const [storedGrouping, setStoredGrouping] = diff --git a/src/app/settings/hooks.test.tsx b/src/app/settings/hooks.test.tsx index 12e82fa1d3..7245e74f9b 100644 --- a/src/app/settings/hooks.test.tsx +++ b/src/app/settings/hooks.test.tsx @@ -15,8 +15,9 @@ const mockStore = configureStore(); const generateWrapper = (store: MockStoreEnhanced) => - ({ children }: { children: ReactNode }) => - {children}; + ({ children }: { children: ReactNode }) => ( + {children} + ); let state: RootState; diff --git a/src/app/store/general/types/base.ts b/src/app/store/general/types/base.ts index 7e9e3dbcf8..d0af71b247 100644 --- a/src/app/store/general/types/base.ts +++ b/src/app/store/general/types/base.ts @@ -31,12 +31,12 @@ export type BondModeOptions = [ [BondMode.BROADCAST, BondMode.BROADCAST], [BondMode.LINK_AGGREGATION, BondMode.LINK_AGGREGATION], [BondMode.BALANCE_TLB, BondMode.BALANCE_TLB], - [BondMode.BALANCE_ALB, BondMode.BALANCE_ALB] + [BondMode.BALANCE_ALB, BondMode.BALANCE_ALB], ]; export type BondLacpRateOptions = [ [BondLacpRate.FAST, BondLacpRate.FAST], - [BondLacpRate.SLOW, BondLacpRate.SLOW] + [BondLacpRate.SLOW, BondLacpRate.SLOW], ]; export type BondXmitHashPolicyOptions = [ @@ -44,7 +44,7 @@ export type BondXmitHashPolicyOptions = [ [BondXmitHashPolicy.LAYER2_3, BondXmitHashPolicy.LAYER2_3], [BondXmitHashPolicy.LAYER3_4, BondXmitHashPolicy.LAYER3_4], [BondXmitHashPolicy.ENCAP2_3, BondXmitHashPolicy.ENCAP2_3], - [BondXmitHashPolicy.ENCAP3_4, BondXmitHashPolicy.ENCAP3_4] + [BondXmitHashPolicy.ENCAP3_4, BondXmitHashPolicy.ENCAP3_4], ]; export type BondOptions = { @@ -224,8 +224,8 @@ export type PowerTypesState = { loading: boolean; }; -export type TLSCertificate = - | Omit & CertificateMetadata; +export type TLSCertificate = Omit & + CertificateMetadata; export type TLSCertificateState = { errors: APIError; diff --git a/src/app/store/general/utils/hooks.test.tsx b/src/app/store/general/utils/hooks.test.tsx index 68a8f1525e..aa5b9b0b07 100644 --- a/src/app/store/general/utils/hooks.test.tsx +++ b/src/app/store/general/utils/hooks.test.tsx @@ -14,8 +14,9 @@ const mockStore = configureStore(); const generateWrapper = (store: MockStoreEnhanced) => - ({ children }: { children: ReactNode }) => - {children}; + ({ children }: { children: ReactNode }) => ( + {children} + ); describe("general hook utils", () => { let state: RootState; diff --git a/src/app/store/machine/utils/hooks.test.tsx b/src/app/store/machine/utils/hooks.test.tsx index cf1ce0f32a..e1f34d7908 100644 --- a/src/app/store/machine/utils/hooks.test.tsx +++ b/src/app/store/machine/utils/hooks.test.tsx @@ -86,8 +86,9 @@ describe("machine hook utils", () => { describe("useFetchMachineCount", () => { const generateWrapper = (store: MockStoreEnhanced) => - ({ children }: { children?: ReactNode; filters?: FetchFilters }) => - {children}; + ({ children }: { children?: ReactNode; filters?: FetchFilters }) => ( + {children} + ); it("can dispatch machine count action", () => { const store = mockStore(state); @@ -252,8 +253,9 @@ describe("machine hook utils", () => { const generateWrapper = (store: MockStoreEnhanced) => - ({ children }: { children?: ReactNode }) => - {children}; + ({ children }: { children?: ReactNode }) => ( + {children} + ); it("can fetch machines", () => { const store = mockStore(state); @@ -486,8 +488,9 @@ describe("machine hook utils", () => { const generateWrapper = (store: MockStoreEnhanced) => - ({ children }: { children?: ReactNode }) => - {children}; + ({ children }: { children?: ReactNode }) => ( + {children} + ); describe("useFetchSelectedMachines", () => { afterEach(() => { @@ -496,8 +499,9 @@ describe("machine hook utils", () => { const generateWrapper = (store: MockStoreEnhanced) => - ({ children }: { children?: ReactNode }) => - {children}; + ({ children }: { children?: ReactNode }) => ( + {children} + ); it("can fetch selected machines", async () => { vi.spyOn(query, "generateCallId").mockReturnValueOnce(mockCallId); @@ -523,8 +527,9 @@ describe("machine hook utils", () => { }); const generateWrapper = (store: MockStoreEnhanced) => - ({ children }: { children?: ReactNode }) => - {children}; + ({ children }: { children?: ReactNode }) => ( + {children} + ); it("adds a callId to redux dispatch function", async () => { const store = mockStore(state); @@ -563,8 +568,9 @@ describe("machine hook utils", () => { }); const generateWrapper = (store: MockStoreEnhanced) => - ({ children }: { children?: ReactNode }) => - {children}; + ({ children }: { children?: ReactNode }) => ( + {children} + ); it("adds a callId to redux dispatch function and returns action state", async () => { state.machine.actions["mocked-nanoid"] = factory.machineActionState({ @@ -622,8 +628,9 @@ describe("machine hook utils", () => { describe("useSelectedMachinesActionsDispatch", () => { const generateWrapper = (store: MockStoreEnhanced) => - ({ children }: { children?: ReactNode }) => - {children}; + ({ children }: { children?: ReactNode }) => ( + {children} + ); it("dispatches separate calls when there are selected both groups and items", async () => { vi.spyOn(reduxToolkit, "nanoid") @@ -773,8 +780,9 @@ describe("machine hook utils", () => { }); const generateWrapper = (store: MockStoreEnhanced) => - ({ children }: { children?: ReactNode }) => - {children}; + ({ children }: { children?: ReactNode }) => ( + {children} + ); it("can get a machine", () => { vi.spyOn(reduxToolkit, "nanoid").mockReturnValueOnce("mocked-nanoid"); diff --git a/src/app/store/machine/utils/hooks.tsx b/src/app/store/machine/utils/hooks.tsx index 369edffde1..3884e90aaf 100644 --- a/src/app/store/machine/utils/hooks.tsx +++ b/src/app/store/machine/utils/hooks.tsx @@ -91,7 +91,7 @@ type MachineActionData = { }; export const useMachineActionDispatch = < - A extends AnyAction + A extends AnyAction, >(): MachineActionData & { dispatch: (args: A) => void; } => { @@ -356,8 +356,8 @@ export const useFetchSelectedMachines = ( loaded: groupFilters ? groupData.loaded : true && itemFilters - ? itemsData.loaded - : true, + ? itemsData.loaded + : true, machineCount: groupData.machineCount || 0 + (itemsData?.machineCount || 0), machinesErrors: groupData.machinesErrors || itemsData.machinesErrors, }; diff --git a/src/app/store/subnet/hooks.test.tsx b/src/app/store/subnet/hooks.test.tsx index 2420ff5e5e..d724c51b9b 100644 --- a/src/app/store/subnet/hooks.test.tsx +++ b/src/app/store/subnet/hooks.test.tsx @@ -13,8 +13,9 @@ const mockStore = configureStore(); const generateWrapper = (store: MockStoreEnhanced) => - ({ children }: { children: ReactNode }) => - {children}; + ({ children }: { children: ReactNode }) => ( + {children} + ); describe("useCanBeDeleted", () => { it("can be deleted if DHCP is disabled and the subnet has no ips", () => { diff --git a/src/app/store/utils/selectors.ts b/src/app/store/utils/selectors.ts index bf488a9c72..7e63f22087 100644 --- a/src/app/store/utils/selectors.ts +++ b/src/app/store/utils/selectors.ts @@ -27,7 +27,7 @@ type BaseSelectors< // See: https://www.typescriptlang.org/docs/handbook/release-notes/typescript-2-1.html#keyof-and-lookup-types I extends S["items"][0], // A model key as a reference to the supplied state item. - K extends keyof I + K extends keyof I, > = { all: (state: RootState) => S["items"]; // This method is generated using createSelector so it results @@ -72,7 +72,7 @@ export const generateBaseSelectors = < // see the BaseSelectors type definition above. I extends S["items"][0], // A model key as a reference from the supplied model. - K extends keyof I + K extends keyof I, >( name: keyof CommonStates, indexKey: K, diff --git a/src/app/store/utils/slice.ts b/src/app/store/utils/slice.ts index 8b0f3b72cd..1c851f7ae3 100644 --- a/src/app/store/utils/slice.ts +++ b/src/app/store/utils/slice.ts @@ -122,7 +122,7 @@ export const genericInitialState = { */ export const updateErrors = < S extends EventErrorStateTypes, - K extends keyof S["items"][0] + K extends keyof S["items"][0], >( state: S, action: { @@ -180,7 +180,7 @@ export const generateCommonReducers = < S extends CommonStateTypes, K extends keyof S["items"][0], CreateParams, - UpdateParams + UpdateParams, >( name: keyof SliceState, indexKey: K, @@ -369,7 +369,7 @@ export type StatusHandlers< S extends StatusStateTypes, I extends S["items"][0], // alternative success payload type - A = void + A = void, > = { method?: string; status: string; @@ -403,7 +403,7 @@ export const generateStatusHandlers = < // A model key as a reference to the supplied state item. K extends keyof I, // optional alternative success payload type - A = void + A = void, >( indexKey: K, handlers: StatusHandlers[], diff --git a/src/app/utils/formatErrors.ts b/src/app/utils/formatErrors.ts index 91e795674c..b0965fdb05 100644 --- a/src/app/utils/formatErrors.ts +++ b/src/app/utils/formatErrors.ts @@ -117,7 +117,7 @@ export const formatErrors = ( if (typeof errors === "string" && isHTMLContent(errors)) { return "html"; } - return typeof errors in errorTypeFormatters + return (typeof errors) in errorTypeFormatters ? (typeof errors as ErrorTypeFormat) : "string"; }; diff --git a/src/app/utils/search/filter-items.ts b/src/app/utils/search/filter-items.ts index 273ec7a43b..00a075ff50 100644 --- a/src/app/utils/search/filter-items.ts +++ b/src/app/utils/search/filter-items.ts @@ -29,7 +29,7 @@ export const getSelectedValue = (terms: FilterValue[]): FilterSelected => { export default class FilterItems< I, PK extends keyof I, - D = void + D = void, > extends FilterHandlers { getValue: GetValue; primaryKey: PK; diff --git a/src/testing/utils.tsx b/src/testing/utils.tsx index 1da2405fa0..7904f52617 100644 --- a/src/testing/utils.tsx +++ b/src/testing/utils.tsx @@ -298,8 +298,9 @@ export const expectTooltipOnHover = async ( const generateWrapper = (store = configureStore()(rootStateFactory())) => - ({ children }: { children: ReactNode }) => - {children}; + ({ children }: { children: ReactNode }) => ( + {children} + ); type Hook = Parameters[0]; export const renderHookWithMockStore = (hook: Hook) => { diff --git a/yarn.lock b/yarn.lock index c5e9d67567..8222942087 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2734,6 +2734,11 @@ resolved "https://registry.yarnpkg.com/@pkgjs/parseargs/-/parseargs-0.11.0.tgz#a77ea742fab25775145434eb1d2328cf5013ac33" integrity sha512-+1VkjdD0QBLPodGrJUeqarH8VAIvQODIbwh9XpP5Syisf7YoQgsJKPNFoqqLQlu+VQ/tVSshMR6loPMn8U+dPg== +"@pkgr/core@^0.1.0": + version "0.1.1" + resolved "https://registry.yarnpkg.com/@pkgr/core/-/core-0.1.1.tgz#1ec17e2edbec25c8306d424ecfbf13c7de1aaa31" + integrity sha512-cq8o4cWH0ibXh9VGi5P20Tu9XF/0fFXl9EUinr9QfTM7a7p0oTA4iJRCQWppXR1Pg8dSM0UCItCkPwsk9qWWYA== + "@playwright/test@1.43.1": version "1.43.1" resolved "https://registry.yarnpkg.com/@playwright/test/-/test-1.43.1.tgz#16728a59eb8ce0f60472f98d8886d6cab0fa3e42" @@ -7516,12 +7521,13 @@ eslint-plugin-playwright@1.6.0: dependencies: globals "^13.23.0" -eslint-plugin-prettier@4.2.1: - version "4.2.1" - resolved "https://registry.yarnpkg.com/eslint-plugin-prettier/-/eslint-plugin-prettier-4.2.1.tgz#651cbb88b1dab98bfd42f017a12fa6b2d993f94b" - integrity sha512-f/0rXLXUt0oFYs8ra4w49wYZBG5GKZpAYsJSm6rnYL5uVDjd+zowwMwVZHnAjf4edNrKpCDYfXDgmRE/Ak7QyQ== +eslint-plugin-prettier@5.1.3: + version "5.1.3" + resolved "https://registry.yarnpkg.com/eslint-plugin-prettier/-/eslint-plugin-prettier-5.1.3.tgz#17cfade9e732cef32b5f5be53bd4e07afd8e67e1" + integrity sha512-C9GCVAs4Eq7ZC/XFQHITLiHJxQngdtraXaM+LoUFoFp/lHNl2Zn8f3WQbe9HvTBBQ9YnKFB0/2Ajdqwo5D1EAw== dependencies: prettier-linter-helpers "^1.0.0" + synckit "^0.8.6" eslint-plugin-react-hooks@^4.3.0: version "4.6.0" @@ -10941,7 +10947,12 @@ prettier-linter-helpers@^1.0.0: dependencies: fast-diff "^1.1.2" -prettier@2.8.8, prettier@^2.8.0: +prettier@3.2.5: + version "3.2.5" + resolved "https://registry.yarnpkg.com/prettier/-/prettier-3.2.5.tgz#e52bc3090586e824964a8813b09aba6233b28368" + integrity sha512-3/GWa9aOC0YeD7LUfvOG2NiDyhOWRvt1k+rcKhOuYnMY24iiCphgneUfJDyFXd6rZCAnuLBv6UeAULtrhT/F4A== + +prettier@^2.8.0: version "2.8.8" resolved "https://registry.yarnpkg.com/prettier/-/prettier-2.8.8.tgz#e8c5d7e98a4305ffe3de2e1fc4aca1a71c28b1da" integrity sha512-tdN8qQGvNjw4CHbY+XXk0JgCXn9QiF21a55rBe5LJAU+kDyC4WQn4+awm2Xfk2lQMk5fKup9XgzTZtGkjBdP9Q== @@ -12227,7 +12238,7 @@ string-natural-compare@^3.0.1: resolved "https://registry.yarnpkg.com/string-natural-compare/-/string-natural-compare-3.0.1.tgz#7a42d58474454963759e8e8b7ae63d71c1e7fdf4" integrity sha512-n3sPwynL1nwKi3WJ6AIsClwBMa0zTi54fn2oLU6ndfTSIO05xaznjSf15PcBZU6FNWbmN5Q6cxT4V5hGvB4taw== -"string-width-cjs@npm:string-width@^4.2.0": +"string-width-cjs@npm:string-width@^4.2.0", string-width@^4.2.3: version "4.2.3" resolved "https://registry.yarnpkg.com/string-width/-/string-width-4.2.3.tgz#269c7117d27b05ad2e536830a8ec895ef9c6d010" integrity sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g== @@ -12245,15 +12256,6 @@ string-width@^4.1.0, string-width@^4.2.0: is-fullwidth-code-point "^3.0.0" strip-ansi "^6.0.0" -string-width@^4.2.3: - version "4.2.3" - resolved "https://registry.yarnpkg.com/string-width/-/string-width-4.2.3.tgz#269c7117d27b05ad2e536830a8ec895ef9c6d010" - integrity sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g== - dependencies: - emoji-regex "^8.0.0" - is-fullwidth-code-point "^3.0.0" - strip-ansi "^6.0.1" - string-width@^5.0.1, string-width@^5.1.2: version "5.1.2" resolved "https://registry.yarnpkg.com/string-width/-/string-width-5.1.2.tgz#14f8daec6d81e7221d2a357e668cab73bdbca794" @@ -12319,7 +12321,7 @@ string_decoder@~1.1.1: dependencies: safe-buffer "~5.1.0" -"strip-ansi-cjs@npm:strip-ansi@^6.0.1": +"strip-ansi-cjs@npm:strip-ansi@^6.0.1", strip-ansi@^6.0.1: version "6.0.1" resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-6.0.1.tgz#9e26c63d30f53443e9489495b2105d37b67a85d9" integrity sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A== @@ -12333,13 +12335,6 @@ strip-ansi@^6.0.0: dependencies: ansi-regex "^5.0.0" -strip-ansi@^6.0.1: - version "6.0.1" - resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-6.0.1.tgz#9e26c63d30f53443e9489495b2105d37b67a85d9" - integrity sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A== - dependencies: - ansi-regex "^5.0.1" - strip-ansi@^7.0.1: version "7.0.1" resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-7.0.1.tgz#61740a08ce36b61e50e65653f07060d000975fb2" @@ -12439,6 +12434,14 @@ synchronous-promise@^2.0.15: resolved "https://registry.yarnpkg.com/synchronous-promise/-/synchronous-promise-2.0.17.tgz#38901319632f946c982152586f2caf8ddc25c032" integrity sha512-AsS729u2RHUfEra9xJrE39peJcc2stq2+poBXX8bcM08Y6g9j/i/PUzwNQqkaJde7Ntg1TO7bSREbR5sdosQ+g== +synckit@^0.8.6: + version "0.8.8" + resolved "https://registry.yarnpkg.com/synckit/-/synckit-0.8.8.tgz#fe7fe446518e3d3d49f5e429f443cf08b6edfcd7" + integrity sha512-HwOKAP7Wc5aRGYdKH+dw0PRRpbO841v2DENBtjnR5HFWoiNByAl7vrx3p0G/rCyYXQsrxqtX48TImFtPcIHSpQ== + dependencies: + "@pkgr/core" "^0.1.0" + tslib "^2.6.2" + tapable@^2.0.0, tapable@^2.1.1, tapable@^2.2.0, tapable@^2.2.1: version "2.2.1" resolved "https://registry.yarnpkg.com/tapable/-/tapable-2.2.1.tgz#1967a73ef4060a82f12ab96af86d52fdb76eeca0" @@ -12729,7 +12732,7 @@ tslib@^1.13.0, tslib@^1.8.1, tslib@^1.9.0, tslib@^1.9.3: resolved "https://registry.yarnpkg.com/tslib/-/tslib-1.14.1.tgz#cf2d38bdc34a134bcaf1091c41f6619e2f672d00" integrity sha512-Xni35NKzjgMrwevysHTCArtLDpPvye8zV/0E4EyYn43P7/7qvQwPh9BGkHewbMulVntbigmcT7rdX3BNo9wRJg== -tslib@^2.0.0, tslib@^2.0.1: +tslib@^2.0.0, tslib@^2.0.1, tslib@^2.6.2: version "2.6.2" resolved "https://registry.yarnpkg.com/tslib/-/tslib-2.6.2.tgz#703ac29425e7b37cd6fd456e92404d46d1f3e4ae" integrity sha512-AEYxH93jGFPn/a2iVAwW87VuUIkR1FVUKB77NwMF7nBTDkDrrT/Hpt/IrCJ0QXhW27jTBDcf5ZY7w6RiqTMw2Q== @@ -13517,7 +13520,7 @@ wordwrap@^1.0.0: resolved "https://registry.yarnpkg.com/wordwrap/-/wordwrap-1.0.0.tgz#27584810891456a4171c8d0226441ade90cbcaeb" integrity sha512-gvVzJFlPycKc5dZN4yPkP8w7Dc37BtP1yczEneOb4uq34pXZcvrtRTmWV8W+Ume+XCxKgbjM+nevkyFPMybd4Q== -"wrap-ansi-cjs@npm:wrap-ansi@^7.0.0": +"wrap-ansi-cjs@npm:wrap-ansi@^7.0.0", wrap-ansi@^7.0.0: version "7.0.0" resolved "https://registry.yarnpkg.com/wrap-ansi/-/wrap-ansi-7.0.0.tgz#67e145cff510a6a6984bdf1152911d69d2eb9e43" integrity sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q== @@ -13535,15 +13538,6 @@ wrap-ansi@^6.2.0: string-width "^4.1.0" strip-ansi "^6.0.0" -wrap-ansi@^7.0.0: - version "7.0.0" - resolved "https://registry.yarnpkg.com/wrap-ansi/-/wrap-ansi-7.0.0.tgz#67e145cff510a6a6984bdf1152911d69d2eb9e43" - integrity sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q== - dependencies: - ansi-styles "^4.0.0" - string-width "^4.1.0" - strip-ansi "^6.0.0" - wrap-ansi@^8.1.0: version "8.1.0" resolved "https://registry.yarnpkg.com/wrap-ansi/-/wrap-ansi-8.1.0.tgz#56dc22368ee570face1b49819975d9b9a5ead214"