From ed07db0ef0cd844e93a796cb0a02d401889d1ef7 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Sat, 4 Jan 2025 11:43:02 +0000 Subject: [PATCH] build(deps-dev): Bump prettier from 2.6.2 to 3.4.2 And fixing new issues by upgrade --- package.json | 2 +- ui/App.tsx | 2 +- ui/components/AlertListErrors.tsx | 2 +- ui/components/AutomationDetail.tsx | 4 +- ui/components/DataTable/DataTable.tsx | 4 +- .../DataTable/__tests__/DataTable.test.tsx | 42 +++---- .../__tests__/DataTableFilters.test.tsx | 92 +++++++-------- ui/components/DataTable/helpers.ts | 12 +- ui/components/DependenciesView.tsx | 2 +- ui/components/ErrorList.tsx | 2 +- ui/components/FilterDialog.tsx | 4 +- ui/components/FluxRuntime.tsx | 2 +- ui/components/FormInput.tsx | 2 +- ui/components/HealthCheckStatusIndicator.tsx | 4 +- .../ImageAutomation/ImageAutomation.tsx | 2 +- .../policies/ImagePolicyDetails.tsx | 2 +- .../ImageAutomationRepoDetails.tsx | 2 +- .../repositories/ImageRepositoriesTable.tsx | 2 +- .../updates/ImageAutomationUpdatesDetails.tsx | 4 +- .../updates/ImageAutomationUpdatesTable.tsx | 2 +- ui/components/InfoList.tsx | 2 +- ui/components/InfoModal.tsx | 2 +- ui/components/KubeStatusIndicator.tsx | 10 +- ui/components/Pendo.tsx | 4 +- .../PolicyViolations/PolicyViolationPage.tsx | 2 +- .../Policies/__tests__/HeaderRows.test.tsx | 2 +- .../Policies/__tests__/Parameters.test.tsx | 8 +- .../Policies/__tests__/Severity.test.tsx | 2 +- ui/components/ProviderDetail.tsx | 2 +- ui/components/ReconciliationGraph.tsx | 2 +- ui/components/SearchField.tsx | 2 +- ui/components/SourceLink.tsx | 2 +- ui/components/Sync/CheckboxActions.tsx | 4 +- ui/components/Sync/SyncActions.tsx | 4 +- ui/components/Sync/SyncControls.tsx | 2 +- .../Sync/__tests__/SyncActions.test.tsx | 18 +-- .../Sync/__tests__/SyncControls.test.tsx | 30 ++--- ui/components/Timestamp.tsx | 2 +- ui/components/VerifiedStatus.tsx | 4 +- ui/components/__tests__/AlertsTable.test.tsx | 4 +- ui/components/__tests__/Breadcrumbs.test.tsx | 8 +- ui/components/__tests__/ChipGroup.test.tsx | 8 +- ui/components/__tests__/FilterDialog.test.tsx | 18 +-- ui/components/__tests__/Flex.test.tsx | 2 +- .../__tests__/FluxObjectsTable.test.tsx | 26 ++--- ui/components/__tests__/Footer.test.tsx | 8 +- .../__tests__/KubeStatusIndicator.test.tsx | 6 +- ui/components/__tests__/Link.test.tsx | 18 +-- ui/components/__tests__/MessageBox.test.tsx | 2 +- ui/components/__tests__/Metadata.test.tsx | 4 +- ui/components/__tests__/Page.test.tsx | 6 +- ui/components/__tests__/Pagination.test.tsx | 12 +- ui/components/__tests__/Version.test.tsx | 16 +-- ui/components/__tests__/YamlView.test.tsx | 8 +- ui/contexts/AppContext.tsx | 4 +- ui/contexts/AuthContext.tsx | 2 +- ui/contexts/CoreClientContext.tsx | 2 +- .../__tests__/CoreClientContext.test.tsx | 2 +- ui/hooks/Policies.ts | 8 +- ui/hooks/__tests__/inventory.test.tsx | 6 +- ui/hooks/automations.ts | 12 +- ui/hooks/events.ts | 4 +- ui/hooks/flux.ts | 26 ++--- ui/hooks/imageautomation.ts | 8 +- ui/hooks/inventory.ts | 6 +- ui/hooks/notifications.ts | 12 +- ui/hooks/objects.ts | 12 +- ui/hooks/policyViolations.ts | 8 +- ui/hooks/sources.ts | 10 +- ui/hooks/version.ts | 2 +- ui/lib/__tests__/graph.test.ts | 14 +-- ui/lib/__tests__/objects.test.ts | 4 +- ui/lib/__tests__/requests.test.ts | 2 +- ui/lib/__tests__/utils.test.ts | 106 +++++++++--------- ui/lib/dependencies.ts | 6 +- ui/lib/graph.ts | 6 +- ui/lib/nav.ts | 6 +- ui/lib/objects.ts | 8 +- ui/lib/test-utils.tsx | 8 +- ui/lib/utils.ts | 10 +- ui/pages/Error.tsx | 2 +- ui/pages/__tests__/Automations.test.tsx | 4 +- ui/pages/__tests__/Signin.test.tsx | 12 +- ui/pages/v2/GitRepositoryDetail.tsx | 2 +- ui/pages/v2/HelmRepositoryDetail.tsx | 2 +- ui/pages/v2/KustomizationPage.tsx | 2 +- ui/pages/v2/OCIRepositoryPage.tsx | 2 +- ui/pages/v2/PodPage.tsx | 2 +- ui/pages/v2/ProviderPage.tsx | 2 +- yarn.lock | 12 +- 90 files changed, 388 insertions(+), 388 deletions(-) diff --git a/package.json b/package.json index 651909e834..8325fa99c8 100644 --- a/package.json +++ b/package.json @@ -116,7 +116,7 @@ "jest-worker": "^29.7.0", "jsdom": "^16.6.0", "parcel": "^2.13.3", - "prettier": "^2.6.2", + "prettier": "^3.4.2", "process": "^0.11.10", "react-test-renderer": "^18.0.0", "ts-jest": "^29.2.5", diff --git a/ui/App.tsx b/ui/App.tsx index 9d1126fc7f..473e63e0fb 100644 --- a/ui/App.tsx +++ b/ui/App.tsx @@ -92,7 +92,7 @@ const App = () => { const { isFlagEnabled } = useFeatureFlags(); const isNewRuntimeEnabled = isFlagEnabled( - "WEAVE_GITOPS_FEATURE_GITOPS_RUNTIME" + "WEAVE_GITOPS_FEATURE_GITOPS_RUNTIME", ); const navItems: NavItem[] = [ diff --git a/ui/components/AlertListErrors.tsx b/ui/components/AlertListErrors.tsx index 041597ec0c..83ec05f8da 100644 --- a/ui/components/AlertListErrors.tsx +++ b/ui/components/AlertListErrors.tsx @@ -67,7 +67,7 @@ export const AlertListErrors: FC<{ useEffect(() => { const fErrors = sortBy( uniqBy(errors, (error) => [error.clusterName, error.message].join()), - [(v) => v.clusterName, (v) => v.namespace, (v) => v.message] + [(v) => v.clusterName, (v) => v.namespace, (v) => v.message], ); setFilteredErrors(fErrors); setIndex(0); diff --git a/ui/components/AutomationDetail.tsx b/ui/components/AutomationDetail.tsx index 33f5503e44..59bd4f207a 100644 --- a/ui/components/AutomationDetail.tsx +++ b/ui/components/AutomationDetail.tsx @@ -78,7 +78,7 @@ function AutomationDetail({ name, clusterName, namespace, - false + false, ); const canaryStatus = createCanaryCondition(data?.objects); @@ -155,7 +155,7 @@ function AutomationDetail({ header={createYamlCommand( automation.type, automation.name, - automation.namespace + automation.namespace, )} /> ); diff --git a/ui/components/DataTable/DataTable.tsx b/ui/components/DataTable/DataTable.tsx index 161f4a1043..24e044bb39 100644 --- a/ui/components/DataTable/DataTable.tsx +++ b/ui/components/DataTable/DataTable.tsx @@ -108,7 +108,7 @@ function UnstyledDataTable({ sorted = _.orderBy( filtered, [sortedItem.sortValue || sortedItem.value], - [sortedItem.reverseSort ? "desc" : "asc"] + [sortedItem.reverseSort ? "desc" : "asc"], ); } return sorted; @@ -135,7 +135,7 @@ function UnstyledDataTable({ const textFilters = _.filter( next.textFilters, - (f) => !_.includes(chips, f) + (f) => !_.includes(chips, f), ); let query = qs.parse(search); diff --git a/ui/components/DataTable/__tests__/DataTable.test.tsx b/ui/components/DataTable/__tests__/DataTable.test.tsx index 15906cf6d1..14aaa892f6 100644 --- a/ui/components/DataTable/__tests__/DataTable.test.tsx +++ b/ui/components/DataTable/__tests__/DataTable.test.tsx @@ -64,9 +64,9 @@ describe("DataTable", () => { withContext( , "/applications", - {} - ) - ) + {}, + ), + ), ); const firstRow = screen.getAllByRole("row")[1]; expect(firstRow.innerHTML).toMatch(/nginx/); @@ -77,9 +77,9 @@ describe("DataTable", () => { withContext( , "/applications", - {} - ) - ) + {}, + ), + ), ); const nameButton = screen.getByText("Name"); @@ -93,9 +93,9 @@ describe("DataTable", () => { withContext( , "/applications", - {} - ) - ) + {}, + ), + ), ); const nameButton = screen.getByText("Name"); fireEvent.click(nameButton); @@ -110,9 +110,9 @@ describe("DataTable", () => { withContext( , "/applications", - {} - ) - ) + {}, + ), + ), ); const firstRow = screen.getAllByRole("row")[1]; expect(firstRow.innerHTML).toMatch(/No/); @@ -142,9 +142,9 @@ describe("DataTable", () => { withContext( , "/applications", - {} - ) - ) + {}, + ), + ), ); let firstRow = screen.getAllByRole("row")[1]; @@ -181,9 +181,9 @@ describe("DataTable", () => { withContext( , "/applications", - {} - ) - ) + {}, + ), + ), ); const nameButton = screen.getByText("Name"); @@ -202,9 +202,9 @@ describe("DataTable", () => { withContext( , "/applications", - {} - ) - ) + {}, + ), + ), ) .toJSON(); expect(tree).toMatchSnapshot(); diff --git a/ui/components/DataTable/__tests__/DataTableFilters.test.tsx b/ui/components/DataTable/__tests__/DataTableFilters.test.tsx index 254ea7ab5d..0fa209909c 100644 --- a/ui/components/DataTable/__tests__/DataTableFilters.test.tsx +++ b/ui/components/DataTable/__tests__/DataTableFilters.test.tsx @@ -187,9 +187,9 @@ describe("DataTableFilters", () => { withContext( , "/applications", - {} - ) - ) + {}, + ), + ), ); expect(screen.queryAllByText("slick")).toBeTruthy(); @@ -212,13 +212,13 @@ describe("DataTableFilters", () => { dialogOpen />, "/applications", - {} - ) - ) + {}, + ), + ), ); const checkbox1 = document.getElementById( - `type${filterSeparator}foo` + `type${filterSeparator}foo`, ) as HTMLInputElement; fireEvent.click(checkbox1); @@ -232,7 +232,7 @@ describe("DataTableFilters", () => { expect(chip1).toBeTruthy(); const checkbox2 = document.getElementById( - `type${filterSeparator}baz` + `type${filterSeparator}baz`, ) as HTMLInputElement; fireEvent.click(checkbox2); @@ -259,13 +259,13 @@ describe("DataTableFilters", () => { dialogOpen />, "/applications", - {} - ) - ) + {}, + ), + ), ); const checkbox1 = document.getElementById( - `status${filterSeparator}Ready` + `status${filterSeparator}Ready`, ) as HTMLInputElement; fireEvent.click(checkbox1); @@ -278,7 +278,7 @@ describe("DataTableFilters", () => { expect(chip1).toBeTruthy(); const checkbox2 = document.getElementById( - `status${filterSeparator}Suspended` + `status${filterSeparator}Suspended`, ) as HTMLInputElement; fireEvent.click(checkbox2); @@ -304,9 +304,9 @@ describe("DataTableFilters", () => { dialogOpen />, "/applications", - {} - ) - ) + {}, + ), + ), ); const checkbox1 = document.getElementById("status") as HTMLInputElement; @@ -335,9 +335,9 @@ describe("DataTableFilters", () => { dialogOpen />, "/applications", - {} - ) - ) + {}, + ), + ), ); const checkbox1 = document.getElementById("status") as HTMLInputElement; fireEvent.click(checkbox1); @@ -365,13 +365,13 @@ describe("DataTableFilters", () => { dialogOpen />, "/applications", - {} - ) - ) + {}, + ), + ), ); const checkbox1 = document.getElementById( - `type${filterSeparator}foo` + `type${filterSeparator}foo`, ) as HTMLInputElement; fireEvent.click(checkbox1); @@ -407,13 +407,13 @@ describe("DataTableFilters", () => { dialogOpen />, "/applications", - {} - ) - ) + {}, + ), + ), ); const checkbox1 = document.getElementById( - `type${filterSeparator}foo` + `type${filterSeparator}foo`, ) as HTMLInputElement; fireEvent.click(checkbox1); const chip1 = screen.getByText(`type${filterSeparator}foo`); @@ -423,7 +423,7 @@ describe("DataTableFilters", () => { expect(tableRows1).toHaveLength(2); const checkbox2 = document.getElementById( - `type${filterSeparator}baz` + `type${filterSeparator}baz`, ) as HTMLInputElement; fireEvent.click(checkbox2); const chip2 = screen.getByText(`type${filterSeparator}baz`); @@ -456,9 +456,9 @@ describe("DataTableFilters", () => { dialogOpen />, "/applications", - {} - ) - ) + {}, + ), + ), ); const searchTerms = "my-criterion"; @@ -483,9 +483,9 @@ describe("DataTableFilters", () => { dialogOpen />, "/applications", - {} - ) - ) + {}, + ), + ), ); const searchTerms = "my-criterion"; @@ -513,9 +513,9 @@ describe("DataTableFilters", () => { dialogOpen />, "/applications", - {} - ) - ) + {}, + ), + ), ); const searchTerms = rows[0].name; @@ -531,9 +531,9 @@ describe("DataTableFilters", () => { withContext( , "/applications", - {} - ) - ) + {}, + ), + ), ); const term1 = "a"; @@ -552,9 +552,9 @@ describe("DataTableFilters", () => { withContext( , "/applications", - {} - ) - ) + {}, + ), + ), ); const row = rows[0]; @@ -582,9 +582,9 @@ describe("DataTableFilters", () => { dialogOpen />, "/applications" + search, - {} - ) - ) + {}, + ), + ), ); const tableRows = document.querySelectorAll("tbody tr"); expect(tableRows).toHaveLength(1); diff --git a/ui/components/DataTable/helpers.ts b/ui/components/DataTable/helpers.ts index 8c91186c8e..d61d80d8b6 100644 --- a/ui/components/DataTable/helpers.ts +++ b/ui/components/DataTable/helpers.ts @@ -20,7 +20,7 @@ export const filterByStatusCallback = (v) => { export function filterConfig( rows, key: string, - computeValue?: (k: any) => any + computeValue?: (k: any) => any, ): FilterConfig { const config = _.reduce( rows, @@ -32,7 +32,7 @@ export function filterConfig( return r; }, - [] + [], ); return { [key]: { options: config, transformFunc: computeValue } }; @@ -66,7 +66,7 @@ export function filterRows(rows: T[], filters: FilterConfig) { export function filterText( rows, fields: Field[], - textFilters: FilterState["textFilters"] + textFilters: FilterState["textFilters"], ) { if (textFilters.length === 0) { return rows; @@ -119,7 +119,7 @@ export function initialFormState(cfg: FilterConfig, initialSelections?) { return r; }, - {} + {}, ); return allFilters; } @@ -169,7 +169,7 @@ export const sortByField = ( reverseSort: boolean, sortFields: Field[], useSecondarySort?: boolean, - disableSort?: boolean + disableSort?: boolean, ) => { if (disableSort) { return rows; @@ -190,6 +190,6 @@ export const sortByField = ( reverseSort && (!useSecondarySort || index != 1) ? "desc" : "asc"; return sortOrders; - }) + }), ); }; diff --git a/ui/components/DependenciesView.tsx b/ui/components/DependenciesView.tsx index 4f95d2fdc7..3868370603 100644 --- a/ui/components/DependenciesView.tsx +++ b/ui/components/DependenciesView.tsx @@ -21,7 +21,7 @@ const graphNodesPlaceholder = [] as FluxObjectNode[]; function DependenciesView({ className, automation }: DependenciesViewProps) { const [graphNodes, setGraphNodes] = React.useState( - null + null, ); const automationKind = Kind[automation?.type]; diff --git a/ui/components/ErrorList.tsx b/ui/components/ErrorList.tsx index 9d233a2cac..02b8bc1e5b 100644 --- a/ui/components/ErrorList.tsx +++ b/ui/components/ErrorList.tsx @@ -72,7 +72,7 @@ function ErrorList({ className, errors }: Props) { } const uniq = uniqBy(errors, (error) => - [error.clusterName, error.message].join() + [error.clusterName, error.message].join(), ); const sorted = sortBy(uniq, "clusterName", "namespace", "message"); diff --git a/ui/components/FilterDialog.tsx b/ui/components/FilterDialog.tsx index 2363b3f07d..6766180d55 100644 --- a/ui/components/FilterDialog.tsx +++ b/ui/components/FilterDialog.tsx @@ -51,7 +51,7 @@ const FilterSection = ({ onSectionSelect, }: FilterSectionProps) => { const compoundKeys = options.map( - (option) => `${header}${filterSeparator}${option}` + (option) => `${header}${filterSeparator}${option}`, ); // every on an empty list is true so check that too const all = @@ -112,7 +112,7 @@ export interface Props { export function selectionsToFilters( values: FilterSelections, - filterList: FilterConfig + filterList: FilterConfig, ): FilterConfig { const out = {}; _.each(values, (v, k) => { diff --git a/ui/components/FluxRuntime.tsx b/ui/components/FluxRuntime.tsx index d3299bd250..91ca9c8725 100644 --- a/ui/components/FluxRuntime.tsx +++ b/ui/components/FluxRuntime.tsx @@ -76,7 +76,7 @@ function FluxRuntime({ className, deployments, crds }: Props) { > {subRoute.component()} - ) + ), )} diff --git a/ui/components/FormInput.tsx b/ui/components/FormInput.tsx index d230fecc37..9fd932025a 100644 --- a/ui/components/FormInput.tsx +++ b/ui/components/FormInput.tsx @@ -30,7 +30,7 @@ export const Label = styled( {children} - ) + ), )` ${Text} { text-transform: uppercase; diff --git a/ui/components/HealthCheckStatusIndicator.tsx b/ui/components/HealthCheckStatusIndicator.tsx index f991f0dd20..c8ecf47505 100644 --- a/ui/components/HealthCheckStatusIndicator.tsx +++ b/ui/components/HealthCheckStatusIndicator.tsx @@ -19,7 +19,7 @@ type IndicatorInfo = { }; export const getIndicatorInfo = ( - healthType: HealthStatusType + healthType: HealthStatusType, ): IndicatorInfo => { switch (healthType) { case HealthStatusType.Unhealthy: @@ -57,7 +57,7 @@ function HealthCheckStatusIndicator({ health: { message?: string; status?: string }; }) { const { type, color, icon } = getIndicatorInfo( - HealthStatusType[health.status] + HealthStatusType[health.status], ); const text = health.message ? health.message : type; diff --git a/ui/components/ImageAutomation/ImageAutomation.tsx b/ui/components/ImageAutomation/ImageAutomation.tsx index 76b6c8f29a..2a5b804a9d 100644 --- a/ui/components/ImageAutomation/ImageAutomation.tsx +++ b/ui/components/ImageAutomation/ImageAutomation.tsx @@ -45,7 +45,7 @@ const ImageAutomation = () => { {subRoute.component()} - ) + ), )} diff --git a/ui/components/ImageAutomation/policies/ImagePolicyDetails.tsx b/ui/components/ImageAutomation/policies/ImagePolicyDetails.tsx index 3aaea44688..81715492a7 100644 --- a/ui/components/ImageAutomation/policies/ImagePolicyDetails.tsx +++ b/ui/components/ImageAutomation/policies/ImagePolicyDetails.tsx @@ -30,7 +30,7 @@ function ImagePolicyDetails({ clusterName, { refetchInterval: 5000, - } + }, ); const { isFlagEnabled } = useFeatureFlags(); const rootPath = V2Routes.ImagePolicyDetails; diff --git a/ui/components/ImageAutomation/repositories/ImageAutomationRepoDetails.tsx b/ui/components/ImageAutomation/repositories/ImageAutomationRepoDetails.tsx index d03fde5edf..b15114a767 100644 --- a/ui/components/ImageAutomation/repositories/ImageAutomationRepoDetails.tsx +++ b/ui/components/ImageAutomation/repositories/ImageAutomationRepoDetails.tsx @@ -32,7 +32,7 @@ function ImageAutomationRepoDetails({ clusterName, { refetchInterval: 5000, - } + }, ); const { isFlagEnabled } = useFeatureFlags(); const rootPath = V2Routes.ImageAutomationRepositoryDetails; diff --git a/ui/components/ImageAutomation/repositories/ImageRepositoriesTable.tsx b/ui/components/ImageAutomation/repositories/ImageRepositoriesTable.tsx index 4fe895da23..bda6180f4c 100644 --- a/ui/components/ImageAutomation/repositories/ImageRepositoriesTable.tsx +++ b/ui/components/ImageAutomation/repositories/ImageRepositoriesTable.tsx @@ -12,7 +12,7 @@ import RequestStateHandler from "../../RequestStateHandler"; const ImageRepositoriesTable = () => { const { data, isLoading, error } = useListImageAutomation( - Kind.ImageRepository + Kind.ImageRepository, ); const initialFilterState = { ...filterConfig(data?.objects, "name"), diff --git a/ui/components/ImageAutomation/updates/ImageAutomationUpdatesDetails.tsx b/ui/components/ImageAutomation/updates/ImageAutomationUpdatesDetails.tsx index 1fc004fbb1..ec79166c4f 100644 --- a/ui/components/ImageAutomation/updates/ImageAutomationUpdatesDetails.tsx +++ b/ui/components/ImageAutomation/updates/ImageAutomationUpdatesDetails.tsx @@ -20,7 +20,7 @@ type Props = { }; function getInfoList( data: ImageUpdateAutomation, - clusterName: string + clusterName: string, ): RowItem[] { const { kind, @@ -90,7 +90,7 @@ function ImageAutomationUpdatesDetails({ clusterName, { refetchInterval: 5000, - } + }, ); const rootPath = V2Routes.ImageAutomationUpdatesDetails; diff --git a/ui/components/ImageAutomation/updates/ImageAutomationUpdatesTable.tsx b/ui/components/ImageAutomation/updates/ImageAutomationUpdatesTable.tsx index 75d1176a1b..09a6f44746 100644 --- a/ui/components/ImageAutomation/updates/ImageAutomationUpdatesTable.tsx +++ b/ui/components/ImageAutomation/updates/ImageAutomationUpdatesTable.tsx @@ -14,7 +14,7 @@ import Timestamp from "../../Timestamp"; const ImageAutomationUpdatesTable = () => { const { data, isLoading, error } = useListImageAutomation( - Kind.ImageUpdateAutomation + Kind.ImageUpdateAutomation, ); const initialFilterState = { ...filterConfig(data?.objects, "name"), diff --git a/ui/components/InfoList.tsx b/ui/components/InfoList.tsx index e108e1aa4c..6d471bdfa9 100644 --- a/ui/components/InfoList.tsx +++ b/ui/components/InfoList.tsx @@ -14,7 +14,7 @@ const InfoList = styled( ))} ); - } + }, )``; export default InfoList; diff --git a/ui/components/InfoModal.tsx b/ui/components/InfoModal.tsx index eb266d11fe..7d054ffafe 100644 --- a/ui/components/InfoModal.tsx +++ b/ui/components/InfoModal.tsx @@ -38,7 +38,7 @@ function InfoModal({ searchedNamespaces, onCloseModal, open }: Props) { ))} - ) + ), )} diff --git a/ui/components/KubeStatusIndicator.tsx b/ui/components/KubeStatusIndicator.tsx index da433171f2..20e01e0d40 100644 --- a/ui/components/KubeStatusIndicator.tsx +++ b/ui/components/KubeStatusIndicator.tsx @@ -35,7 +35,7 @@ export function computeReady(conditions: Condition[]): ReadyType { if (!conditions?.length) return undefined; const readyCondition = _.find( conditions, - (c) => c.type === "Ready" || c.type === "Available" + (c) => c.type === "Ready" || c.type === "Available", ); if (readyCondition) { @@ -68,7 +68,7 @@ export function computeMessage(conditions: Condition[]) { const readyCondition = _.find( conditions, - (c) => c.type === "Ready" || c.type === "Available" + (c) => c.type === "Ready" || c.type === "Available", ); if (readyCondition) { @@ -77,7 +77,7 @@ export function computeMessage(conditions: Condition[]) { const falseCondition = _.find( conditions, - (c) => c.status === ReadyStatusValue.False + (c) => c.status === ReadyStatusValue.False, ); if (falseCondition) { @@ -95,7 +95,7 @@ type IndicatorInfo = { export const getIndicatorInfo = ( suspended: boolean, - conditions: Condition[] + conditions: Condition[], ): IndicatorInfo => { if (suspended) return { @@ -171,7 +171,7 @@ export function createSyntheticCondition( kind: SpecialObject, // This will eventually be a union type when we add another special object. // Example: DaemonSetStatus | CoolObjectStatus | ... - status: DaemonSetStatus + status: DaemonSetStatus, ): Condition { switch (kind) { case "DaemonSet": diff --git a/ui/components/Pendo.tsx b/ui/components/Pendo.tsx index 27e381bf09..5dff0a0453 100644 --- a/ui/components/Pendo.tsx +++ b/ui/components/Pendo.tsx @@ -59,7 +59,7 @@ export default function Pendo({ console.warn("no local storage found"); } else { pendoKeys = Object.keys(window.localStorage).filter( - (key) => key.toLowerCase().indexOf(pendoKey) != -1 + (key) => key.toLowerCase().indexOf(pendoKey) != -1, ); } @@ -129,7 +129,7 @@ export default function Pendo({ o[m] || function () { o._q[m === v[0] ? "unshift" : "push"]( - [m].concat([].slice.call(arguments, 0)) + [m].concat([].slice.call(arguments, 0)), ); }; })(v[w]); diff --git a/ui/components/Policies/PolicyViolations/PolicyViolationPage.tsx b/ui/components/Policies/PolicyViolations/PolicyViolationPage.tsx index 01336f439c..03e5a51e09 100644 --- a/ui/components/Policies/PolicyViolations/PolicyViolationPage.tsx +++ b/ui/components/Policies/PolicyViolations/PolicyViolationPage.tsx @@ -33,7 +33,7 @@ const getPath = (kind: string, violation?: PolicyValidation) => { name: entity, namespace: namespace, clusterName: clusterName, - } + }, ); return [ { label: "Applications", url: V2Routes.Automations }, diff --git a/ui/components/Policies/__tests__/HeaderRows.test.tsx b/ui/components/Policies/__tests__/HeaderRows.test.tsx index 42c220058b..0eba74774a 100644 --- a/ui/components/Policies/__tests__/HeaderRows.test.tsx +++ b/ui/components/Policies/__tests__/HeaderRows.test.tsx @@ -28,7 +28,7 @@ describe("HeaderRows", () => { render(withTheme()); items.forEach((h) => { const ele = document.querySelector( - `[data-testid="${h.rowkey}"]` + `[data-testid="${h.rowkey}"]`, ) as HTMLElement; if (h.visible !== false) { expect(ele).toBeTruthy(); diff --git a/ui/components/Policies/__tests__/Parameters.test.tsx b/ui/components/Policies/__tests__/Parameters.test.tsx index 82f82a9161..4fa01a8753 100644 --- a/ui/components/Policies/__tests__/Parameters.test.tsx +++ b/ui/components/Policies/__tests__/Parameters.test.tsx @@ -57,17 +57,17 @@ describe("Parameters", () => { } const policyConfig = row.querySelector( - `[data-testid="Policy Config Name"]` + `[data-testid="Policy Config Name"]`, ); expect(policyConfig.textContent).toEqual( - `Policy Config Name${p.configRef || "-"}` + `Policy Config Name${p.configRef || "-"}`, ); }); }); it("validate Policy parameters display", async () => { render( - withTheme() + withTheme(), ); parameters.forEach((p) => { const row = document.querySelector(`.${p.name}`); @@ -89,7 +89,7 @@ describe("Parameters", () => { const requiredParam = row.querySelector(`[data-testid="Required"]`); expect(requiredParam.textContent).toEqual( - `Required${p.required ? "True" : "False"}` + `Required${p.required ? "True" : "False"}`, ); }); }); diff --git a/ui/components/Policies/__tests__/Severity.test.tsx b/ui/components/Policies/__tests__/Severity.test.tsx index e6f441fcc8..d019ab8715 100644 --- a/ui/components/Policies/__tests__/Severity.test.tsx +++ b/ui/components/Policies/__tests__/Severity.test.tsx @@ -6,7 +6,7 @@ import Severity from "../Utils/Severity"; function checkSeverity(severity: string) { render(withTheme()); const ele = document.querySelector( - `[data-testid="${severity}"]` + `[data-testid="${severity}"]`, ) as HTMLElement; expect(ele).toBeTruthy(); expect(ele.textContent).toEqual(severity); diff --git a/ui/components/ProviderDetail.tsx b/ui/components/ProviderDetail.tsx index be33bb399d..0e32bb92b8 100644 --- a/ui/components/ProviderDetail.tsx +++ b/ui/components/ProviderDetail.tsx @@ -34,7 +34,7 @@ function ProviderDetail({ className, provider }: Props) { header={createYamlCommand( Kind.Provider, provider.name, - provider.namespace + provider.namespace, )} yaml={provider.yaml} /> diff --git a/ui/components/ReconciliationGraph.tsx b/ui/components/ReconciliationGraph.tsx index 163fec14fc..cfd8a1b874 100644 --- a/ui/components/ReconciliationGraph.tsx +++ b/ui/components/ReconciliationGraph.tsx @@ -50,7 +50,7 @@ function ReconciliationGraph({ name, clusterName, namespace, - true + true, ); return ( diff --git a/ui/components/SearchField.tsx b/ui/components/SearchField.tsx index a075a77097..43623175a5 100644 --- a/ui/components/SearchField.tsx +++ b/ui/components/SearchField.tsx @@ -23,7 +23,7 @@ const Expander = styled(
{children}
- ) + ), )` width: 0px; transition: width 0.3s ease-in-out; diff --git a/ui/components/SourceLink.tsx b/ui/components/SourceLink.tsx index bb555e2df7..9e6d4468b4 100644 --- a/ui/components/SourceLink.tsx +++ b/ui/components/SourceLink.tsx @@ -21,7 +21,7 @@ function SourceLink({ className, sourceRef, clusterName, short }: Props) { sourceRef.kind, sourceRef.name, sourceRef.namespace, - clusterName + clusterName, )} > {!short && sourceRef.kind + "/"} diff --git a/ui/components/Sync/CheckboxActions.tsx b/ui/components/Sync/CheckboxActions.tsx index fde5fde289..d3b838a373 100644 --- a/ui/components/Sync/CheckboxActions.tsx +++ b/ui/components/Sync/CheckboxActions.tsx @@ -35,7 +35,7 @@ const noSource = { function createSuspendHandler( reqObjects: ObjectRef[], suspend: boolean, - suspendMessage: string + suspendMessage: string, ) { const result = useToggleSuspend( { @@ -46,7 +46,7 @@ function createSuspendHandler( reqObjects[0]?.kind === "HelmRelease" || reqObjects[0]?.kind === "Kustomization" ? "automations" - : "sources" + : "sources", ); return result; } diff --git a/ui/components/Sync/SyncActions.tsx b/ui/components/Sync/SyncActions.tsx index 9b48971bfa..45d795ccd1 100644 --- a/ui/components/Sync/SyncActions.tsx +++ b/ui/components/Sync/SyncActions.tsx @@ -57,7 +57,7 @@ const SyncActions = ({ suspend: true, comment: suspendMessage, }, - "object" + "object", ); const resume = useToggleSuspend( @@ -66,7 +66,7 @@ const SyncActions = ({ suspend: false, comment: "", }, - "object" + "object", ); return ( diff --git a/ui/components/Sync/SyncControls.tsx b/ui/components/Sync/SyncControls.tsx index 019183054e..791416c51f 100644 --- a/ui/components/Sync/SyncControls.tsx +++ b/ui/components/Sync/SyncControls.tsx @@ -108,7 +108,7 @@ const SyncControls = ({ onResumeClick, }: Props) => { const [syncType, setSyncType] = React.useState( - hideSyncOptions ? SyncType.WithoutSource : SyncType.WithSource + hideSyncOptions ? SyncType.WithoutSource : SyncType.WithSource, ); const handleSyncTypeChange = (value: SyncType) => { diff --git a/ui/components/Sync/__tests__/SyncActions.test.tsx b/ui/components/Sync/__tests__/SyncActions.test.tsx index a6fc56bf5a..5880572f00 100644 --- a/ui/components/Sync/__tests__/SyncActions.test.tsx +++ b/ui/components/Sync/__tests__/SyncActions.test.tsx @@ -22,9 +22,9 @@ describe("SyncActions", () => { , "/", - {} - ) - ) + {}, + ), + ), ) .toJSON(); expect(tree).toMatchSnapshot(); @@ -38,9 +38,9 @@ describe("SyncActions", () => { , "/", - {} - ) - ) + {}, + ), + ), ) .toJSON(); expect(tree).toMatchSnapshot(); @@ -54,9 +54,9 @@ describe("SyncActions", () => { , "/", - {} - ) - ) + {}, + ), + ), ) .toJSON(); expect(tree).toMatchSnapshot(); diff --git a/ui/components/Sync/__tests__/SyncControls.test.tsx b/ui/components/Sync/__tests__/SyncControls.test.tsx index e3a4f6498c..3dad27ea40 100644 --- a/ui/components/Sync/__tests__/SyncControls.test.tsx +++ b/ui/components/Sync/__tests__/SyncControls.test.tsx @@ -22,9 +22,9 @@ describe("SyncControls", () => { {}} /> , "/", - {} - ) - ) + {}, + ), + ), ) .toJSON(); expect(tree).toMatchSnapshot(); @@ -43,9 +43,9 @@ describe("SyncControls", () => { /> , "/", - {} - ) - ) + {}, + ), + ), ) .toJSON(); expect(tree).toMatchSnapshot(); @@ -59,9 +59,9 @@ describe("SyncControls", () => { {}} /> , "/", - {} - ) - ) + {}, + ), + ), ) .toJSON(); expect(tree).toMatchSnapshot(); @@ -75,9 +75,9 @@ describe("SyncControls", () => { {}} /> , "/", - {} - ) - ) + {}, + ), + ), ) .toJSON(); expect(tree).toMatchSnapshot(); @@ -94,9 +94,9 @@ describe("SyncControls", () => { /> , "/", - {} - ) - ) + {}, + ), + ), ) .toJSON(); expect(tree).toMatchSnapshot(); diff --git a/ui/components/Timestamp.tsx b/ui/components/Timestamp.tsx index 498b256a69..effda2353f 100644 --- a/ui/components/Timestamp.tsx +++ b/ui/components/Timestamp.tsx @@ -15,7 +15,7 @@ function Timestamp({ className, time, hideSeconds, tooltip }: Props) { let relativeTime = dateTime.toRelative(); const fullTime = dateTime.toLocaleString( - DateTime.DATETIME_SHORT_WITH_SECONDS + DateTime.DATETIME_SHORT_WITH_SECONDS, ); if (hideSeconds && relativeTime.includes("second")) { diff --git a/ui/components/VerifiedStatus.tsx b/ui/components/VerifiedStatus.tsx index 4643c0c580..bf66a59b5c 100644 --- a/ui/components/VerifiedStatus.tsx +++ b/ui/components/VerifiedStatus.tsx @@ -37,7 +37,7 @@ const getStatusIcon = (source) => { }; export const findVerificationCondition = ( - a: VerifiableSource + a: VerifiableSource, ): Condition | undefined => a?.conditions?.find((condition) => condition.type === "SourceVerified"); @@ -56,7 +56,7 @@ export const SourceIsVerifiedStatus: React.FC<{ sourceRef: ObjectRef }> = ({ }): JSX.Element | null => { const { data: sources } = useListSources(); const currentSource = sources?.result.find( - (source) => sourceRef?.name === source.name + (source) => sourceRef?.name === source.name, ) as GitRepository | OCIRepository | undefined; if (!currentSource?.isVerifiable) return -; diff --git a/ui/components/__tests__/AlertsTable.test.tsx b/ui/components/__tests__/AlertsTable.test.tsx index 1d134ff087..740ccee88a 100644 --- a/ui/components/__tests__/AlertsTable.test.tsx +++ b/ui/components/__tests__/AlertsTable.test.tsx @@ -14,7 +14,7 @@ describe("AlertsTable", () => { const sourceLink = makeEventSourceLink(allNames); expect(sourceLink.includes("/sources")).toEqual(true); expect( - sourceLink.includes("type") && sourceLink.includes("GitRepository") + sourceLink.includes("type") && sourceLink.includes("GitRepository"), ).toEqual(true); expect(sourceLink.includes("*")).toEqual(false); const allNamespaces = { @@ -27,7 +27,7 @@ describe("AlertsTable", () => { const automationLink = makeEventSourceLink(allNamespaces); expect(automationLink.includes("/applications")).toEqual(true); expect( - automationLink.includes("name") && automationLink.includes("goose") + automationLink.includes("name") && automationLink.includes("goose"), ).toEqual(true); expect(automationLink.includes("namespace")).toEqual(false); }); diff --git a/ui/components/__tests__/Breadcrumbs.test.tsx b/ui/components/__tests__/Breadcrumbs.test.tsx index ca8bedbed5..2110eae34d 100644 --- a/ui/components/__tests__/Breadcrumbs.test.tsx +++ b/ui/components/__tests__/Breadcrumbs.test.tsx @@ -11,21 +11,21 @@ function checkPath(path: Breadcrumb[]) { withTheme( - - ) + , + ), ); path.forEach(({ url, label }) => { if (url) { const ele = document.querySelector( - `[data-testid="link-${label}"]` + `[data-testid="link-${label}"]`, ) as HTMLLinkElement; expect(ele).toBeTruthy(); expect(ele.textContent).toEqual(label); expect(ele.href).toEqual(`${location.origin}${url}`); } else { const ele = document.querySelector( - `[data-testid="text-${label}"]` + `[data-testid="text-${label}"]`, ) as HTMLElement; expect(ele).toBeTruthy(); expect(ele.textContent).toEqual(label); diff --git a/ui/components/__tests__/ChipGroup.test.tsx b/ui/components/__tests__/ChipGroup.test.tsx index e936c919fa..ce619b3a78 100644 --- a/ui/components/__tests__/ChipGroup.test.tsx +++ b/ui/components/__tests__/ChipGroup.test.tsx @@ -23,8 +23,8 @@ describe("ChipGroup", () => { chips={chipList} onChipRemove={setActiveChips} onClearAll={() => jest.fn()} - /> - ) + />, + ), ); expect(screen.queryByText("app")).toBeTruthy(); expect(screen.queryByText("app3")).toBeTruthy(); @@ -37,8 +37,8 @@ describe("ChipGroup", () => { chips={chipList} onChipRemove={setActiveChips} onClearAll={() => jest.fn()} - /> - ) + />, + ), ); expect(screen.queryByText(`appapp${filterSeparator}null`)).toBeTruthy(); expect(screen.queryByText(`app${filterSeparator}app`)).toBeTruthy(); diff --git a/ui/components/__tests__/FilterDialog.test.tsx b/ui/components/__tests__/FilterDialog.test.tsx index 5657ea06ed..ae936c7386 100644 --- a/ui/components/__tests__/FilterDialog.test.tsx +++ b/ui/components/__tests__/FilterDialog.test.tsx @@ -21,11 +21,11 @@ describe("FilterDialog", () => { formState={initialFormState(filterList)} onFilterSelect={setActiveFilters} open={false} - /> - ) + />, + ), ); expect(screen.getByTestId("container").getAttribute("class")).not.toContain( - "open" + "open", ); }); it("should reveal filter list when open", () => { @@ -36,11 +36,11 @@ describe("FilterDialog", () => { formState={initialFormState(filterList)} filterList={filterList} onFilterSelect={setActiveFilters} - /> - ) + />, + ), ); expect(screen.getByTestId("container").getAttribute("class")).toContain( - "open" + "open", ); }); it("should return a value when a parameter is clicked", () => { @@ -52,12 +52,12 @@ describe("FilterDialog", () => { formState={initialFormState(filterList)} filterList={filterList} onFilterSelect={onFilterSelect} - /> - ) + />, + ), ); const checkbox1 = document.getElementById( - `Name${filterSeparator}app` + `Name${filterSeparator}app`, ) as HTMLInputElement; expect(checkbox1.checked).toEqual(false); diff --git a/ui/components/__tests__/Flex.test.tsx b/ui/components/__tests__/Flex.test.tsx index 11ab9ead3e..ab351c5026 100644 --- a/ui/components/__tests__/Flex.test.tsx +++ b/ui/components/__tests__/Flex.test.tsx @@ -22,7 +22,7 @@ describe("Flex", () => { .create( My Text - + , ) .toJSON(); expect(tree).toMatchSnapshot(); diff --git a/ui/components/__tests__/FluxObjectsTable.test.tsx b/ui/components/__tests__/FluxObjectsTable.test.tsx index 0e965a4457..68ad9acc6a 100644 --- a/ui/components/__tests__/FluxObjectsTable.test.tsx +++ b/ui/components/__tests__/FluxObjectsTable.test.tsx @@ -16,7 +16,7 @@ describe("FluxObjectsTable", () => { beforeEach(() => { objs = _.map(objects, (o) => - convertResponse(o.obj.kind, { payload: JSON.stringify(o.obj) }) + convertResponse(o.obj.kind, { payload: JSON.stringify(o.obj) }), ); }); it("renders", async () => { @@ -27,9 +27,9 @@ describe("FluxObjectsTable", () => { , "/", - {} - ) - ) + {}, + ), + ), ); const rows = document.querySelectorAll("tbody tr"); @@ -56,9 +56,9 @@ describe("FluxObjectsTable", () => { , "/", - {} - ) - ) + {}, + ), + ), ); const rows = document.querySelectorAll("tbody tr"); @@ -84,9 +84,9 @@ describe("FluxObjectsTable", () => { , "/", - {} - ) - ) + {}, + ), + ), ); const rows = document.querySelectorAll("tbody tr"); @@ -117,9 +117,9 @@ describe("FluxObjectsTable", () => { /> , "/", - {} - ) - ) + {}, + ), + ), ); const secret = await screen.findByText("my-secret"); diff --git a/ui/components/__tests__/Footer.test.tsx b/ui/components/__tests__/Footer.test.tsx index ccebc27e00..f5d0127130 100644 --- a/ui/components/__tests__/Footer.test.tsx +++ b/ui/components/__tests__/Footer.test.tsx @@ -34,9 +34,9 @@ describe("Footer", () => { commit: "123abcd", }), }), - }) + }), ), - container + container, ); }); @@ -51,9 +51,9 @@ describe("Footer", () => { api: createCoreMockClient({ GetVersion: () => ({}), }), - }) + }), ), - container + container, ); }); diff --git a/ui/components/__tests__/KubeStatusIndicator.test.tsx b/ui/components/__tests__/KubeStatusIndicator.test.tsx index a52d381339..82831a2a33 100644 --- a/ui/components/__tests__/KubeStatusIndicator.test.tsx +++ b/ui/components/__tests__/KubeStatusIndicator.test.tsx @@ -109,7 +109,7 @@ describe("KubeStatusIndicator", () => { ]; render( - withTheme() + withTheme(), ); const msg = screen.getByText("Suspended"); expect(msg).toBeTruthy(); @@ -224,7 +224,7 @@ describe("KubeStatusIndicator", () => { ]; const tree = renderer .create( - withTheme() + withTheme(), ) .toJSON(); expect(tree).toMatchSnapshot(); @@ -241,7 +241,7 @@ describe("KubeStatusIndicator", () => { ]; const tree = renderer .create( - withTheme() + withTheme(), ) .toJSON(); expect(tree).toMatchSnapshot(); diff --git a/ui/components/__tests__/Link.test.tsx b/ui/components/__tests__/Link.test.tsx index debead558a..9bd21e7aa9 100644 --- a/ui/components/__tests__/Link.test.tsx +++ b/ui/components/__tests__/Link.test.tsx @@ -7,7 +7,7 @@ import Link from "../Link"; describe("Link", () => { it("doesn't create a link for oci links", () => { const { container: link } = render( - withTheme(Text) + withTheme(Text), ); const a = link.querySelector("a"); expect(a).toBe(null); @@ -15,7 +15,7 @@ describe("Link", () => { }); it("creates a link for http links", () => { const { container: link } = render( - withTheme(Text) + withTheme(Text), ); const a = link.querySelector("a"); expect(a).not.toBe(null); @@ -24,7 +24,7 @@ describe("Link", () => { }); it("creates a link for relative links", () => { const { container: link } = render( - withTheme(Text) + withTheme(Text), ); const a = link.querySelector("a"); expect(a).not.toBe(null); @@ -36,8 +36,8 @@ describe("Link", () => { withTheme( Text - - ) + , + ), ); const a = link.querySelector("a"); expect(a).not.toBe(null); @@ -49,8 +49,8 @@ describe("Link", () => { withTheme( Text - - ) + , + ), ); const a = link.querySelector("a"); expect(a).not.toBe(null); @@ -62,8 +62,8 @@ describe("Link", () => { withTheme( Text - - ) + , + ), ); const a = link.querySelector("a"); expect(a).not.toBe(null); diff --git a/ui/components/__tests__/MessageBox.test.tsx b/ui/components/__tests__/MessageBox.test.tsx index b968b694e6..901233c40e 100644 --- a/ui/components/__tests__/MessageBox.test.tsx +++ b/ui/components/__tests__/MessageBox.test.tsx @@ -9,7 +9,7 @@ describe("MessageBox", () => { it("renders", () => { const tree = renderer .create( - withTheme(Column and items centered.) + withTheme(Column and items centered.), ) .toJSON(); expect(tree).toMatchSnapshot(); diff --git a/ui/components/__tests__/Metadata.test.tsx b/ui/components/__tests__/Metadata.test.tsx index da1189f77c..778360ff0e 100644 --- a/ui/components/__tests__/Metadata.test.tsx +++ b/ui/components/__tests__/Metadata.test.tsx @@ -30,8 +30,8 @@ describe("Metadata", () => { ["label", "label"], ["goose", "goose"], ]} - /> - ) + />, + ), ) .toJSON(); expect(tree).toMatchSnapshot(); diff --git a/ui/components/__tests__/Page.test.tsx b/ui/components/__tests__/Page.test.tsx index 3e7b52b4b7..8f86801b76 100644 --- a/ui/components/__tests__/Page.test.tsx +++ b/ui/components/__tests__/Page.test.tsx @@ -23,9 +23,9 @@ describe("Page", () => { , "/", - {} - ) - ) + {}, + ), + ), ) .toJSON(); expect(tree).toMatchSnapshot(); diff --git a/ui/components/__tests__/Pagination.test.tsx b/ui/components/__tests__/Pagination.test.tsx index 12767524d6..123b2ea8fa 100644 --- a/ui/components/__tests__/Pagination.test.tsx +++ b/ui/components/__tests__/Pagination.test.tsx @@ -22,8 +22,8 @@ describe("Pagination", () => { index={5} length={1} totalObjects={10} - /> - ) + />, + ), ); const back = screen.getByLabelText("back one page"); const skipBack = screen.getByLabelText("skip to first page"); @@ -52,8 +52,8 @@ describe("Pagination", () => { index={0} length={1} totalObjects={3} - /> - ) + />, + ), ); const back = screen.getByLabelText("back one page"); const skipBack = screen.getByLabelText("skip to first page"); @@ -76,8 +76,8 @@ describe("Pagination", () => { index={0} length={1} totalObjects={3} - /> - ) + />, + ), ); let select; screen.getAllByText("25").forEach((button) => { diff --git a/ui/components/__tests__/Version.test.tsx b/ui/components/__tests__/Version.test.tsx index 6e7678479b..9c8d3d8e0b 100644 --- a/ui/components/__tests__/Version.test.tsx +++ b/ui/components/__tests__/Version.test.tsx @@ -14,8 +14,8 @@ describe("Version", () => { const tree = renderer .create( withTheme( - - ) + , + ), ) .toJSON(); expect(tree).toMatchSnapshot(); @@ -27,8 +27,8 @@ describe("Version", () => { - ) + />, + ), ) .toJSON(); expect(tree).toMatchSnapshot(); @@ -40,8 +40,8 @@ describe("Version", () => { - ) + />, + ), ) .toJSON(); expect(tree).toMatchSnapshot(); @@ -53,8 +53,8 @@ describe("Version", () => { - ) + />, + ), ) .toJSON(); expect(tree).toMatchSnapshot(); diff --git a/ui/components/__tests__/YamlView.test.tsx b/ui/components/__tests__/YamlView.test.tsx index c21c01cb3d..262b7c5a36 100644 --- a/ui/components/__tests__/YamlView.test.tsx +++ b/ui/components/__tests__/YamlView.test.tsx @@ -17,14 +17,14 @@ describe("YamlView", () => { header={createYamlCommand( Kind.Kustomization, "podinfo", - "flux-system" + "flux-system", )} yaml="yaml\nyaml\nyaml\n" />, "", - {} - ) - ) + {}, + ), + ), ) .toJSON(); expect(tree).toMatchSnapshot(); diff --git a/ui/contexts/AppContext.tsx b/ui/contexts/AppContext.tsx index 7f7400688c..c4e12a35df 100644 --- a/ui/contexts/AppContext.tsx +++ b/ui/contexts/AppContext.tsx @@ -37,7 +37,7 @@ export type AppContextType = { }; export const AppContext = React.createContext( - null as AppContextType + null as AppContextType, ); export interface AppProps { @@ -121,7 +121,7 @@ export default function AppContextProvider({ ...props }: AppProps) { }, request: ( input: RequestInfo | URL, - init?: RequestInit + init?: RequestInit, ): Promise => { if (typeof input === "string") { input = withBasePath(input); diff --git a/ui/contexts/AuthContext.tsx b/ui/contexts/AuthContext.tsx index 91116a6a82..10fead8ffc 100644 --- a/ui/contexts/AuthContext.tsx +++ b/ui/contexts/AuthContext.tsx @@ -95,7 +95,7 @@ export default function AuthContextProvider({ children }) { return response.json(); }) .then((data) => - setUserInfo({ email: data?.email, groups: data?.groups, id: data?.id }) + setUserInfo({ email: data?.email, groups: data?.groups, id: data?.id }), ) .catch((err) => console.log(err)) .finally(() => setLoading(false)); diff --git a/ui/contexts/CoreClientContext.tsx b/ui/contexts/CoreClientContext.tsx index c745da577f..09f147b2e9 100644 --- a/ui/contexts/CoreClientContext.tsx +++ b/ui/contexts/CoreClientContext.tsx @@ -32,7 +32,7 @@ function FeatureFlags(api) { { staleTime: Infinity, cacheTime: Infinity, - } + }, ); return data?.flags; } diff --git a/ui/contexts/__tests__/CoreClientContext.test.tsx b/ui/contexts/__tests__/CoreClientContext.test.tsx index a1ebf0f270..fea572e971 100644 --- a/ui/contexts/__tests__/CoreClientContext.test.tsx +++ b/ui/contexts/__tests__/CoreClientContext.test.tsx @@ -21,7 +21,7 @@ describe("CoreContextProvider", () => { - + , ); }); }); diff --git a/ui/hooks/Policies.ts b/ui/hooks/Policies.ts index bbb578b6d6..4ca8deae5a 100644 --- a/ui/hooks/Policies.ts +++ b/ui/hooks/Policies.ts @@ -17,13 +17,13 @@ export function useListPolicies( opts: ReactQueryOptions = { retry: false, refetchInterval: 5000, - } + }, ) { const { api } = useContext(CoreClientContext); return useQuery( [LIST_POLICIES_QUERY_KEY, req], () => api.ListPolicies(req), - opts + opts, ); } const GET_POLICY_QUERY_KEY = "get-policy-details"; @@ -33,13 +33,13 @@ export function useGetPolicyDetails( opts: ReactQueryOptions = { retry: false, refetchInterval: 5000, - } + }, ) { const { api } = useContext(CoreClientContext); return useQuery( [GET_POLICY_QUERY_KEY, req], () => api.GetPolicy(req), - opts + opts, ); } diff --git a/ui/hooks/__tests__/inventory.test.tsx b/ui/hooks/__tests__/inventory.test.tsx index 4a080b5dc3..bff80eb182 100644 --- a/ui/hooks/__tests__/inventory.test.tsx +++ b/ui/hooks/__tests__/inventory.test.tsx @@ -21,7 +21,7 @@ describe("createCanaryCondition", () => { falseCanary, trueCanary, unknownCanary, - ] as FluxObject[]).status + ] as FluxObject[]).status, ).toEqual(ReadyStatusValue.False); }); it("creates an unknown condition if no canaries are failing and one or more are unknown", () => { @@ -30,7 +30,7 @@ describe("createCanaryCondition", () => { trueCanary, trueCanary, unknownCanary, - ] as FluxObject[]).status + ] as FluxObject[]).status, ).toEqual(ReadyStatusValue.Unknown); }); it("creates a true condition if all canaries succeeded", () => { @@ -39,7 +39,7 @@ describe("createCanaryCondition", () => { trueCanary, trueCanary, trueCanary, - ] as FluxObject[]).status + ] as FluxObject[]).status, ).toEqual(ReadyStatusValue.True); }); it("creates a special condition if there are no canaries", () => { diff --git a/ui/hooks/automations.ts b/ui/hooks/automations.ts index 1089e1c569..e09ab37d79 100644 --- a/ui/hooks/automations.ts +++ b/ui/hooks/automations.ts @@ -29,7 +29,7 @@ export function useListAutomations( opts: ReactQueryOptions = { retry: false, refetchInterval: 5000, - } + }, ) { const { api } = useContext(CoreClientContext); @@ -43,7 +43,7 @@ export function useListAutomations( if (!response.objects) response.objects = []; if (!response.errors) response.errors = []; return { kind, response }; - }) + }), ); return Promise.all(p).then((responses) => { const final: Res = { @@ -54,20 +54,20 @@ export function useListAutomations( for (const { kind, response } of responses) { final.result.push( ...response.objects.map( - (o) => convertResponse(kind, o) as Automation - ) + (o) => convertResponse(kind, o) as Automation, + ), ); final.errors.push( ...response.errors.map((o) => { return { ...o, kind }; - }) + }), ); final.searchedNamespaces[kind] = response.searchedNamespaces; } return final; }); }, - opts + opts, ); } diff --git a/ui/hooks/events.ts b/ui/hooks/events.ts index f23b949db6..c6a6e39cc1 100644 --- a/ui/hooks/events.ts +++ b/ui/hooks/events.ts @@ -11,7 +11,7 @@ export function useListEvents( retry: false, refetchOnWindowFocus: false, refetchInterval: 5000, - } + }, ) { const { api } = useContext(CoreClientContext); @@ -21,6 +21,6 @@ export function useListEvents( api.ListEvents({ involvedObject: obj, }), - opts + opts, ); } diff --git a/ui/hooks/flux.ts b/ui/hooks/flux.ts index 96604dde23..b531f3070f 100644 --- a/ui/hooks/flux.ts +++ b/ui/hooks/flux.ts @@ -24,14 +24,14 @@ export function useListFluxRuntimeObjects( opts: ReactQueryOptions = { retry: false, refetchInterval: 5000, - } + }, ) { const { api } = useContext(CoreClientContext); return useQuery( "flux_runtime_objects", () => api.ListFluxRuntimeObjects({ namespace, clusterName }), - opts + opts, ); } @@ -41,7 +41,7 @@ export function useListFluxCrds(clusterName = DefaultCluster) { return useQuery( "flux_crds", () => api.ListFluxCrds({ clusterName }), - { retry: false, refetchInterval: 5000 } + { retry: false, refetchInterval: 5000 }, ); } @@ -51,14 +51,14 @@ export function useListRuntimeObjects( opts: ReactQueryOptions = { retry: false, refetchInterval: 5000, - } + }, ) { const { api } = useContext(CoreClientContext); return useQuery( "runtime_objects", () => api.ListRuntimeObjects({ namespace, clusterName }), - opts + opts, ); } @@ -68,13 +68,13 @@ export function useListRuntimeCrds(clusterName = DefaultCluster) { return useQuery( "runtime_crds", () => api.ListRuntimeCrds({ clusterName }), - { retry: false, refetchInterval: 5000 } + { retry: false, refetchInterval: 5000 }, ); } export function flattenChildren(children: FluxObject[]) { return children.flatMap((child) => - [child].concat(flattenChildren(child.children)) + [child].concat(flattenChildren(child.children)), ); } @@ -87,7 +87,7 @@ export function useGetReconciledObjects( opts: ReactQueryOptions = { retry: false, refetchInterval: 5000, - } + }, ) { const result = useGetReconciledTree( name, @@ -95,7 +95,7 @@ export function useGetReconciledObjects( type, kinds, clusterName, - opts + opts, ); if (result.data) { result.data = flattenChildren(result.data); @@ -112,20 +112,20 @@ export function useGetReconciledTree( opts: ReactQueryOptions = { retry: false, refetchInterval: 5000, - } + }, ) { const { api } = useContext(CoreClientContext); return useQuery( ["reconciled_objects", { name, namespace, type, kinds }], () => getChildren(api, name, namespace, type, kinds, clusterName), - opts + opts, ); } export function useToggleSuspend( req: ToggleSuspendResourceRequest, - type: string + type: string, ) { const { api } = useContext(CoreClientContext); const queryClient = useQueryClient(); @@ -140,7 +140,7 @@ export function useToggleSuspend( onError: (error) => { notifyError(error.message); }, - } + }, ); return mutation; } diff --git a/ui/hooks/imageautomation.ts b/ui/hooks/imageautomation.ts index 860094bf6c..aa27661c77 100644 --- a/ui/hooks/imageautomation.ts +++ b/ui/hooks/imageautomation.ts @@ -11,7 +11,7 @@ export function useListImageAutomation( opts: ReactQueryOptions = { retry: false, refetchInterval: 5000, - } + }, ) { const { api } = useContext(CoreClientContext); @@ -22,7 +22,7 @@ export function useListImageAutomation( const providers = res.objects?.map((obj) => convertResponse(kind, obj)); return { objects: providers, errors: res.errors }; }), - opts + opts, ); } @@ -31,7 +31,7 @@ export function useCheckCRDInstalled( opts: ReactQueryOptions = { retry: false, refetchInterval: (data) => (data ? false : 5000), - } + }, ) { const { api } = useContext(CoreClientContext); @@ -41,6 +41,6 @@ export function useCheckCRDInstalled( api.IsCRDAvailable({ name }).then(({ clusters }) => { return Object.values(clusters).some((r) => r === true); }), - opts + opts, ); } diff --git a/ui/hooks/inventory.ts b/ui/hooks/inventory.ts index 96966c863d..81afe27f7c 100644 --- a/ui/hooks/inventory.ts +++ b/ui/hooks/inventory.ts @@ -22,7 +22,7 @@ export function useGetInventory( opts: ReactQueryOptions = { retry: false, refetchInterval: (data) => (data ? false : 5000), - } + }, ) { const { api } = useContext(CoreClientContext); @@ -37,7 +37,7 @@ export function useGetInventory( : res.entries?.map((obj) => new FluxObject(obj)); return { objects: listObjects, errors: [] }; }), - opts + opts, ); } @@ -80,7 +80,7 @@ export const createCanaryCondition = (objs: FluxObject[]): Condition => { } return prev; }, - { True: 0, False: 0, Unknown: 0 } + { True: 0, False: 0, Unknown: 0 }, ); //create conditions object let condition: Condition = { diff --git a/ui/hooks/notifications.ts b/ui/hooks/notifications.ts index 333d2baad2..c9ff569499 100644 --- a/ui/hooks/notifications.ts +++ b/ui/hooks/notifications.ts @@ -15,7 +15,7 @@ export function useListProviders( opts: ReactQueryOptions = { retry: false, refetchInterval: 5000, - } + }, ) { const { api } = useContext(CoreClientContext); return useQuery( @@ -23,12 +23,12 @@ export function useListProviders( () => { return api.ListObjects({ namespace, kind: Kind.Provider }).then((res) => { const providers = res.objects?.map( - (obj) => convertResponse(Kind.Provider, obj) as Provider + (obj) => convertResponse(Kind.Provider, obj) as Provider, ); return { objects: providers, errors: res.errors }; }); }, - opts + opts, ); } @@ -38,7 +38,7 @@ export function useListAlerts( opts: ReactQueryOptions = { retry: false, refetchInterval: 5000, - } + }, ) { const { api } = useContext(CoreClientContext); return useQuery( @@ -46,12 +46,12 @@ export function useListAlerts( () => { return api.ListObjects({ namespace, kind: Kind.Alert }).then((res) => { const alerts = res.objects?.map( - (obj) => convertResponse(Kind.Alert, obj) as Alert + (obj) => convertResponse(Kind.Alert, obj) as Alert, ); const matches = alerts.filter((alert) => alert.providerRef === name); return { objects: matches, errors: res.errors }; }); }, - opts + opts, ); } diff --git a/ui/hooks/objects.ts b/ui/hooks/objects.ts index 8ab0a9ea48..1ea8e07396 100644 --- a/ui/hooks/objects.ts +++ b/ui/hooks/objects.ts @@ -23,7 +23,7 @@ import { ReactQueryOptions, RequestError } from "../lib/types"; export function convertResponse( kind: Kind | string, - response?: ResponseObject + response?: ResponseObject, ) { switch (kind) { case Kind.HelmRepository: @@ -66,7 +66,7 @@ export function useGetObject( opts: ReactQueryOptions = { retry: false, refetchInterval: 5000, - } + }, ) { const { api } = useContext(CoreClientContext); @@ -77,9 +77,9 @@ export function useGetObject( .GetObject({ name, namespace, kind, clusterName }) .then( (result: GetObjectResponse) => - convertResponse(kind, result.object) as T + convertResponse(kind, result.object) as T, ), - opts + opts, ); if (response.error) { return { ...response, data: convertResponse(kind) as T }; @@ -97,7 +97,7 @@ export function useListObjects( opts: ReactQueryOptions = { retry: false, refetchInterval: 5000, - } + }, ) { const { api } = useContext(CoreClientContext); @@ -116,6 +116,6 @@ export function useListObjects( else objects = []; return { objects: objects, errors: res.errors || [] }; }, - opts + opts, ); } diff --git a/ui/hooks/policyViolations.ts b/ui/hooks/policyViolations.ts index e3a8baa190..ead6b884e5 100644 --- a/ui/hooks/policyViolations.ts +++ b/ui/hooks/policyViolations.ts @@ -17,13 +17,13 @@ export function useListPolicyValidations( opts: ReactQueryOptions = { retry: false, refetchInterval: 5000, - } + }, ) { const { api } = useContext(CoreClientContext); return useQuery( [LIST_POLICY_VIOLATION_QUERY_KEY, req], () => api.ListPolicyValidations(req), - opts + opts, ); } @@ -34,12 +34,12 @@ export function useGetPolicyValidationDetails( opts: ReactQueryOptions = { retry: false, refetchInterval: 5000, - } + }, ) { const { api } = useContext(CoreClientContext); return useQuery( [GET_POLICY_VIOLATION_QUERY_KEY, req], () => api.GetPolicyValidation(req), - opts + opts, ); } diff --git a/ui/hooks/sources.ts b/ui/hooks/sources.ts index c1371c6394..376fe70033 100644 --- a/ui/hooks/sources.ts +++ b/ui/hooks/sources.ts @@ -25,7 +25,7 @@ export function useListSources( opts: ReactQueryOptions = { retry: false, refetchInterval: 5000, - } + }, ) { const { api } = useContext(CoreClientContext); @@ -45,19 +45,19 @@ export function useListSources( if (!response.objects) response.objects = []; if (!response.errors) response.errors = []; return { kind, response }; - }) + }), ); return Promise.all(p).then((responses) => { const final: Res = { result: [], errors: [], searchedNamespaces: {} }; for (const { kind, response } of responses) { final.result.push( - ...response.objects.map((o) => convertResponse(kind, o) as Source) + ...response.objects.map((o) => convertResponse(kind, o) as Source), ); if (response.errors.length) { final.errors.push( ...response.errors.map((o) => { return { ...o, kind }; - }) + }), ); } final.searchedNamespaces[kind] = response.searchedNamespaces; @@ -65,6 +65,6 @@ export function useListSources( return final; }); }, - opts + opts, ); } diff --git a/ui/hooks/version.ts b/ui/hooks/version.ts index fc88063e8e..dc1c42aa0f 100644 --- a/ui/hooks/version.ts +++ b/ui/hooks/version.ts @@ -13,6 +13,6 @@ export function useVersion() { { staleTime: Infinity, cacheTime: Infinity, - } + }, ); } diff --git a/ui/lib/__tests__/graph.test.ts b/ui/lib/__tests__/graph.test.ts index d11f8169e3..a307cf4f2e 100644 --- a/ui/lib/__tests__/graph.test.ts +++ b/ui/lib/__tests__/graph.test.ts @@ -69,7 +69,7 @@ describe("graph lib", () => { app.namespace, app.automationKind, [{ group: "apps", version: "v1", kind: "Deployment" }], - app.clusterName + app.clusterName, ); const dep = objects[0]; expect(dep).toBeTruthy(); @@ -131,7 +131,7 @@ describe("graph lib", () => { app.namespace, app.automationKind, [{ group: "apps", version: "v1", kind: "Deployment" }], - app.clusterName + app.clusterName, ); const firstPods = _.get(objects[0], ["children", 0, "children"]); @@ -145,7 +145,7 @@ describe("graph lib", () => { // Changing the order here const reversed = res.objects.reverse(); return new Promise((accept) => - accept({ objects: reversed }) + accept({ objects: reversed }), ); }, }; @@ -157,7 +157,7 @@ describe("graph lib", () => { app.namespace, app.automationKind, [{ group: "apps", version: "v1", kind: "Deployment" }], - app.clusterName + app.clusterName, ); const secondPods = _.get(objects2[0], ["children", 0, "children"]); @@ -175,7 +175,7 @@ describe("graph lib", () => { app.namespace, app.automationKind, [{ group: "apps", version: "v1", kind: "Deployment" }], - app.clusterName + app.clusterName, ); const firstReplicaSets = _.get(objects[0], ["children"]); @@ -192,7 +192,7 @@ describe("graph lib", () => { const reversed = res.objects.reverse(); return new Promise((accept) => - accept({ objects: reversed }) + accept({ objects: reversed }), ); }, }; @@ -204,7 +204,7 @@ describe("graph lib", () => { app.namespace, app.automationKind, [{ group: "apps", version: "v1", kind: "Deployment" }], - app.clusterName + app.clusterName, ); const secondReplicaSets = _.get(objects2[0], ["children"]); diff --git a/ui/lib/__tests__/objects.test.ts b/ui/lib/__tests__/objects.test.ts index 573b582487..97c87104a2 100644 --- a/ui/lib/__tests__/objects.test.ts +++ b/ui/lib/__tests__/objects.test.ts @@ -48,7 +48,7 @@ describe("objects lib", () => { const yaml = obj.yaml; expect(yaml).toEqual( - "apiVersion: helm.toolkit.fluxcd.io/v2beta1\nkind: HelmRelease\n" + "apiVersion: helm.toolkit.fluxcd.io/v2beta1\nkind: HelmRelease\n", ); }); @@ -405,7 +405,7 @@ describe("objects lib", () => { }); it("extracts last revision", () => { expect(obj.lastAppliedRevision).toEqual( - "6.2.0/79f81383288bf6542fcb5bdd8144b826b33b36e7" + "6.2.0/79f81383288bf6542fcb5bdd8144b826b33b36e7", ); }); }); diff --git a/ui/lib/__tests__/requests.test.ts b/ui/lib/__tests__/requests.test.ts index 7ed1af0f5d..931c5eac5c 100644 --- a/ui/lib/__tests__/requests.test.ts +++ b/ui/lib/__tests__/requests.test.ts @@ -3,7 +3,7 @@ import { TokenRefreshWrapper } from "../requests"; describe("ServiceWrapper", () => { const mockGetData = jest.fn(); const mockRefreshToken = jest.fn( - () => new Promise((resolve) => setTimeout(resolve, 100)) + () => new Promise((resolve) => setTimeout(resolve, 100)), ); const service = { getData: mockGetData }; diff --git a/ui/lib/__tests__/utils.test.ts b/ui/lib/__tests__/utils.test.ts index 4ef63ef32d..ecab855da2 100644 --- a/ui/lib/__tests__/utils.test.ts +++ b/ui/lib/__tests__/utils.test.ts @@ -33,29 +33,29 @@ describe("utils lib", () => { expect(isHTTP("http://172.31.0.2/")).toEqual(true); expect( isHTTP( - "http://localhost:8080/applications/argocd/fsa-installation?view=tree" - ) + "http://localhost:8080/applications/argocd/fsa-installation?view=tree", + ), ).toEqual(true); expect( isHTTP( - "https://localhost:8080/applications/argocd/fsa-installation?view=tree" - ) + "https://localhost:8080/applications/argocd/fsa-installation?view=tree", + ), ).toEqual(true); expect( - isHTTP("http://github.com/weaveworks/weave-gitops-clusters") + isHTTP("http://github.com/weaveworks/weave-gitops-clusters"), ).toEqual(true); expect( - isHTTP("http://github.com/weaveworks/weave-gitops-clusters/") + isHTTP("http://github.com/weaveworks/weave-gitops-clusters/"), ).toEqual(true); }); it("detects HTTPS", () => { expect(isHTTP("https://www.google.com")).toEqual(true); expect(isHTTP("https://www.google.com/")).toEqual(true); expect( - isHTTP("https://github.com/weaveworks/weave-gitops-clusters") + isHTTP("https://github.com/weaveworks/weave-gitops-clusters"), ).toEqual(true); expect( - isHTTP("https://github.com/weaveworks/weave-gitops-clusters/") + isHTTP("https://github.com/weaveworks/weave-gitops-clusters/"), ).toEqual(true); }); it("detects non-HTTP string", () => { @@ -68,10 +68,10 @@ describe("utils lib", () => { expect(isHTTP("http:// this is a random http sentence")).toEqual(false); expect(isHTTP("https:// this is a random https sentence")).toEqual(false); expect( - isHTTP("ssh://git@github.com/weaveworks/weave-gitops-clusters") + isHTTP("ssh://git@github.com/weaveworks/weave-gitops-clusters"), ).toEqual(false); expect(isHTTP("github.com/weaveworks/weave-gitops-clusters")).toEqual( - false + false, ); expect(isHTTP("foo/file.html")).toEqual(false); expect(isHTTP("//.com")).toEqual(false); @@ -81,13 +81,13 @@ describe("utils lib", () => { it("allows http", () => { expect(isAllowedLink("http://www.google.com")).toEqual(true); expect(isAllowedLink("http:// this is a random http sentence")).toEqual( - true + true, ); }); it("allows https", () => { expect(isAllowedLink("https://www.google.com")).toEqual(true); expect(isAllowedLink("https:// this is a random https sentence")).toEqual( - true + true, ); }); it("allows relative links", () => { @@ -96,7 +96,7 @@ describe("utils lib", () => { expect(isAllowedLink("/hello")).toEqual(true); expect(isAllowedLink("test string")).toEqual(true); expect( - isAllowedLink("github.com/weaveworks/weave-gitops-clusters") + isAllowedLink("github.com/weaveworks/weave-gitops-clusters"), ).toEqual(true); expect(isAllowedLink("foo/file.html")).toEqual(true); expect(isAllowedLink("//.com")).toEqual(true); @@ -107,7 +107,7 @@ describe("utils lib", () => { expect(isAllowedLink("smtp://http/")).toEqual(false); expect(isAllowedLink("smtp://https/")).toEqual(false); expect( - isAllowedLink("ssh://git@github.com/weaveworks/weave-gitops-clusters") + isAllowedLink("ssh://git@github.com/weaveworks/weave-gitops-clusters"), ).toEqual(false); }); }); @@ -115,8 +115,8 @@ describe("utils lib", () => { it("converts valid Git URL", () => { expect( convertGitURLToGitProvider( - "ssh://git@github.com/weaveworks/weave-gitops-clusters" - ) + "ssh://git@github.com/weaveworks/weave-gitops-clusters", + ), ).toEqual("https://github.com/weaveworks/weave-gitops-clusters"); }); it("returns nothing on invalid Git URL", () => { @@ -127,8 +127,8 @@ describe("utils lib", () => { it("returns the original HTTP URL", () => { expect( convertGitURLToGitProvider( - "https://github.com/weaveworks/weave-gitops-clusters" - ) + "https://github.com/weaveworks/weave-gitops-clusters", + ), ).toEqual("https://github.com/weaveworks/weave-gitops-clusters"); }); }); @@ -138,7 +138,7 @@ describe("utils lib", () => { it("returns correct page title with app name", () => { expect(pageTitleWithAppName(pageTitle, appName)).toEqual( - `${pageTitle} for ${appName}` + `${pageTitle} for ${appName}`, ); }); it("returns correct page title without app name", () => { @@ -160,7 +160,7 @@ describe("utils lib", () => { type: "Ready", }, ], - }) + }), ).toEqual(2); }); it("computes ready status", () => { @@ -184,7 +184,7 @@ describe("utils lib", () => { timestamp: "2022-03-03 16:55:29 +0000 UTC", }, ], - }) + }), ).toEqual(4); }); it("computes reconciling status", () => { @@ -200,7 +200,7 @@ describe("utils lib", () => { timestamp: "2022-03-03 16:55:29 +0000 UTC", }, ], - }) + }), ).toEqual(3); }); it("computes default status", () => { @@ -216,7 +216,7 @@ describe("utils lib", () => { timestamp: "2022-03-03 16:55:29 +0000 UTC", }, ], - }) + }), ).toEqual(1); }); }); @@ -232,7 +232,7 @@ describe("utils lib", () => { }); it("concatenates strings if both strings are not empty", () => { expect(makeImageString(["image string 1", "image string 2"])).toEqual( - "image string 1\nimage string 2" + "image string 1\nimage string 2", ); }); }); @@ -247,49 +247,49 @@ describe("utils lib", () => { describe("convertImage", () => { it("should handle Docker namespaced repositories", () => { expect(convertImage("weaveworks/eksctl")).toEqual( - "https://hub.docker.com/r/weaveworks/eksctl" + "https://hub.docker.com/r/weaveworks/eksctl", ); expect(convertImage("docker.io/weaveworks/eksctl")).toEqual( - "https://hub.docker.com/r/weaveworks/eksctl" + "https://hub.docker.com/r/weaveworks/eksctl", ); }); it("should handle Docker global repositories", () => { expect(convertImage("nginx")).toEqual("https://hub.docker.com/r/_/nginx"); expect(convertImage("docker.io/nginx")).toEqual( - "https://hub.docker.com/r/_/nginx" + "https://hub.docker.com/r/_/nginx", ); }); it("should handle Docker library alias", () => { expect(convertImage("library/nginx")).toEqual( - "https://hub.docker.com/r/_/nginx" + "https://hub.docker.com/r/_/nginx", ); expect(convertImage("docker.io/library/nginx")).toEqual( - "https://hub.docker.com/r/_/nginx" + "https://hub.docker.com/r/_/nginx", ); }); it("should handle Quay.io repositories", () => { expect(convertImage("quay.io/jitesoft/nginx")).toEqual( - "https://quay.io/repository/jitesoft/nginx" + "https://quay.io/repository/jitesoft/nginx", ); }); it("should handle Github and Google GHCR/GCR", () => { expect(convertImage("ghcr.io/weaveworks/charts/weave-gitops")).toEqual( - "https://ghcr.io/weaveworks/charts/weave-gitops" + "https://ghcr.io/weaveworks/charts/weave-gitops", ); expect(convertImage("gcr.io/cloud-builders/gcloud")).toEqual( - "https://gcr.io/cloud-builders/gcloud" + "https://gcr.io/cloud-builders/gcloud", ); }); it("should remove tags", () => { expect( - convertImage("ghcr.io/weaveworks/charts/weave-gitops:10.4.5.2335224") + convertImage("ghcr.io/weaveworks/charts/weave-gitops:10.4.5.2335224"), ).toEqual("https://ghcr.io/weaveworks/charts/weave-gitops"); }); it("should not link to unsupported images", () => { expect( convertImage( - "fakeimage.itisfake.donotdoit.io/fake/fake/fake.com.net.org" - ) + "fakeimage.itisfake.donotdoit.io/fake/fake/fake.com.net.org", + ), ).toEqual(false); }); }); @@ -307,7 +307,7 @@ describe("utils lib", () => { const kustomization = new Kustomization(response); expect(getSourceRefForAutomation(kustomization)).toEqual( - kustomization.sourceRef + kustomization.sourceRef, ); }); it("should return sourceRef for helmrelease", () => { @@ -322,7 +322,7 @@ describe("utils lib", () => { const helmRelease = new HelmRelease(object); expect(getSourceRefForAutomation(helmRelease)).toEqual( - helmRelease.helmChart.sourceRef + helmRelease.helmChart.sourceRef, ); }); it("should return undefined if automation is undefined", () => { @@ -347,12 +347,12 @@ describe("utils lib", () => { fullResponse, defaultVersion, true, - defaultVersionPrefix + defaultVersionPrefix, ); expect(appVersion.versionText).toEqual(`vdefault version`); expect(appVersion.versionHref).toEqual( - "https://github.com/weaveworks/weave-gitops/releases/tag/vdefault version" + "https://github.com/weaveworks/weave-gitops/releases/tag/vdefault version", ); }); it("should return api version for full response if not loading data", () => { @@ -360,12 +360,12 @@ describe("utils lib", () => { fullResponse, defaultVersion, false, - defaultVersionPrefix + defaultVersionPrefix, ); expect(appVersion.versionText).toEqual("branch-commit"); expect(appVersion.versionHref).toEqual( - "https://github.com/weaveworks/weave-gitops/commit/commit" + "https://github.com/weaveworks/weave-gitops/commit/commit", ); }); it("should return default version without prefix for full response if loading data", () => { @@ -373,7 +373,7 @@ describe("utils lib", () => { expect(appVersion.versionText).toEqual(`default version`); expect(appVersion.versionHref).toEqual( - "https://github.com/weaveworks/weave-gitops/releases/tag/vdefault version" + "https://github.com/weaveworks/weave-gitops/releases/tag/vdefault version", ); }); it("should return api version without prefix for full response", () => { @@ -381,23 +381,23 @@ describe("utils lib", () => { expect(appVersion.versionText).toEqual("branch-commit"); expect(appVersion.versionHref).toEqual( - "https://github.com/weaveworks/weave-gitops/commit/commit" + "https://github.com/weaveworks/weave-gitops/commit/commit", ); }); }); describe("formatLogTimestamp", () => { it("should format non-empty timestamp", () => { expect(formatLogTimestamp("2023-01-31T13:27:56-05:00", "UTC+1")).toEqual( - "2023-01-31 19:27:56 UTC+1" + "2023-01-31 19:27:56 UTC+1", ); expect(formatLogTimestamp("2023-02-03T13:27:56-01:00", "UTC-10")).toEqual( - "2023-02-03 04:27:56 UTC-10" + "2023-02-03 04:27:56 UTC-10", ); expect(formatLogTimestamp("2023-02-03T13:27:56-01:00", "UTC")).toEqual( - "2023-02-03 14:27:56 UTC" + "2023-02-03 14:27:56 UTC", ); expect(formatLogTimestamp("2023-02-04T18:36:01+01:00", "UTC+3")).toEqual( - "2023-02-04 20:36:01 UTC+3" + "2023-02-04 20:36:01 UTC+3", ); }); it("should return a hyphen for undefined timestamp", () => { @@ -412,22 +412,22 @@ describe("utils lib", () => { describe("createYamlCommand", () => { it("creates kubectl get yaml string for objects with namespaces", () => { expect( - createYamlCommand(Kind.Kustomization, "test", "flux-system") + createYamlCommand(Kind.Kustomization, "test", "flux-system"), ).toEqual(`kubectl get kustomization test -n flux-system -o yaml`); }); it("creates kubectl get yaml string for objects without namespaces", () => { expect(createYamlCommand(Kind.Kustomization, "test", undefined)).toEqual( - `kubectl get kustomization test -o yaml` + `kubectl get kustomization test -o yaml`, ); }); it("returns null if name or kind are false values", () => { expect(createYamlCommand(undefined, undefined, "flux-system")).toEqual( - null + null, ); }); it("uses the path prop if it is defined", () => { expect(createYamlCommand(undefined, undefined, undefined, "http")).toEqual( - "http" + "http", ); }); @@ -437,7 +437,7 @@ describe("createYamlCommand", () => { beforeEach(() => { dom = new JSDOM( "", - { url: "https://example.org/" } + { url: "https://example.org/" }, ); }); @@ -455,7 +455,7 @@ describe("createYamlCommand", () => { beforeEach(() => { dom = new JSDOM( "", - { url: "https://example.org/" } + { url: "https://example.org/" }, ); }); diff --git a/ui/lib/dependencies.ts b/ui/lib/dependencies.ts index 6bbbd8ae58..28bdc9840e 100644 --- a/ui/lib/dependencies.ts +++ b/ui/lib/dependencies.ts @@ -9,7 +9,7 @@ import { // or are dependencies of the current node. export function getNeighborNodes( nodes: FluxObjectNodesMap, - currentNode: FluxObjectNode + currentNode: FluxObjectNode, ): FluxObjectNode[] { const dependencyNodes = currentNode.dependsOn .map((dependency) => { @@ -51,7 +51,7 @@ export function getNeighborNodes( // getGraphNodes returns all nodes in the current node's dependency tree, including the current node. export function getGraphNodes( nodes: FluxObjectNodesMap, - automation: Automation + automation: Automation, ): FluxObjectNode[] { // Find node, corresponding to the automation. const currentNode = @@ -74,7 +74,7 @@ export function getGraphNodes( const node = nodesToExplore.shift(); const newNodes = getNeighborNodes(nodes, node).filter( - (n) => !visitedNodes[n.id] + (n) => !visitedNodes[n.id], ); for (const n of newNodes) { diff --git a/ui/lib/graph.ts b/ui/lib/graph.ts index eaa770270e..a770cb9167 100644 --- a/ui/lib/graph.ts +++ b/ui/lib/graph.ts @@ -44,7 +44,7 @@ export const getChildrenRecursive = async ( object: FluxObject, clusterName: string, - lookup: any + lookup: any, ) => { const children: FluxObject[] = []; @@ -83,7 +83,7 @@ export const getChildren = async ( namespace, automationKind: Kind, kinds: GroupVersionKind[], - clusterName + clusterName, ): Promise => { const { objects } = await client.GetReconciledObjects({ automationName, @@ -104,7 +104,7 @@ export const getChildren = async ( namespace, obj, clusterName, - PARENT_CHILD_LOOKUP + PARENT_CHILD_LOOKUP, ); result.push(obj); } diff --git a/ui/lib/nav.ts b/ui/lib/nav.ts index a169ac7bb9..92d4d7a71f 100644 --- a/ui/lib/nav.ts +++ b/ui/lib/nav.ts @@ -7,7 +7,7 @@ import { NoNamespace, PageRoute, V2Routes } from "./types"; // This keeps the nav element highlighted if we are on a child page. // Example: /sources and /git_repo will both show the "Sources" nav as selected. export const getParentNavValue = ( - path: string + path: string, ): V2Routes | PageRoute | boolean => { const [, currentPage] = _.split(path, "/"); switch (`/${currentPage}`) { @@ -62,7 +62,7 @@ export const getParentNavValue = ( }; export const getParentNavRouteValue = ( - path: string + path: string, ): V2Routes | PageRoute | boolean => { const [, currentPage] = _.split(path, "/"); @@ -138,7 +138,7 @@ export const formatSourceURL = ( kind: string, name: string, namespace: string = NoNamespace, - clusterName: string + clusterName: string, ) => { return formatURL(objectTypeToRoute(Kind[kind]), { name, diff --git a/ui/lib/objects.ts b/ui/lib/objects.ts index af6af25b45..03676d634a 100644 --- a/ui/lib/objects.ts +++ b/ui/lib/objects.ts @@ -109,7 +109,7 @@ export class FluxObject { get interval(): Interval { const match = /((?[0-9]+)h)?((?[0-9]+)m)?((?[0-9]+)s)?/.exec( - this.obj.spec?.interval + this.obj.spec?.interval, ); const interval = match?.groups || {}; return { @@ -129,7 +129,7 @@ export class FluxObject { const containers = _.get(this.obj, path, []); // _.map returns an empty list if containers is not iterable return _.map(containers, (container: unknown) => - _.get(container, "image") + _.get(container, "image"), ); }); @@ -249,8 +249,8 @@ export class Kustomization extends FluxObject { const kind = parts[parts.length - 1]; const group = parts[parts.length - 2]; return { group, version: entry.v, kind }; - }) - ) + }), + ), ); } } diff --git a/ui/lib/test-utils.tsx b/ui/lib/test-utils.tsx index aff8664225..7fa756e5dc 100644 --- a/ui/lib/test-utils.tsx +++ b/ui/lib/test-utils.tsx @@ -30,7 +30,7 @@ import { RequestError } from "./types"; export type CoreOverrides = { GetChildObjects?: (req: GetChildObjectsRequest) => GetChildObjectsResponse; GetReconciledObjects?: ( - req: GetReconciledObjectsRequest + req: GetReconciledObjectsRequest, ) => GetReconciledObjectsResponse; GetVersion?: (req: GetVersionRequest) => GetVersionResponse; ListObjects?: (req: ListObjectsRequest) => ListObjectsResponse; @@ -38,7 +38,7 @@ export type CoreOverrides = { export const createCoreMockClient = ( ovr: CoreOverrides, - error?: RequestError + error?: RequestError, ): typeof Core => { const promisified = _.reduce( ovr, @@ -52,7 +52,7 @@ export const createCoreMockClient = ( return result; }, - {} + {}, ); return promisified as typeof Core; @@ -79,7 +79,7 @@ type TestContextProps = AppProps & { export function withContext( TestComponent, url: string, - { api, featureFlags, ...appProps }: TestContextProps + { api, featureFlags, ...appProps }: TestContextProps, ) { const history = createMemoryHistory(); history.push(url); diff --git a/ui/lib/utils.ts b/ui/lib/utils.ts index e9461f792e..6dd6f15401 100644 --- a/ui/lib/utils.ts +++ b/ui/lib/utils.ts @@ -72,7 +72,7 @@ export function isHTTP(uri: string): boolean { // resource path (optional) "(?:[/?#]\\S*)?" + "$", - "i" + "i", ); return regex.test(uri); @@ -85,7 +85,7 @@ export function isHTTP(uri: string): boolean { export function isAllowedLink(uri: string): boolean { // Regex from https://github.com/cure53/DOMPurify/blob/cce00ac40d33c2aae6422eaa59e6a8aad5c73901/src/regexp.js const regex = new RegExp( - /^(?:(?:(?:f|ht)tps?|mailto|tel|callto|cid|xmpp):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i // eslint-disable-line no-useless-escape + /^(?:(?:(?:f|ht)tps?|mailto|tel|callto|cid|xmpp):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i, // eslint-disable-line no-useless-escape ); return regex.test(uri); } @@ -187,7 +187,7 @@ export const convertImage = (image: string) => { // getSourceRefForAutomation returns the automation's sourceRef // depending on whether the automation is a Kustomization or a HelmRelease. export function getSourceRefForAutomation( - automation?: Automation + automation?: Automation, ): ObjectRef | undefined { return automation?.type === Kind.Kustomization ? (automation as Kustomization)?.sourceRef @@ -199,7 +199,7 @@ export function getAppVersion( versionData: GetVersionResponse, defaultVersion: string, isLoading = false, - defaultVersionPrefix = "" + defaultVersionPrefix = "", ): AppVersion { const shouldDisplayApiVersion = !isLoading && @@ -247,7 +247,7 @@ export const createYamlCommand = ( kind?: string, name?: string, namespace?: string, - path?: string + path?: string, ): string => { if (path) return path; if (kind && name) { diff --git a/ui/pages/Error.tsx b/ui/pages/Error.tsx index 126e0e906b..dfcca6b561 100644 --- a/ui/pages/Error.tsx +++ b/ui/pages/Error.tsx @@ -10,7 +10,7 @@ type Props = { function ErrorPage({ className }: Props) { const Error404Animation = React.lazy( - () => import("../components/Animations/Error404") + () => import("../components/Animations/Error404"), ); return ( diff --git a/ui/pages/__tests__/Automations.test.tsx b/ui/pages/__tests__/Automations.test.tsx index 6632fa0a47..6f25020b9b 100644 --- a/ui/pages/__tests__/Automations.test.tsx +++ b/ui/pages/__tests__/Automations.test.tsx @@ -47,7 +47,7 @@ describe("Automations", () => { GetVersion: getVersionMock, }); render( - withTheme(withContext(, "/automations", { api: client })) + withTheme(withContext(, "/automations", { api: client })), ); await waitFor(() => { expect(screen.getAllByText("Kustomization").length).toBeTruthy(); @@ -62,7 +62,7 @@ describe("Automations", () => { GetVersion: getVersionMock, }); render( - withTheme(withContext(, "/automations", { api: client2 })) + withTheme(withContext(, "/automations", { api: client2 })), ); await waitFor(() => expect(screen.getByText("No data")).toBeTruthy()); }); diff --git a/ui/pages/__tests__/Signin.test.tsx b/ui/pages/__tests__/Signin.test.tsx index a42e1bf1b5..490272b19b 100644 --- a/ui/pages/__tests__/Signin.test.tsx +++ b/ui/pages/__tests__/Signin.test.tsx @@ -11,8 +11,8 @@ const renderSignIn = (featureFlags: Record) => { withTheme( withContext(, "/sign_in", { featureFlags, - }) - ) + }), + ), ); }; @@ -53,7 +53,7 @@ describe("SignIn", () => { fireEvent.click(screen.queryByText(defaultButtonLabel)); expect(window.location.href).toEqual( - "/oauth2?return_url=http%3A%2F%2Flocalhost" + "/oauth2?return_url=http%3A%2F%2Flocalhost", ); }); @@ -69,13 +69,13 @@ describe("SignIn", () => { withTheme( withContext(signInWithBaseTag, "/sign_in", { featureFlags: { OIDC_AUTH: "true" }, - }) - ) + }), + ), ); fireEvent.click(screen.queryByText(defaultButtonLabel)); expect(window.location.href).toEqual( - "/wego/oauth2?return_url=http%3A%2F%2Flocalhost%2Fwego" + "/wego/oauth2?return_url=http%3A%2F%2Flocalhost%2Fwego", ); }); diff --git a/ui/pages/v2/GitRepositoryDetail.tsx b/ui/pages/v2/GitRepositoryDetail.tsx index 24a0ceccd2..eac5806fb4 100644 --- a/ui/pages/v2/GitRepositoryDetail.tsx +++ b/ui/pages/v2/GitRepositoryDetail.tsx @@ -27,7 +27,7 @@ function GitRepositoryDetail({ name, namespace, Kind.GitRepository, - clusterName + clusterName, ); return ( diff --git a/ui/pages/v2/HelmRepositoryDetail.tsx b/ui/pages/v2/HelmRepositoryDetail.tsx index 91d91291a5..e1f583f10c 100644 --- a/ui/pages/v2/HelmRepositoryDetail.tsx +++ b/ui/pages/v2/HelmRepositoryDetail.tsx @@ -28,7 +28,7 @@ function HelmRepositoryDetail({ name, namespace, Kind.HelmRepository, - clusterName + clusterName, ); return ( diff --git a/ui/pages/v2/KustomizationPage.tsx b/ui/pages/v2/KustomizationPage.tsx index 315d7e87a1..0f3b47e355 100644 --- a/ui/pages/v2/KustomizationPage.tsx +++ b/ui/pages/v2/KustomizationPage.tsx @@ -23,7 +23,7 @@ function KustomizationPage({ className, name, namespace, clusterName }: Props) { name, namespace, Kind.Kustomization, - clusterName + clusterName, ); return (