Skip to content

Commit

Permalink
chore: upgrade prettier to v3 (#5424)
Browse files Browse the repository at this point in the history
  • Loading branch information
petermakowski authored May 7, 2024
1 parent 1bad2df commit 518968f
Show file tree
Hide file tree
Showing 33 changed files with 139 additions and 132 deletions.
2 changes: 1 addition & 1 deletion .prettierrc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{}
{"trailingComma": "es5"}
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand All @@ -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",
Expand Down
4 changes: 2 additions & 2 deletions src/app/base/components/DhcpFormFields/DhcpFormFields.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
8 changes: 4 additions & 4 deletions src/app/base/components/PageContent/PageContent.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -55,15 +55,15 @@ const PageContent = ({
isSettingsPage
? settingsNavItems
: isPreferencesPage
? preferencesNavItems
: []
? preferencesNavItems
: []
}
title={
isSettingsPage
? "Settings"
: isPreferencesPage
? "My preferences"
: ""
? "My preferences"
: ""
}
/>
</div>
Expand Down
5 changes: 3 additions & 2 deletions src/app/base/components/node/NodeLogs/hooks.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,9 @@ const mockStore = configureStore();

const generateWrapper =
(store: MockStoreEnhanced<unknown>) =>
({ children }: { children: ReactNode }) =>
<Provider store={store}>{children}</Provider>;
({ children }: { children: ReactNode }) => (
<Provider store={store}>{children}</Provider>
);

describe("machine utils", () => {
let state: RootState;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,8 @@ const getImageSyncStatus = (
!status
? Labels.NoStatus
: checkingImages
? Labels.CheckingImages
: status
? Labels.CheckingImages
: status
}
/>
);
Expand Down
8 changes: 4 additions & 4 deletions src/app/base/hooks/base.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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();
});
Expand All @@ -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,
Expand All @@ -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,
Expand All @@ -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,
Expand Down
5 changes: 3 additions & 2 deletions src/app/base/hooks/node-networking.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,9 @@ const mockStore = configureStore();

const generateWrapper =
(store: MockStoreEnhanced<unknown>) =>
({ children }: { children: ReactNode }) =>
<Provider store={store}>{children}</Provider>;
({ children }: { children: ReactNode }) => (
<Provider store={store}>{children}</Provider>
);

describe("machine hook utils", () => {
let state: RootState;
Expand Down
5 changes: 3 additions & 2 deletions src/app/base/hooks/node.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,9 @@ const mockStore = configureStore();

const generateWrapper =
(store: MockStoreEnhanced<unknown>) =>
({ children }: { children: ReactNode }) =>
<Provider store={store}>{children}</Provider>;
({ children }: { children: ReactNode }) => (
<Provider store={store}>{children}</Provider>
);

describe("node hooks", () => {
describe("useIsRackControllerConnected", () => {
Expand Down
19 changes: 9 additions & 10 deletions src/app/base/hooks/urls.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,16 +13,15 @@ const mockStore = configureStore();

const generateWrapper =
(pathname: string, route: string) =>
({ children }: { children: ReactNode }) =>
(
<Provider store={mockStore(factory.rootState())}>
<MemoryRouter initialEntries={[{ pathname }]}>
<Routes>
<Route element={<>{children}</>} path={route} />
</Routes>
</MemoryRouter>
</Provider>
);
({ children }: { children: ReactNode }) => (
<Provider store={mockStore(factory.rootState())}>
<MemoryRouter initialEntries={[{ pathname }]}>
<Routes>
<Route element={<>{children}</>} path={route} />
</Routes>
</MemoryRouter>
</Provider>
);

describe("url hooks", () => {
describe("useGetURLId", () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 (
<span>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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<HTMLDivElement>();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 <Spinner data-testid="loading-device-details" text="Loading..." />;
Expand Down
5 changes: 3 additions & 2 deletions src/app/intro/hooks.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,9 @@ const mockStore = configureStore();

const generateWrapper =
(store: MockStoreEnhanced<unknown>) =>
({ children }: { children: ReactNode }) =>
<Provider store={store}>{children}</Provider>;
({ children }: { children: ReactNode }) => (
<Provider store={store}>{children}</Provider>
);

describe("hooks", () => {
let state: RootState;
Expand Down
2 changes: 1 addition & 1 deletion src/app/kvm/components/VfResources/VfResources.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ const VfResources = ({
[
PodResource["allocated_tracked"],
PodResource["free"],
PodResource["allocated_other"]
PodResource["allocated_other"],
]
>(
([allocated, free, other], { virtual_functions }) => {
Expand Down
11 changes: 5 additions & 6 deletions src/app/kvm/hooks.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,11 @@ const mockStore = configureStore();

const generateWrapper =
(store: MockStoreEnhanced<unknown>, pathname = "") =>
({ children }: { children: ReactNode }) =>
(
<Provider store={store}>
<MemoryRouter initialEntries={[{ pathname }]}>{children}</MemoryRouter>
</Provider>
);
({ children }: { children: ReactNode }) => (
<Provider store={store}>
<MemoryRouter initialEntries={[{ pathname }]}>{children}</MemoryRouter>
</Provider>
);

describe("kvm hooks", () => {
describe("useActivePod", () => {
Expand Down
5 changes: 3 additions & 2 deletions src/app/machines/hooks.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,9 @@ vi.mock("@canonical/react-components/dist/hooks", () => ({

const generateWrapper =
(store: MockStoreEnhanced<unknown>) =>
({ children }: { children: ReactNode }) =>
<Provider store={store}>{children}</Provider>;
({ children }: { children: ReactNode }) => (
<Provider store={store}>{children}</Provider>
);

describe("machine utils", () => {
let state: RootState;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ const MachineTests = (): JSX.Element => {
).map(
([physical_blockdevice, scriptResults]: [
string,
ScriptResult[]
ScriptResult[],
]) => {
const { model, name, serial } =
scriptResults[0]?.parameters?.storage?.value || {};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 })
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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) => {
Expand Down
2 changes: 1 addition & 1 deletion src/app/machines/views/MachineList/hooks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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] =
Expand Down
5 changes: 3 additions & 2 deletions src/app/settings/hooks.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,9 @@ const mockStore = configureStore();

const generateWrapper =
(store: MockStoreEnhanced<unknown>) =>
({ children }: { children: ReactNode }) =>
<Provider store={store}>{children}</Provider>;
({ children }: { children: ReactNode }) => (
<Provider store={store}>{children}</Provider>
);

let state: RootState;

Expand Down
10 changes: 5 additions & 5 deletions src/app/store/general/types/base.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,20 +31,20 @@ 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 = [
[BondXmitHashPolicy.LAYER2, BondXmitHashPolicy.LAYER2],
[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 = {
Expand Down Expand Up @@ -224,8 +224,8 @@ export type PowerTypesState = {
loading: boolean;
};

export type TLSCertificate =
| Omit<CertificateData, "private_key"> & CertificateMetadata;
export type TLSCertificate = Omit<CertificateData, "private_key"> &
CertificateMetadata;

export type TLSCertificateState = {
errors: APIError;
Expand Down
5 changes: 3 additions & 2 deletions src/app/store/general/utils/hooks.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,9 @@ const mockStore = configureStore();

const generateWrapper =
(store: MockStoreEnhanced<unknown>) =>
({ children }: { children: ReactNode }) =>
<Provider store={store}>{children}</Provider>;
({ children }: { children: ReactNode }) => (
<Provider store={store}>{children}</Provider>
);

describe("general hook utils", () => {
let state: RootState;
Expand Down
Loading

0 comments on commit 518968f

Please sign in to comment.