From 284a846d6228197cf4f5f098915e2151fb88ccbb Mon Sep 17 00:00:00 2001 From: Chloe Renaud Date: Fri, 29 Nov 2024 10:09:00 +0100 Subject: [PATCH] refactor: new prettier import config --- .prettierrc | 5 +- __mocks__/i18nifty.js | 26 ++++ package.json | 2 +- src/App.tsx | 9 +- src/api/01-integrations.ts | 1 + src/api/02-campaigns.ts | 1 + src/api/03-questionnaires.ts | 1 + src/api/04-nomenclatures.ts | 1 + src/api/05-metadata.ts | 1 + src/api/06-survey-units.ts | 1 + src/api/07-paradata-events.ts | 1 + src/api/08-survey-units-in-temp-zone.ts | 1 + src/api/09-healthcheck.ts | 1 + src/api/10-create-data-set.ts | 1 + src/api/axiosInstance.ts | 3 +- src/api/visualizeQueryOptions.ts | 9 +- src/components/Container.tsx | 3 +- src/components/Grid.tsx | 3 +- src/components/Toast.tsx | 6 +- src/components/error/ErrorComponent.tsx | 4 +- src/components/error/errorNormalizer.tsx | 6 +- src/components/layout/AutoLogoutCountdown.tsx | 6 +- src/components/layout/Footer.tsx | 6 +- src/components/layout/Header.test.tsx | 8 +- src/components/layout/Header.tsx | 7 +- .../orchestrator/Orchestrator.test.tsx | 8 +- src/components/orchestrator/Orchestrator.tsx | 27 ++-- .../orchestrator/SequenceHeader.tsx | 4 +- .../orchestrator/SurveyContainer.tsx | 9 +- .../orchestrator/customPages/EndPage.test.tsx | 34 +++-- .../orchestrator/customPages/EndPage.tsx | 3 +- .../customPages/ValidationModal.tsx | 6 +- .../customPages/ValidationPage.tsx | 3 +- .../orchestrator/customPages/WelcomeModal.tsx | 6 +- .../customPages/WelcomePage.test.tsx | 1 + .../orchestrator/customPages/WelcomePage.tsx | 6 +- .../hooks/usePushEventAfterInactivity.test.ts | 4 +- .../hooks/usePushEventAfterInactivity.ts | 3 +- .../hooks/useStromaeNavigation.tsx | 7 +- .../orchestrator/slotComponents.tsx | 3 +- .../orchestrator/utils/components.ts | 1 + .../orchestrator/utils/lunaticType.ts | 2 +- .../orchestrator/utils/orchestrator.test.ts | 1 + .../orchestrator/vtlDevTools/VTLDevtools.tsx | 7 +- .../vtlDevTools/VTLErrorStore.tsx | 6 +- src/contexts/TelemetryContext.test.tsx | 4 +- src/contexts/TelemetryContext.tsx | 15 +- src/hooks/prelogout.ts | 3 +- src/hooks/useBatch.test.ts | 3 +- src/hooks/useDocumentTitle.ts | 4 +- src/hooks/useMode.ts | 3 +- src/i18n/i18n.ts | 4 +- src/main.tsx | 2 + src/models/Page.ts | 3 +- src/models/StateData.ts | 1 + src/models/SurveyUnitData.ts | 1 + src/models/metadataSchema.ts | 5 +- src/models/pageSchema.ts | 5 +- src/pages/accessibility/AccessibilityPage.tsx | 6 +- src/pages/accessibility/route.ts | 4 +- src/pages/collect/CollectPage.tsx | 11 +- src/pages/collect/route.tsx | 8 +- src/pages/legals/LegalsPage.tsx | 6 +- src/pages/legals/route.ts | 4 +- .../NavigationAssistancePage.tsx | 6 +- src/pages/navigationAssistance/route.ts | 4 +- src/pages/review/ReviewPage.tsx | 7 +- src/pages/review/route.tsx | 6 +- src/pages/security/SecurityPage.tsx | 6 +- src/pages/security/route.ts | 4 +- src/pages/siteMap/SiteMapPage.tsx | 8 +- src/pages/siteMap/route.ts | 4 +- src/pages/visualize/Visualize.tsx | 7 +- .../visualize/form/SelectNomenclatures.tsx | 4 +- src/pages/visualize/form/VisualizeForm.tsx | 8 +- src/pages/visualize/route.tsx | 7 +- src/router/router.tsx | 18 +-- src/stores/useMetadataStore.tsx | 1 + src/utils/convertOldPersonalization.ts | 2 +- src/utils/telemetry.test.ts | 1 + src/utils/tests.tsx | 3 +- yarn.lock | 136 +++++++++++++++++- 82 files changed, 428 insertions(+), 150 deletions(-) create mode 100644 __mocks__/i18nifty.js diff --git a/.prettierrc b/.prettierrc index 45f08ea7..69a14234 100644 --- a/.prettierrc +++ b/.prettierrc @@ -1,5 +1,8 @@ { "semi": false, "singleQuote": true, - "plugins": ["prettier-plugin-organize-imports"] + "plugins": ["@trivago/prettier-plugin-sort-imports"], + "importOrder": ["^react$", "", "^@/(.*)$", "^[./]"], + "importOrderSeparation": true, + "importOrderSortSpecifiers": true } diff --git a/__mocks__/i18nifty.js b/__mocks__/i18nifty.js new file mode 100644 index 00000000..7e721a4c --- /dev/null +++ b/__mocks__/i18nifty.js @@ -0,0 +1,26 @@ +const useMock = [(k) => k, { changeLanguage: () => new Promise(() => {}) }] +useMock.t = (k, opts) => { + if (!opts) { + return k + } + return `${k} ${JSON.stringify(opts)}` +} +useMock.i18n = { changeLanguage: () => new Promise(() => {}) } + +function createI18nApi() { + return function () { + const i18nApi = { + useTranslation: () => useMock, + } + + return i18nApi + } +} + +function declareComponentKeys() { + return function () { + return { i18n: () => {} } + } +} + +export { createI18nApi, declareComponentKeys } diff --git a/package.json b/package.json index 5b2b64a3..733a772d 100644 --- a/package.json +++ b/package.json @@ -48,6 +48,7 @@ "@testing-library/jest-dom": "^6.5.0", "@testing-library/react": "^16.0.1", "@testing-library/user-event": "^14.5.2", + "@trivago/prettier-plugin-sort-imports": "^4.3.0", "@types/he": "^1.2.3", "@types/node": "^22.7.3", "@types/react": "^18.3.9", @@ -64,7 +65,6 @@ "lint-staged": "^15.2.10", "orval": "^7.0.1", "prettier": "^3.3.3", - "prettier-plugin-organize-imports": "^4.0.0", "tsx": "^4.17.0", "typescript": "^5.5.4", "typescript-eslint": "^8.2.0", diff --git a/src/App.tsx b/src/App.tsx index 4ab3e619..5fb87117 100644 --- a/src/App.tsx +++ b/src/App.tsx @@ -1,16 +1,17 @@ -import { TelemetryProvider } from '@/contexts/TelemetryContext' -import { OidcProvider } from '@/oidc' -import { routeTree } from '@/router/router' import { MuiDsfrThemeProvider } from '@codegouvfr/react-dsfr/mui' import { startReactDsfr } from '@codegouvfr/react-dsfr/spa' import { QueryClient, QueryClientProvider } from '@tanstack/react-query' import { Link, + type LinkProps, RouterProvider, createRouter, - type LinkProps, } from '@tanstack/react-router' +import { TelemetryProvider } from '@/contexts/TelemetryContext' +import { OidcProvider } from '@/oidc' +import { routeTree } from '@/router/router' + startReactDsfr({ defaultColorScheme: 'system', Link, diff --git a/src/api/01-integrations.ts b/src/api/01-integrations.ts index 1b3479e8..bcb83055 100644 --- a/src/api/01-integrations.ts +++ b/src/api/01-integrations.ts @@ -11,6 +11,7 @@ import type { UseMutationResult, } from '@tanstack/react-query' import { useMutation } from '@tanstack/react-query' + import type { IntegrateContextBody, IntegrateXmlContextBody, diff --git a/src/api/02-campaigns.ts b/src/api/02-campaigns.ts index 987d5cd3..2da6a0bc 100644 --- a/src/api/02-campaigns.ts +++ b/src/api/02-campaigns.ts @@ -18,6 +18,7 @@ import type { UseQueryResult, } from '@tanstack/react-query' import { useMutation, useQuery } from '@tanstack/react-query' + import type { CampaignCreation, CampaignCreationV2, diff --git a/src/api/03-questionnaires.ts b/src/api/03-questionnaires.ts index 0e6f7bc9..361023b6 100644 --- a/src/api/03-questionnaires.ts +++ b/src/api/03-questionnaires.ts @@ -18,6 +18,7 @@ import type { UseQueryResult, } from '@tanstack/react-query' import { useMutation, useQuery } from '@tanstack/react-query' + import type { GetQuestionnaireData200, QuestionnaireModelCreation, diff --git a/src/api/04-nomenclatures.ts b/src/api/04-nomenclatures.ts index 4a585bdd..a4abbced 100644 --- a/src/api/04-nomenclatures.ts +++ b/src/api/04-nomenclatures.ts @@ -18,6 +18,7 @@ import type { UseQueryResult, } from '@tanstack/react-query' import { useMutation, useQuery } from '@tanstack/react-query' + import type { NomenclatureCreation } from '../models/api' import type { SchemaNomenclature } from '../models/api/schema.nomenclature' import { stromaeInstance } from './axiosInstance' diff --git a/src/api/05-metadata.ts b/src/api/05-metadata.ts index cffcef2c..529c67ec 100644 --- a/src/api/05-metadata.ts +++ b/src/api/05-metadata.ts @@ -15,6 +15,7 @@ import type { UseQueryResult, } from '@tanstack/react-query' import { useQuery } from '@tanstack/react-query' + import type { SchemaMetadata } from '../models/api/schema.metadata' import { stromaeInstance } from './axiosInstance' diff --git a/src/api/06-survey-units.ts b/src/api/06-survey-units.ts index 63add1a0..9c4f43a6 100644 --- a/src/api/06-survey-units.ts +++ b/src/api/06-survey-units.ts @@ -18,6 +18,7 @@ import type { UseQueryResult, } from '@tanstack/react-query' import { useMutation, useQuery } from '@tanstack/react-query' + import type { GetCommentBySurveyUnit200, SetCommentBody, diff --git a/src/api/07-paradata-events.ts b/src/api/07-paradata-events.ts index de7c0597..17da4d39 100644 --- a/src/api/07-paradata-events.ts +++ b/src/api/07-paradata-events.ts @@ -11,6 +11,7 @@ import type { UseMutationResult, } from '@tanstack/react-query' import { useMutation } from '@tanstack/react-query' + import type { AddParadataBody } from '../models/api' import { stromaeInstance } from './axiosInstance' diff --git a/src/api/08-survey-units-in-temp-zone.ts b/src/api/08-survey-units-in-temp-zone.ts index 8698dd64..67b53f76 100644 --- a/src/api/08-survey-units-in-temp-zone.ts +++ b/src/api/08-survey-units-in-temp-zone.ts @@ -18,6 +18,7 @@ import type { UseQueryResult, } from '@tanstack/react-query' import { useMutation, useQuery } from '@tanstack/react-query' + import type { SurveyUnitTempZone } from '../models/api' import type { SchemaSurveyUnitTempZone } from '../models/api/schema.survey-unit-temp-zone' import { stromaeInstance } from './axiosInstance' diff --git a/src/api/09-healthcheck.ts b/src/api/09-healthcheck.ts index cf9e5d65..58134deb 100644 --- a/src/api/09-healthcheck.ts +++ b/src/api/09-healthcheck.ts @@ -15,6 +15,7 @@ import type { UseQueryResult, } from '@tanstack/react-query' import { useQuery } from '@tanstack/react-query' + import { stromaeInstance } from './axiosInstance' type SecondParameter any> = Parameters[1] diff --git a/src/api/10-create-data-set.ts b/src/api/10-create-data-set.ts index 464512c1..54611902 100644 --- a/src/api/10-create-data-set.ts +++ b/src/api/10-create-data-set.ts @@ -11,6 +11,7 @@ import type { UseMutationResult, } from '@tanstack/react-query' import { useMutation } from '@tanstack/react-query' + import { stromaeInstance } from './axiosInstance' type SecondParameter any> = Parameters[1] diff --git a/src/api/axiosInstance.ts b/src/api/axiosInstance.ts index 48d8b136..af22a192 100644 --- a/src/api/axiosInstance.ts +++ b/src/api/axiosInstance.ts @@ -1,6 +1,7 @@ -import { getOidc } from '@/oidc' import axios, { type AxiosRequestConfig } from 'axios' +import { getOidc } from '@/oidc' + const axiosInstance = axios.create({ baseURL: import.meta.env.VITE_API_URL, }) diff --git a/src/api/visualizeQueryOptions.ts b/src/api/visualizeQueryOptions.ts index e1be19dd..7f23af75 100644 --- a/src/api/visualizeQueryOptions.ts +++ b/src/api/visualizeQueryOptions.ts @@ -1,12 +1,13 @@ +import type { LunaticSource } from '@inseefr/lunatic' +import { queryOptions } from '@tanstack/react-query' +import axios, { type AxiosRequestConfig } from 'axios' +import { ZodError } from 'zod' + import { ZodErrorWithName } from '@/components/error/ZodErrorWithName' import type { Nomenclature } from '@/components/orchestrator/utils/lunaticType' import type { Metadata } from '@/models/Metadata' import type { SurveyUnitData } from '@/models/SurveyUnitData' import { surveyUnitMetadataSchema } from '@/models/metadataSchema' -import type { LunaticSource } from '@inseefr/lunatic' -import { queryOptions } from '@tanstack/react-query' -import axios, { type AxiosRequestConfig } from 'axios' -import { ZodError } from 'zod' function axiosGet(url: string, options?: AxiosRequestConfig) { return axios.get(url, options).then(({ data }) => data) diff --git a/src/components/Container.tsx b/src/components/Container.tsx index 7f69f63d..2d18674e 100644 --- a/src/components/Container.tsx +++ b/src/components/Container.tsx @@ -1,6 +1,7 @@ -import { fr } from '@codegouvfr/react-dsfr' import { type PropsWithChildren } from 'react' +import { fr } from '@codegouvfr/react-dsfr' + export function Container(props: PropsWithChildren) { const { children } = props return ( diff --git a/src/components/Grid.tsx b/src/components/Grid.tsx index d55c3f52..4abf6885 100644 --- a/src/components/Grid.tsx +++ b/src/components/Grid.tsx @@ -1,6 +1,7 @@ -import { fr } from '@codegouvfr/react-dsfr' import { type PropsWithChildren } from 'react' +import { fr } from '@codegouvfr/react-dsfr' + export function Grid(props: PropsWithChildren) { const { children } = props return ( diff --git a/src/components/Toast.tsx b/src/components/Toast.tsx index 794a1b07..d1ec557b 100644 --- a/src/components/Toast.tsx +++ b/src/components/Toast.tsx @@ -1,9 +1,11 @@ -import { isMobileScreen } from '@/utils/isMobileScreen' +import type { ComponentProps, ReactNode } from 'react' + import { fr } from '@codegouvfr/react-dsfr' import Alert from '@codegouvfr/react-dsfr/Alert' -import type { ComponentProps, ReactNode } from 'react' import { toast } from 'react-hot-toast' +import { isMobileScreen } from '@/utils/isMobileScreen' + type Params = { severity: ComponentProps['severity'] title: NonNullable diff --git a/src/components/error/ErrorComponent.tsx b/src/components/error/ErrorComponent.tsx index 69cc3623..68a72342 100644 --- a/src/components/error/ErrorComponent.tsx +++ b/src/components/error/ErrorComponent.tsx @@ -1,14 +1,14 @@ import { fr } from '@codegouvfr/react-dsfr' import Button from '@codegouvfr/react-dsfr/Button' import ArtWorkBackground from '@codegouvfr/react-dsfr/dsfr/artwork/background/ovoid.svg' +import TechnicalError from '@codegouvfr/react-dsfr/dsfr/artwork/pictograms/system/technical-error.svg' import ArtWork from '@codegouvfr/react-dsfr/dsfr/artwork/system.svg' +import { useNavigate, useSearch } from '@tanstack/react-router' import { Container } from '@/components/Container' import { errorNormalizer } from '@/components/error/errorNormalizer' import { useDocumentTitle } from '@/hooks/useDocumentTitle' import { declareComponentKeys, useTranslation } from '@/i18n' -import TechnicalError from '@codegouvfr/react-dsfr/dsfr/artwork/pictograms/system/technical-error.svg' -import { useNavigate, useSearch } from '@tanstack/react-router' type Props = { error: unknown diff --git a/src/components/error/errorNormalizer.tsx b/src/components/error/errorNormalizer.tsx index 001c9a3a..d4fe8e4b 100644 --- a/src/components/error/errorNormalizer.tsx +++ b/src/components/error/errorNormalizer.tsx @@ -1,8 +1,10 @@ -import { declareComponentKeys, getTranslation } from '@/i18n' import type { ReactNode } from '@tanstack/react-router' import { AxiosError } from 'axios' + +import { declareComponentKeys, getTranslation } from '@/i18n' + +import { type ZodErrorName, ZodErrorWithName } from './ZodErrorWithName' import { NotFoundError } from './notFoundError' -import { ZodErrorWithName, type ZodErrorName } from './ZodErrorWithName' type ErrorNormalized = { title: string diff --git a/src/components/layout/AutoLogoutCountdown.tsx b/src/components/layout/AutoLogoutCountdown.tsx index 57696e40..123a83ab 100644 --- a/src/components/layout/AutoLogoutCountdown.tsx +++ b/src/components/layout/AutoLogoutCountdown.tsx @@ -1,7 +1,9 @@ +import { useEffect, useState } from 'react' + +import { declareComponentKeys } from 'i18nifty' + import { useTranslation } from '@/i18n' import { useOidc } from '@/oidc' -import { declareComponentKeys } from 'i18nifty' -import { useEffect, useState } from 'react' export function AutoLogoutCountdown() { const { isUserLoggedIn, subscribeToAutoLogoutCountdown } = useOidc() diff --git a/src/components/layout/Footer.tsx b/src/components/layout/Footer.tsx index 04c283a2..90fe3a6d 100644 --- a/src/components/layout/Footer.tsx +++ b/src/components/layout/Footer.tsx @@ -1,3 +1,6 @@ +import { fr } from '@codegouvfr/react-dsfr' +import { Footer as DSFRFooter } from '@codegouvfr/react-dsfr/Footer' + import { MODE_TYPE } from '@/constants/mode' import { useMode } from '@/hooks/useMode' import { @@ -9,8 +12,7 @@ import type { Logo } from '@/models/Metadata' import { NavigationAssistancePage } from '@/pages/navigationAssistance/NavigationAssistancePage' import { SecurityPage } from '@/pages/security/SecurityPage' import { useMetadataStore } from '@/stores/useMetadataStore' -import { fr } from '@codegouvfr/react-dsfr' -import { Footer as DSFRFooter } from '@codegouvfr/react-dsfr/Footer' + import { Header } from './Header' const transformLogo = ( diff --git a/src/components/layout/Header.test.tsx b/src/components/layout/Header.test.tsx index c42d7059..120b0f39 100644 --- a/src/components/layout/Header.test.tsx +++ b/src/components/layout/Header.test.tsx @@ -1,12 +1,14 @@ +import { waitFor } from '@testing-library/react' +import userEvent from '@testing-library/user-event' +import { expect } from 'vitest' + import { MODE_TYPE } from '@/constants/mode' import { TELEMETRY_EVENT_TYPE } from '@/constants/telemetry' import { TelemetryContext } from '@/contexts/TelemetryContext' import { useMode } from '@/hooks/useMode' import { OidcProvider } from '@/oidc' import { renderWithRouter } from '@/utils/tests' -import { waitFor } from '@testing-library/react' -import userEvent from '@testing-library/user-event' -import { expect } from 'vitest' + import { Header } from './Header' vi.mock('@/hooks/useMode') diff --git a/src/components/layout/Header.tsx b/src/components/layout/Header.tsx index 554d0a2a..65c808ef 100644 --- a/src/components/layout/Header.tsx +++ b/src/components/layout/Header.tsx @@ -1,3 +1,7 @@ +import { headerFooterDisplayItem } from '@codegouvfr/react-dsfr/Display' +import { Header as DsfrHeader } from '@codegouvfr/react-dsfr/Header' +import { useSearch } from '@tanstack/react-router' + import { MODE_TYPE } from '@/constants/mode' import { TELEMETRY_EVENT_EXIT_SOURCE } from '@/constants/telemetry' import { useTelemetry } from '@/contexts/TelemetryContext' @@ -12,9 +16,6 @@ import { useOidc } from '@/oidc' import { collectPath } from '@/pages/collect/route' import { useMetadataStore } from '@/stores/useMetadataStore' import { computeContactSupportEvent, computeExitEvent } from '@/utils/telemetry' -import { headerFooterDisplayItem } from '@codegouvfr/react-dsfr/Display' -import { Header as DsfrHeader } from '@codegouvfr/react-dsfr/Header' -import { useSearch } from '@tanstack/react-router' export function Header() { const { t } = useTranslation({ Header }) diff --git a/src/components/orchestrator/Orchestrator.test.tsx b/src/components/orchestrator/Orchestrator.test.tsx index b69cc547..04565472 100644 --- a/src/components/orchestrator/Orchestrator.test.tsx +++ b/src/components/orchestrator/Orchestrator.test.tsx @@ -1,10 +1,12 @@ +import { act, waitFor } from '@testing-library/react' +import userEvent from '@testing-library/user-event' +import { expect } from 'vitest' + import { MODE_TYPE } from '@/constants/mode' import { TELEMETRY_EVENT_TYPE } from '@/constants/telemetry' import { TelemetryContext } from '@/contexts/TelemetryContext' import { renderWithRouter } from '@/utils/tests' -import { act, waitFor } from '@testing-library/react' -import userEvent from '@testing-library/user-event' -import { expect } from 'vitest' + import { Orchestrator } from './Orchestrator' describe('Orchestrator', () => { diff --git a/src/components/orchestrator/Orchestrator.tsx b/src/components/orchestrator/Orchestrator.tsx index 5ca58011..b56f36ed 100644 --- a/src/components/orchestrator/Orchestrator.tsx +++ b/src/components/orchestrator/Orchestrator.tsx @@ -1,3 +1,16 @@ +import { useCallback, useEffect, useMemo, useRef, useState } from 'react' + +import { fr } from '@codegouvfr/react-dsfr' +import { + type LunaticChangesHandler, + LunaticComponents, + type LunaticData, + type LunaticError, + type LunaticSource, + useLunatic, +} from '@inseefr/lunatic' +import { useNavigate } from '@tanstack/react-router' + import { MODE_TYPE } from '@/constants/mode' import { PAGE_TYPE } from '@/constants/page' import { useTelemetry } from '@/contexts/TelemetryContext' @@ -13,17 +26,8 @@ import { computeInputEvent, computeNewPageEvent, } from '@/utils/telemetry' -import { fr } from '@codegouvfr/react-dsfr' -import { - LunaticComponents, - useLunatic, - type LunaticChangesHandler, - type LunaticData, - type LunaticError, - type LunaticSource, -} from '@inseefr/lunatic' -import { useNavigate } from '@tanstack/react-router' -import { useCallback, useEffect, useMemo, useRef, useState } from 'react' + +import { SurveyContainer } from './SurveyContainer' import { EndPage } from './customPages/EndPage' import { ValidationModal } from './customPages/ValidationModal' import { ValidationPage } from './customPages/ValidationPage' @@ -34,7 +38,6 @@ import { useRefSync } from './hooks/useRefSync' import { useStromaeNavigation } from './hooks/useStromaeNavigation' import { useUpdateEffect } from './hooks/useUpdateEffect' import { slotComponents } from './slotComponents' -import { SurveyContainer } from './SurveyContainer' import { computeLunaticComponents } from './utils/components' import { isBlockingError } from './utils/controls' import { trimCollectedData } from './utils/data' diff --git a/src/components/orchestrator/SequenceHeader.tsx b/src/components/orchestrator/SequenceHeader.tsx index 5b27f799..96f8327a 100644 --- a/src/components/orchestrator/SequenceHeader.tsx +++ b/src/components/orchestrator/SequenceHeader.tsx @@ -1,6 +1,8 @@ +import { fr } from '@codegouvfr/react-dsfr' + import { useSequenceTitle } from '@/hooks/useDocumentTitle' import { declareComponentKeys, useTranslation } from '@/i18n' -import { fr } from '@codegouvfr/react-dsfr' + import type { LunaticOverview } from './utils/lunaticType' type SequenceHeaderProps = { diff --git a/src/components/orchestrator/SurveyContainer.tsx b/src/components/orchestrator/SurveyContainer.tsx index 0baaf394..ffd4ed99 100644 --- a/src/components/orchestrator/SurveyContainer.tsx +++ b/src/components/orchestrator/SurveyContainer.tsx @@ -1,10 +1,13 @@ +import { type PropsWithChildren, type ReactNode, useState } from 'react' + +import { fr } from '@codegouvfr/react-dsfr' +import Button from '@codegouvfr/react-dsfr/Button' + import { MODE_TYPE } from '@/constants/mode' import { PAGE_TYPE } from '@/constants/page' import { declareComponentKeys, useTranslation } from '@/i18n' import type { InternalPageType } from '@/models/Page' -import { fr } from '@codegouvfr/react-dsfr' -import Button from '@codegouvfr/react-dsfr/Button' -import { useState, type PropsWithChildren, type ReactNode } from 'react' + import type { OrchestratorProps } from './Orchestrator' import { SequenceHeader } from './SequenceHeader' import type { LunaticOverview } from './utils/lunaticType' diff --git a/src/components/orchestrator/customPages/EndPage.test.tsx b/src/components/orchestrator/customPages/EndPage.test.tsx index 4a19a1d5..9beb20a3 100644 --- a/src/components/orchestrator/customPages/EndPage.test.tsx +++ b/src/components/orchestrator/customPages/EndPage.test.tsx @@ -1,45 +1,51 @@ import { render } from '@testing-library/react' import { expect } from 'vitest' + import { EndPage } from './EndPage' +vi.mock('i18nifty') + describe('EndPage', () => { it('displays date at which answers have been sent', async () => { const date = 1728289634098 + const formattedDate = { formattedDate: new Date(date).toLocaleString() } const { getByText } = render() expect( - getByText( - `Your responses were sent on ${new Date(date).toLocaleString()}.`, - ), + getByText(`paragraph ${JSON.stringify(formattedDate)}`), ).toBeInTheDocument() }) it('displays no date if no date has been provided', async () => { + const formattedDate = { formattedDate: undefined } + const { getByText } = render() - expect(getByText('Your responses were sent.')).toBeInTheDocument() + expect( + getByText(`paragraph ${JSON.stringify(formattedDate)}`), + ).toBeInTheDocument() }) it('does not display date if data have been flagged for extraction', async () => { const date = 1728289634098 + const formattedDate = { formattedDate: undefined } - const { getByText, queryByText } = render( - , - ) + const { getByText } = render() - expect(getByText('Your responses were sent.')).toBeInTheDocument() - expect(queryByText(`${new Date(date).toLocaleString()}`)).toBeNull() + expect( + getByText(`paragraph ${JSON.stringify(formattedDate)}`), + ).toBeInTheDocument() }) it('does not display date if data have been extracted', async () => { const date = 1728289634098 + const formattedDate = { formattedDate: undefined } - const { getByText, queryByText } = render( - , - ) + const { getByText } = render() - expect(getByText('Your responses were sent.')).toBeInTheDocument() - expect(queryByText(`${new Date(date).toLocaleString()}`)).toBeNull() + expect( + getByText(`paragraph ${JSON.stringify(formattedDate)}`), + ).toBeInTheDocument() }) }) diff --git a/src/components/orchestrator/customPages/EndPage.tsx b/src/components/orchestrator/customPages/EndPage.tsx index 47ffa7f8..0c9173de 100644 --- a/src/components/orchestrator/customPages/EndPage.tsx +++ b/src/components/orchestrator/customPages/EndPage.tsx @@ -1,7 +1,8 @@ +import { fr } from '@codegouvfr/react-dsfr' + import { useDocumentTitle } from '@/hooks/useDocumentTitle' import { declareComponentKeys, useTranslation } from '@/i18n' import type { StateData } from '@/models/StateData' -import { fr } from '@codegouvfr/react-dsfr' /** * Display time at which user has sent its answers. diff --git a/src/components/orchestrator/customPages/ValidationModal.tsx b/src/components/orchestrator/customPages/ValidationModal.tsx index a3f12853..9fb6902b 100644 --- a/src/components/orchestrator/customPages/ValidationModal.tsx +++ b/src/components/orchestrator/customPages/ValidationModal.tsx @@ -1,8 +1,10 @@ -import { declareComponentKeys, useTranslation } from '@/i18n' +import { type MutableRefObject, useEffect, useId, useState } from 'react' + import { createModal } from '@codegouvfr/react-dsfr/Modal' -import { useEffect, useId, useState, type MutableRefObject } from 'react' import { assert } from 'tsafe/assert' +import { declareComponentKeys, useTranslation } from '@/i18n' + export type Props = { actionsRef: MutableRefObject<{ open?: () => Promise diff --git a/src/components/orchestrator/customPages/ValidationPage.tsx b/src/components/orchestrator/customPages/ValidationPage.tsx index 3c37d396..34122ccf 100644 --- a/src/components/orchestrator/customPages/ValidationPage.tsx +++ b/src/components/orchestrator/customPages/ValidationPage.tsx @@ -1,6 +1,7 @@ +import { fr } from '@codegouvfr/react-dsfr' + import { useDocumentTitle } from '@/hooks/useDocumentTitle' import { declareComponentKeys, useTranslation } from '@/i18n' -import { fr } from '@codegouvfr/react-dsfr' export function ValidationPage() { const { t } = useTranslation({ ValidationPage }) diff --git a/src/components/orchestrator/customPages/WelcomeModal.tsx b/src/components/orchestrator/customPages/WelcomeModal.tsx index ab755c31..911cda66 100644 --- a/src/components/orchestrator/customPages/WelcomeModal.tsx +++ b/src/components/orchestrator/customPages/WelcomeModal.tsx @@ -1,7 +1,9 @@ -import { declareComponentKeys, useTranslation } from '@/i18n' -import { createModal } from '@codegouvfr/react-dsfr/Modal' import { useEffect, useRef } from 'react' +import { createModal } from '@codegouvfr/react-dsfr/Modal' + +import { declareComponentKeys, useTranslation } from '@/i18n' + const modal = createModal({ id: 'welcomeModal', isOpenedByDefault: false, diff --git a/src/components/orchestrator/customPages/WelcomePage.test.tsx b/src/components/orchestrator/customPages/WelcomePage.test.tsx index 972e4200..8ef4fea1 100644 --- a/src/components/orchestrator/customPages/WelcomePage.test.tsx +++ b/src/components/orchestrator/customPages/WelcomePage.test.tsx @@ -1,5 +1,6 @@ import { render } from '@testing-library/react' import { expect } from 'vitest' + import { WelcomePage } from './WelcomePage' describe('WelcomePage', () => { diff --git a/src/components/orchestrator/customPages/WelcomePage.tsx b/src/components/orchestrator/customPages/WelcomePage.tsx index 7035943a..29c89093 100644 --- a/src/components/orchestrator/customPages/WelcomePage.tsx +++ b/src/components/orchestrator/customPages/WelcomePage.tsx @@ -1,3 +1,7 @@ +import { Fragment } from 'react' + +import { fr } from '@codegouvfr/react-dsfr' + import { useDocumentTitle } from '@/hooks/useDocumentTitle' import { declareComponentKeys, @@ -5,8 +9,6 @@ import { useTranslation, } from '@/i18n' import type { Contents, Metadata } from '@/models/Metadata' -import { fr } from '@codegouvfr/react-dsfr' -import { Fragment } from 'react' function renderMetadataContents(contents: Contents[] | undefined) { if (contents === undefined) return null diff --git a/src/components/orchestrator/hooks/usePushEventAfterInactivity.test.ts b/src/components/orchestrator/hooks/usePushEventAfterInactivity.test.ts index 56039ea6..a7285437 100644 --- a/src/components/orchestrator/hooks/usePushEventAfterInactivity.test.ts +++ b/src/components/orchestrator/hooks/usePushEventAfterInactivity.test.ts @@ -1,5 +1,7 @@ -import { computeInputEvent } from '@/utils/telemetry' import { act, renderHook } from '@testing-library/react' + +import { computeInputEvent } from '@/utils/telemetry' + import { usePushEventAfterInactivity } from './usePushEventAfterInactivity' describe('Use push event after inactivity', () => { diff --git a/src/components/orchestrator/hooks/usePushEventAfterInactivity.ts b/src/components/orchestrator/hooks/usePushEventAfterInactivity.ts index 0ba9ec20..a05fd0d2 100644 --- a/src/components/orchestrator/hooks/usePushEventAfterInactivity.ts +++ b/src/components/orchestrator/hooks/usePushEventAfterInactivity.ts @@ -1,6 +1,7 @@ +import { useEffect, useRef, useState } from 'react' + import type { CommonParadata, InputParadata } from '@/models/telemetry' import { areInputParadataIdentical } from '@/utils/telemetry' -import { useEffect, useRef, useState } from 'react' const defaultInactivityDelay = 1_000 diff --git a/src/components/orchestrator/hooks/useStromaeNavigation.tsx b/src/components/orchestrator/hooks/useStromaeNavigation.tsx index 117be14c..93066468 100644 --- a/src/components/orchestrator/hooks/useStromaeNavigation.tsx +++ b/src/components/orchestrator/hooks/useStromaeNavigation.tsx @@ -1,7 +1,10 @@ +import { useState } from 'react' + +import { type Equals, assert } from 'tsafe/assert' + import { PAGE_TYPE } from '@/constants/page' import type { InternalPageType, PageType, StromaePage } from '@/models/Page' -import { useState } from 'react' -import { assert, type Equals } from 'tsafe/assert' + import type { LunaticGoNextPage, LunaticGoPreviousPage, diff --git a/src/components/orchestrator/slotComponents.tsx b/src/components/orchestrator/slotComponents.tsx index bb002437..e50cd322 100644 --- a/src/components/orchestrator/slotComponents.tsx +++ b/src/components/orchestrator/slotComponents.tsx @@ -1,9 +1,10 @@ /* eslint-disable react-refresh/only-export-components */ -import { useSequenceTitle } from '@/hooks/useDocumentTitle' import type { LunaticSlotComponents } from '@inseefr/lunatic' import { slotComponents as dsfrSlotsComponents } from '@inseefr/lunatic-dsfr' import { assert } from 'tsafe/assert' +import { useSequenceTitle } from '@/hooks/useDocumentTitle' + const Sequence: LunaticSlotComponents['Sequence'] = (props) => { const DsfrSequence = dsfrSlotsComponents['Sequence'] diff --git a/src/components/orchestrator/utils/components.ts b/src/components/orchestrator/utils/components.ts index 1245dd73..f9277ff4 100644 --- a/src/components/orchestrator/utils/components.ts +++ b/src/components/orchestrator/utils/components.ts @@ -1,4 +1,5 @@ import type { LunaticComponentProps } from '@inseefr/lunatic' + import type { LunaticComponentsProps } from './lunaticType' export function computeLunaticComponents( diff --git a/src/components/orchestrator/utils/lunaticType.ts b/src/components/orchestrator/utils/lunaticType.ts index 81dca2d7..f6b4baa2 100644 --- a/src/components/orchestrator/utils/lunaticType.ts +++ b/src/components/orchestrator/utils/lunaticType.ts @@ -1,7 +1,7 @@ import { - VTLExpressionError, type LunaticOptions, type LunaticState, + VTLExpressionError, } from '@inseefr/lunatic' export type LunaticGetReferentiel = LunaticOptions['getReferentiel'] diff --git a/src/components/orchestrator/utils/orchestrator.test.ts b/src/components/orchestrator/utils/orchestrator.test.ts index 714069c2..b0d24ae5 100644 --- a/src/components/orchestrator/utils/orchestrator.test.ts +++ b/src/components/orchestrator/utils/orchestrator.test.ts @@ -1,4 +1,5 @@ import { PAGE_TYPE } from '@/constants/page' + import { hasBeenSent, shouldDisplayWelcomeModal } from './orchestrator' test('has been sent', () => { diff --git a/src/components/orchestrator/vtlDevTools/VTLDevtools.tsx b/src/components/orchestrator/vtlDevTools/VTLDevtools.tsx index b8443990..f657b01f 100644 --- a/src/components/orchestrator/vtlDevTools/VTLDevtools.tsx +++ b/src/components/orchestrator/vtlDevTools/VTLDevtools.tsx @@ -1,11 +1,14 @@ -import { useTranslation } from '@/i18n' +import { useState } from 'react' + import { fr } from '@codegouvfr/react-dsfr' import Button from '@codegouvfr/react-dsfr/Button' import { VTLExpressionError, VTLInterpretationError } from '@inseefr/lunatic' import Badge from '@mui/material/Badge' import Fab from '@mui/material/Fab' import { declareComponentKeys } from 'i18nifty' -import { useState } from 'react' + +import { useTranslation } from '@/i18n' + import { useLoggerErrors } from './VTLErrorStore' export const VTLDevTools = () => { diff --git a/src/components/orchestrator/vtlDevTools/VTLErrorStore.tsx b/src/components/orchestrator/vtlDevTools/VTLErrorStore.tsx index 011de1bc..ff63c203 100644 --- a/src/components/orchestrator/vtlDevTools/VTLErrorStore.tsx +++ b/src/components/orchestrator/vtlDevTools/VTLErrorStore.tsx @@ -1,10 +1,12 @@ +import { useSyncExternalStore } from 'react' + +import { VTLExpressionError } from '@inseefr/lunatic' + import type { ErrorMessage, LoggerMessage, LunaticPageTag, } from '@/components/orchestrator/utils/lunaticType' -import { VTLExpressionError } from '@inseefr/lunatic' -import { useSyncExternalStore } from 'react' function getErrorId(error: ErrorMessage) { return error.error.expression diff --git a/src/contexts/TelemetryContext.test.tsx b/src/contexts/TelemetryContext.test.tsx index dc5076f8..639a8ee9 100644 --- a/src/contexts/TelemetryContext.test.tsx +++ b/src/contexts/TelemetryContext.test.tsx @@ -1,6 +1,8 @@ -import { computeInitEvent } from '@/utils/telemetry' import '@testing-library/jest-dom' import { renderHook } from '@testing-library/react' + +import { computeInitEvent } from '@/utils/telemetry' + import { TelemetryContext, useTelemetry } from './TelemetryContext' describe('Telemetry context', () => { diff --git a/src/contexts/TelemetryContext.tsx b/src/contexts/TelemetryContext.tsx index 8f028203..e290547b 100644 --- a/src/contexts/TelemetryContext.tsx +++ b/src/contexts/TelemetryContext.tsx @@ -1,11 +1,4 @@ /* eslint-disable react-refresh/only-export-components */ -import { addParadata } from '@/api/07-paradata-events' -import { useBatch } from '@/hooks/useBatch' -import type { - DefaultParadataValues, - TelemetryEvent, - TelemetryParadata, -} from '@/models/telemetry' import { createContext, useCallback, @@ -14,6 +7,14 @@ import { useState, } from 'react' +import { addParadata } from '@/api/07-paradata-events' +import { useBatch } from '@/hooks/useBatch' +import type { + DefaultParadataValues, + TelemetryEvent, + TelemetryParadata, +} from '@/models/telemetry' + type TelemetryContextType = { isTelemetryDisabled: boolean pushEvent: (e: TelemetryParadata) => void | Promise diff --git a/src/hooks/prelogout.ts b/src/hooks/prelogout.ts index 559e5296..11caaf92 100644 --- a/src/hooks/prelogout.ts +++ b/src/hooks/prelogout.ts @@ -1,6 +1,7 @@ -import { useEvent } from '@/utils/useEvent' import { useEffect } from 'react' +import { useEvent } from '@/utils/useEvent' + const actions = new Set<() => Promise | void>() export async function executePreLogoutActions() { diff --git a/src/hooks/useBatch.test.ts b/src/hooks/useBatch.test.ts index c40d2a7c..6d63d263 100644 --- a/src/hooks/useBatch.test.ts +++ b/src/hooks/useBatch.test.ts @@ -1,4 +1,5 @@ import { act, renderHook } from '@testing-library/react' + import { useBatch } from './useBatch' describe('Use batch', () => { @@ -49,7 +50,7 @@ describe('Use batch', () => { expect(mock).not.toHaveBeenCalled() - act(() => result.current.triggerTimeoutEvent()) + await act(() => result.current.triggerTimeoutEvent()) expect(mock).toHaveBeenCalledOnce() expect(mock).toHaveBeenCalledWith([1, 2]) diff --git a/src/hooks/useDocumentTitle.ts b/src/hooks/useDocumentTitle.ts index 12400455..3b7fef82 100644 --- a/src/hooks/useDocumentTitle.ts +++ b/src/hooks/useDocumentTitle.ts @@ -1,6 +1,8 @@ +import { type ReactNode, useEffect } from 'react' + import { decode } from 'he' -import { useEffect, type ReactNode } from 'react' import { renderToStaticMarkup } from 'react-dom/server' + export function useDocumentTitle(title: string) { useEffect(() => { const prevTitle = document.title diff --git a/src/hooks/useMode.ts b/src/hooks/useMode.ts index a31beb5e..05526fca 100644 --- a/src/hooks/useMode.ts +++ b/src/hooks/useMode.ts @@ -1,8 +1,9 @@ +import { useMatchRoute } from '@tanstack/react-router' + import { MODE_TYPE } from '@/constants/mode' import { collectPath } from '@/pages/collect/route' import { reviewPath } from '@/pages/review/route' import { visualizePath } from '@/pages/visualize/route' -import { useMatchRoute } from '@tanstack/react-router' /** Returns current mode based on url */ export function useMode(): diff --git a/src/i18n/i18n.ts b/src/i18n/i18n.ts index 752162d6..c089849b 100644 --- a/src/i18n/i18n.ts +++ b/src/i18n/i18n.ts @@ -1,5 +1,7 @@ import { createI18nApi, declareComponentKeys } from 'i18nifty' -import { fallbackLanguage, languages, type ComponentKey } from './types' + +import { type ComponentKey, fallbackLanguage, languages } from './types' + export { declareComponentKeys } export type LocalizedString = Parameters[0] diff --git a/src/main.tsx b/src/main.tsx index 5fdbbf2d..614a1d64 100644 --- a/src/main.tsx +++ b/src/main.tsx @@ -1,5 +1,7 @@ import React from 'react' + import ReactDOM from 'react-dom/client' + import { App } from './App' ReactDOM.createRoot(document.getElementById('root')!).render( diff --git a/src/models/Page.ts b/src/models/Page.ts index fa53d67a..5628a0d5 100644 --- a/src/models/Page.ts +++ b/src/models/Page.ts @@ -1,6 +1,7 @@ -import { PAGE_TYPE } from '@/constants/page' import type { LunaticState } from '@inseefr/lunatic' +import { PAGE_TYPE } from '@/constants/page' + export type StromaePage = | PAGE_TYPE.WELCOME | PAGE_TYPE.VALIDATION diff --git a/src/models/StateData.ts b/src/models/StateData.ts index 70f64e20..eb721bac 100644 --- a/src/models/StateData.ts +++ b/src/models/StateData.ts @@ -1,5 +1,6 @@ import { type Extends } from 'tsafe/Extends' import { assert } from 'tsafe/assert' + import type { PageType } from './Page' import type { StateData as StateDataApi } from './api' diff --git a/src/models/SurveyUnitData.ts b/src/models/SurveyUnitData.ts index 28f8053a..273cca03 100644 --- a/src/models/SurveyUnitData.ts +++ b/src/models/SurveyUnitData.ts @@ -1,6 +1,7 @@ import type { LunaticData } from '@inseefr/lunatic' import type { Extends } from 'tsafe/Extends' import { assert } from 'tsafe/assert' + import type { StateData } from './StateData' import type { SurveyUnit } from './api' diff --git a/src/models/metadataSchema.ts b/src/models/metadataSchema.ts index 4b2a26f1..920d43a8 100644 --- a/src/models/metadataSchema.ts +++ b/src/models/metadataSchema.ts @@ -1,8 +1,9 @@ -import type { SurveyUnitMetadata } from '@/models/api' -import { assert } from 'tsafe/assert' import type { Extends } from 'tsafe/Extends' +import { assert } from 'tsafe/assert' import { z } from 'zod' +import type { SurveyUnitMetadata } from '@/models/api' + const logoSchema = z.object({ label: z.string(), url: z.string(), diff --git a/src/models/pageSchema.ts b/src/models/pageSchema.ts index 66ba9484..70a8be03 100644 --- a/src/models/pageSchema.ts +++ b/src/models/pageSchema.ts @@ -1,7 +1,8 @@ +import { type Equals, assert } from 'tsafe/assert' +import z from 'zod' + import { PAGE_TYPE } from '@/constants/page' import type { InternalPageType, PageType, StromaePage } from '@/models/Page' -import { assert, type Equals } from 'tsafe/assert' -import z from 'zod' export const stromaePageSchema = z.enum([ PAGE_TYPE.WELCOME, diff --git a/src/pages/accessibility/AccessibilityPage.tsx b/src/pages/accessibility/AccessibilityPage.tsx index 395c07df..725677b3 100644 --- a/src/pages/accessibility/AccessibilityPage.tsx +++ b/src/pages/accessibility/AccessibilityPage.tsx @@ -1,7 +1,9 @@ +import { memo } from 'react' + +import { Breadcrumb } from '@codegouvfr/react-dsfr/Breadcrumb' + import { Grid } from '@/components/Grid' import { declareComponentKeys, useTranslation } from '@/i18n' -import { Breadcrumb } from '@codegouvfr/react-dsfr/Breadcrumb' -import { memo } from 'react' export const AccessibilityPage = memo(function AccessibilityPage() { const { t } = useTranslation({ AccessibilityPage }) diff --git a/src/pages/accessibility/route.ts b/src/pages/accessibility/route.ts index be43ff13..620d12d6 100644 --- a/src/pages/accessibility/route.ts +++ b/src/pages/accessibility/route.ts @@ -1,5 +1,7 @@ -import { rootRoute } from '@/router/router' import { createRoute } from '@tanstack/react-router' + +import { rootRoute } from '@/router/router' + import { AccessibilityPage } from './AccessibilityPage' export const accessibilityPath = '/accessibilite' diff --git a/src/pages/collect/CollectPage.tsx b/src/pages/collect/CollectPage.tsx index 3d966c22..eca51450 100644 --- a/src/pages/collect/CollectPage.tsx +++ b/src/pages/collect/CollectPage.tsx @@ -1,20 +1,23 @@ +import { memo, useCallback } from 'react' + +import type { LunaticData } from '@inseefr/lunatic' +import { useQueryClient } from '@tanstack/react-query' + import { getGetNomenclatureByIdQueryOptions } from '@/api/04-nomenclatures' import { getGenerateDepositProofQueryOptions, getGetSurveyUnitByIdQueryKey, updateSurveyUnitDataStateDataById, } from '@/api/06-survey-units' +import { showToast } from '@/components/Toast' import { Orchestrator } from '@/components/orchestrator/Orchestrator' import type { LunaticGetReferentiel, Nomenclature, } from '@/components/orchestrator/utils/lunaticType' -import { showToast } from '@/components/Toast' import { MODE_TYPE } from '@/constants/mode' import type { StateData } from '@/models/StateData' -import type { LunaticData } from '@inseefr/lunatic' -import { useQueryClient } from '@tanstack/react-query' -import { memo, useCallback } from 'react' + import { collectRoute } from './route' export const CollectPage = memo(function CollectPage() { diff --git a/src/pages/collect/route.tsx b/src/pages/collect/route.tsx index 36607f01..e8f945f5 100644 --- a/src/pages/collect/route.tsx +++ b/src/pages/collect/route.tsx @@ -1,3 +1,7 @@ +import type { LunaticSource } from '@inseefr/lunatic' +import { createRoute } from '@tanstack/react-router' +import { z } from 'zod' + import { getGetQuestionnaireDataQueryOptions } from '@/api/03-questionnaires' import { getGetSurveyUnitMetadataByIdQueryOptions, @@ -10,9 +14,7 @@ import type { SurveyUnitData } from '@/models/SurveyUnitData' import { rootRoute } from '@/router/router' import { metadataStore } from '@/stores/metadataStore' import { convertOldPersonalization } from '@/utils/convertOldPersonalization' -import type { LunaticSource } from '@inseefr/lunatic' -import { createRoute } from '@tanstack/react-router' -import { z } from 'zod' + import { CollectPage } from './CollectPage' const collectSearchParams = z.object({ diff --git a/src/pages/legals/LegalsPage.tsx b/src/pages/legals/LegalsPage.tsx index 03b8fc28..e144acdb 100644 --- a/src/pages/legals/LegalsPage.tsx +++ b/src/pages/legals/LegalsPage.tsx @@ -1,7 +1,9 @@ +import { type ReactNode, memo } from 'react' + +import { Breadcrumb } from '@codegouvfr/react-dsfr/Breadcrumb' + import { Grid } from '@/components/Grid' import { declareComponentKeys, useTranslation } from '@/i18n' -import { Breadcrumb } from '@codegouvfr/react-dsfr/Breadcrumb' -import { memo, type ReactNode } from 'react' export const LegalsPage = memo(function LegalsPage() { const { t } = useTranslation({ LegalsPage }) diff --git a/src/pages/legals/route.ts b/src/pages/legals/route.ts index 4d5d2d40..0b863bb2 100644 --- a/src/pages/legals/route.ts +++ b/src/pages/legals/route.ts @@ -1,5 +1,7 @@ -import { rootRoute } from '@/router/router' import { createRoute } from '@tanstack/react-router' + +import { rootRoute } from '@/router/router' + import { LegalsPage } from './LegalsPage' export const legalsPath = '/mentions-legales' diff --git a/src/pages/navigationAssistance/NavigationAssistancePage.tsx b/src/pages/navigationAssistance/NavigationAssistancePage.tsx index 3c1f2a68..d23074b7 100644 --- a/src/pages/navigationAssistance/NavigationAssistancePage.tsx +++ b/src/pages/navigationAssistance/NavigationAssistancePage.tsx @@ -1,7 +1,9 @@ +import { type ReactNode, memo } from 'react' + +import Breadcrumb from '@codegouvfr/react-dsfr/Breadcrumb' + import { Grid } from '@/components/Grid' import { declareComponentKeys, useTranslation } from '@/i18n' -import Breadcrumb from '@codegouvfr/react-dsfr/Breadcrumb' -import { memo, type ReactNode } from 'react' export const NavigationAssistancePage = memo( function NavigationAssistancePage() { diff --git a/src/pages/navigationAssistance/route.ts b/src/pages/navigationAssistance/route.ts index cd892b8e..5c78c002 100644 --- a/src/pages/navigationAssistance/route.ts +++ b/src/pages/navigationAssistance/route.ts @@ -1,5 +1,7 @@ -import { rootRoute } from '@/router/router' import { createRoute } from '@tanstack/react-router' + +import { rootRoute } from '@/router/router' + import { NavigationAssistancePage } from './NavigationAssistancePage' export const navigationPath = '/aide-a-la-navigation' diff --git a/src/pages/review/ReviewPage.tsx b/src/pages/review/ReviewPage.tsx index 9bb95594..3f2fa658 100644 --- a/src/pages/review/ReviewPage.tsx +++ b/src/pages/review/ReviewPage.tsx @@ -1,3 +1,7 @@ +import { memo } from 'react' + +import { useQueryClient } from '@tanstack/react-query' + import { getGetNomenclatureByIdQueryOptions } from '@/api/04-nomenclatures' import { Orchestrator } from '@/components/orchestrator/Orchestrator' import type { @@ -5,8 +9,7 @@ import type { Nomenclature, } from '@/components/orchestrator/utils/lunaticType' import { MODE_TYPE } from '@/constants/mode' -import { useQueryClient } from '@tanstack/react-query' -import { memo } from 'react' + import { reviewRoute } from './route' export const ReviewPage = memo(function ReviewPage() { diff --git a/src/pages/review/route.tsx b/src/pages/review/route.tsx index cebe421f..3e427b94 100644 --- a/src/pages/review/route.tsx +++ b/src/pages/review/route.tsx @@ -1,3 +1,6 @@ +import type { LunaticSource } from '@inseefr/lunatic' +import { createRoute } from '@tanstack/react-router' + import { getGetQuestionnaireDataQueryOptions } from '@/api/03-questionnaires' import { getGetSurveyUnitByIdQueryOptions, @@ -10,8 +13,7 @@ import type { SurveyUnitData } from '@/models/SurveyUnitData' import { rootRoute } from '@/router/router' import { metadataStore } from '@/stores/metadataStore' import { convertOldPersonalization } from '@/utils/convertOldPersonalization' -import type { LunaticSource } from '@inseefr/lunatic' -import { createRoute } from '@tanstack/react-router' + import { ReviewPage } from './ReviewPage' export const reviewPath = diff --git a/src/pages/security/SecurityPage.tsx b/src/pages/security/SecurityPage.tsx index 956757b7..18a32510 100644 --- a/src/pages/security/SecurityPage.tsx +++ b/src/pages/security/SecurityPage.tsx @@ -1,7 +1,9 @@ +import { memo } from 'react' + +import Breadcrumb from '@codegouvfr/react-dsfr/Breadcrumb' + import { Grid } from '@/components/Grid' import { declareComponentKeys, useTranslation } from '@/i18n' -import Breadcrumb from '@codegouvfr/react-dsfr/Breadcrumb' -import { memo } from 'react' export const SecurityPage = memo(function SecurityPage() { const { t } = useTranslation({ SecurityPage }) diff --git a/src/pages/security/route.ts b/src/pages/security/route.ts index 46fb7819..112042e0 100644 --- a/src/pages/security/route.ts +++ b/src/pages/security/route.ts @@ -1,5 +1,7 @@ -import { rootRoute } from '@/router/router' import { createRoute } from '@tanstack/react-router' + +import { rootRoute } from '@/router/router' + import { SecurityPage } from './SecurityPage' export const securitePath = '/securite' diff --git a/src/pages/siteMap/SiteMapPage.tsx b/src/pages/siteMap/SiteMapPage.tsx index d360dc25..f870f037 100644 --- a/src/pages/siteMap/SiteMapPage.tsx +++ b/src/pages/siteMap/SiteMapPage.tsx @@ -1,12 +1,14 @@ +import { memo } from 'react' + +import { Breadcrumb } from '@codegouvfr/react-dsfr/Breadcrumb' +import { Link } from '@tanstack/react-router' + import { Grid } from '@/components/Grid' import { declareComponentKeys, useTranslation } from '@/i18n' import { AccessibilityPage } from '@/pages/accessibility/AccessibilityPage' import { LegalsPage } from '@/pages/legals/LegalsPage' import { NavigationAssistancePage } from '@/pages/navigationAssistance/NavigationAssistancePage' import { SecurityPage } from '@/pages/security/SecurityPage' -import { Breadcrumb } from '@codegouvfr/react-dsfr/Breadcrumb' -import { Link } from '@tanstack/react-router' -import { memo } from 'react' export const SiteMapPage = memo(function SiteMapPage() { const { t } = useTranslation({ diff --git a/src/pages/siteMap/route.ts b/src/pages/siteMap/route.ts index a80d14ce..c1742557 100644 --- a/src/pages/siteMap/route.ts +++ b/src/pages/siteMap/route.ts @@ -1,5 +1,7 @@ -import { rootRoute } from '@/router/router' import { createRoute } from '@tanstack/react-router' + +import { rootRoute } from '@/router/router' + import { SiteMapPage } from './SiteMapPage' export const siteMapPath = '/plan-du-site' diff --git a/src/pages/visualize/Visualize.tsx b/src/pages/visualize/Visualize.tsx index 77022823..28e0b155 100644 --- a/src/pages/visualize/Visualize.tsx +++ b/src/pages/visualize/Visualize.tsx @@ -1,9 +1,12 @@ +import { memo } from 'react' + +import { useQueryClient } from '@tanstack/react-query' + import { nomenclatureQueryOptions } from '@/api/visualizeQueryOptions' import { Orchestrator } from '@/components/orchestrator/Orchestrator' import type { LunaticGetReferentiel } from '@/components/orchestrator/utils/lunaticType' import { MODE_TYPE } from '@/constants/mode' -import { useQueryClient } from '@tanstack/react-query' -import { memo } from 'react' + import { VisualizeForm } from './form/VisualizeForm' import { visualizeRoute } from './route' diff --git a/src/pages/visualize/form/SelectNomenclatures.tsx b/src/pages/visualize/form/SelectNomenclatures.tsx index a9b1e110..159f3c26 100644 --- a/src/pages/visualize/form/SelectNomenclatures.tsx +++ b/src/pages/visualize/form/SelectNomenclatures.tsx @@ -1,8 +1,10 @@ -import { declareComponentKeys, useTranslation } from '@/i18n' import { fr } from '@codegouvfr/react-dsfr' import Button from '@codegouvfr/react-dsfr/Button' import Input from '@codegouvfr/react-dsfr/Input' import { useFieldArray, useFormContext } from 'react-hook-form' + +import { declareComponentKeys, useTranslation } from '@/i18n' + import type { FormInputs } from './VisualizeForm' export function SelectNomenclatures() { diff --git a/src/pages/visualize/form/VisualizeForm.tsx b/src/pages/visualize/form/VisualizeForm.tsx index 88a65ee4..8b05b6d4 100644 --- a/src/pages/visualize/form/VisualizeForm.tsx +++ b/src/pages/visualize/form/VisualizeForm.tsx @@ -1,10 +1,12 @@ -import { Container } from '@/components/Container' -import { Grid } from '@/components/Grid' -import { declareComponentKeys, useTranslation } from '@/i18n' import { Button } from '@codegouvfr/react-dsfr/Button' import { Input } from '@codegouvfr/react-dsfr/Input' import { useNavigate } from '@tanstack/react-router' import { FormProvider, useForm } from 'react-hook-form' + +import { Container } from '@/components/Container' +import { Grid } from '@/components/Grid' +import { declareComponentKeys, useTranslation } from '@/i18n' + import { SelectNomenclatures } from './SelectNomenclatures' export type FormInputs = { diff --git a/src/pages/visualize/route.tsx b/src/pages/visualize/route.tsx index c05bfc7f..b587427d 100644 --- a/src/pages/visualize/route.tsx +++ b/src/pages/visualize/route.tsx @@ -1,3 +1,6 @@ +import { createRoute } from '@tanstack/react-router' +import { z } from 'zod' + import { metadataQueryOptions, sourceQueryOptions, @@ -7,10 +10,8 @@ import { ContentSkeleton } from '@/components/ContentSkeleton' import { ErrorComponent } from '@/components/error/ErrorComponent' import { rootRoute } from '@/router/router' import { metadataStore } from '@/stores/metadataStore' -import { createRoute } from '@tanstack/react-router' - import { convertOldPersonalization } from '@/utils/convertOldPersonalization' -import { z } from 'zod' + import { VisualizePage } from './Visualize' const visualizeSearchSchema = z diff --git a/src/router/router.tsx b/src/router/router.tsx index d48648f8..dd41ecc1 100644 --- a/src/router/router.tsx +++ b/src/router/router.tsx @@ -1,3 +1,13 @@ +import { memo, useEffect } from 'react' + +import type { QueryClient } from '@tanstack/react-query' +import { + Outlet, + ScrollRestoration, + createRootRouteWithContext, +} from '@tanstack/react-router' +import { Toaster } from 'react-hot-toast' + import { ErrorComponent } from '@/components/error/ErrorComponent' import { NotFoundError } from '@/components/error/notFoundError' import { AutoLogoutCountdown } from '@/components/layout/AutoLogoutCountdown' @@ -13,14 +23,6 @@ import { reviewRoute } from '@/pages/review/route' import { securityRoute } from '@/pages/security/route' import { siteMapRoute } from '@/pages/siteMap/route' import { visualizeRoute } from '@/pages/visualize/route' -import type { QueryClient } from '@tanstack/react-query' -import { - createRootRouteWithContext, - Outlet, - ScrollRestoration, -} from '@tanstack/react-router' -import { memo, useEffect } from 'react' -import { Toaster } from 'react-hot-toast' // eslint-disable-next-line react-refresh/only-export-components const RootComponent = memo(() => { diff --git a/src/stores/useMetadataStore.tsx b/src/stores/useMetadataStore.tsx index 7e2388e8..d1e7bf22 100644 --- a/src/stores/useMetadataStore.tsx +++ b/src/stores/useMetadataStore.tsx @@ -1,4 +1,5 @@ import { useSyncExternalStore } from 'react' + import { metadataStore } from './metadataStore' export const useMetadataStore = () => { diff --git a/src/utils/convertOldPersonalization.ts b/src/utils/convertOldPersonalization.ts index 328746b2..b9b766de 100644 --- a/src/utils/convertOldPersonalization.ts +++ b/src/utils/convertOldPersonalization.ts @@ -1,5 +1,5 @@ -import type { SurveyUnitMetadata } from '@/models/api' import type { Content, Metadata } from '@/models/Metadata' +import type { SurveyUnitMetadata } from '@/models/api' const keysToExtract = ['whoAnswers1', 'whoAnswers2', 'whoAnswers3'] diff --git a/src/utils/telemetry.test.ts b/src/utils/telemetry.test.ts index bcc60c37..ebcfa8dd 100644 --- a/src/utils/telemetry.test.ts +++ b/src/utils/telemetry.test.ts @@ -2,6 +2,7 @@ import { TELEMETRY_EVENT_EXIT_SOURCE, TELEMETRY_EVENT_TYPE, } from '@/constants/telemetry' + import { areInputParadataIdentical, computeContactSupportEvent, diff --git a/src/utils/tests.tsx b/src/utils/tests.tsx index 77006727..5df7bdba 100644 --- a/src/utils/tests.tsx +++ b/src/utils/tests.tsx @@ -1,7 +1,8 @@ -import { router } from '@/router/__mocks__' import { RouterProvider } from '@tanstack/react-router' import { render } from '@testing-library/react' +import { router } from '@/router/__mocks__' + export const renderWithRouter = (component: React.ReactElement) => { return render( // @ts-expect-error: we should have a better router mock diff --git a/yarn.lock b/yarn.lock index 4e2e259c..d9343709 100644 --- a/yarn.lock +++ b/yarn.lock @@ -71,6 +71,15 @@ "@babel/highlight" "^7.25.7" picocolors "^1.0.0" +"@babel/code-frame@^7.22.13": + version "7.26.2" + resolved "https://registry.yarnpkg.com/@babel/code-frame/-/code-frame-7.26.2.tgz#4b5fab97d33338eff916235055f0ebc21e573a85" + integrity sha512-RJlIHRueQgwWitWgF8OdFYGZX328Ax5BCemNGlqHfplnRT9ESi8JkFlvaVYbS+UubVY6dpv87Fs2u5M29iNFVQ== + dependencies: + "@babel/helper-validator-identifier" "^7.25.9" + js-tokens "^4.0.0" + picocolors "^1.0.0" + "@babel/compat-data@^7.24.7": version "7.24.7" resolved "https://registry.npmjs.org/@babel/compat-data/-/compat-data-7.24.7.tgz" @@ -97,6 +106,26 @@ json5 "^2.2.3" semver "^6.3.1" +"@babel/generator@7.17.7": + version "7.17.7" + resolved "https://registry.yarnpkg.com/@babel/generator/-/generator-7.17.7.tgz#8da2599beb4a86194a3b24df6c085931d9ee45ad" + integrity sha512-oLcVCTeIFadUoArDTwpluncplrYBmTCCZZgXCbgNGvOBBiSDDK3eWO4b/+eOTli5tKv1lg+a5/NAXg+nTcei1w== + dependencies: + "@babel/types" "^7.17.0" + jsesc "^2.5.1" + source-map "^0.5.0" + +"@babel/generator@^7.23.0": + version "7.26.2" + resolved "https://registry.yarnpkg.com/@babel/generator/-/generator-7.26.2.tgz#87b75813bec87916210e5e01939a4c823d6bb74f" + integrity sha512-zevQbhbau95nkoxSq3f/DC/SC+EEOUZd3DYqfSkMhY2/wfSeaHV1Ew4vk8e+x8lja31IbyuUa2uQ3JONqKbysw== + dependencies: + "@babel/parser" "^7.26.2" + "@babel/types" "^7.26.0" + "@jridgewell/gen-mapping" "^0.3.5" + "@jridgewell/trace-mapping" "^0.3.25" + jsesc "^3.0.2" + "@babel/generator@^7.24.7", "@babel/generator@^7.25.7": version "7.25.7" resolved "https://registry.npmjs.org/@babel/generator/-/generator-7.25.7.tgz" @@ -118,6 +147,28 @@ lru-cache "^5.1.1" semver "^6.3.1" +"@babel/helper-environment-visitor@^7.22.20": + version "7.24.7" + resolved "https://registry.yarnpkg.com/@babel/helper-environment-visitor/-/helper-environment-visitor-7.24.7.tgz#4b31ba9551d1f90781ba83491dd59cf9b269f7d9" + integrity sha512-DoiN84+4Gnd0ncbBOM9AZENV4a5ZiL39HYMyZJGZ/AZEykHYdJw0wW3kdcsh9/Kn+BRXHLkkklZ51ecPKmI1CQ== + dependencies: + "@babel/types" "^7.24.7" + +"@babel/helper-function-name@^7.23.0": + version "7.24.7" + resolved "https://registry.yarnpkg.com/@babel/helper-function-name/-/helper-function-name-7.24.7.tgz#75f1e1725742f39ac6584ee0b16d94513da38dd2" + integrity sha512-FyoJTsj/PEUWu1/TYRiXTIHc8lbw+TDYkZuoE43opPS5TrI7MyONBE1oNvfguEXAD9yhQRrVBnXdXzSLQl9XnA== + dependencies: + "@babel/template" "^7.24.7" + "@babel/types" "^7.24.7" + +"@babel/helper-hoist-variables@^7.22.5": + version "7.24.7" + resolved "https://registry.yarnpkg.com/@babel/helper-hoist-variables/-/helper-hoist-variables-7.24.7.tgz#b4ede1cde2fd89436397f30dc9376ee06b0f25ee" + integrity sha512-MJJwhkoGy5c4ehfoRyrJ/owKeMl19U54h27YYftT0o2teQ3FJ3nQUf/I3LlJsX4l3qlw7WRXUmiyajvHXoTubQ== + dependencies: + "@babel/types" "^7.24.7" + "@babel/helper-module-imports@^7.16.7", "@babel/helper-module-imports@^7.25.7": version "7.25.7" resolved "https://registry.npmjs.org/@babel/helper-module-imports/-/helper-module-imports-7.25.7.tgz" @@ -149,11 +200,28 @@ "@babel/traverse" "^7.25.7" "@babel/types" "^7.25.7" +"@babel/helper-split-export-declaration@^7.22.6": + version "7.24.7" + resolved "https://registry.yarnpkg.com/@babel/helper-split-export-declaration/-/helper-split-export-declaration-7.24.7.tgz#83949436890e07fa3d6873c61a96e3bbf692d856" + integrity sha512-oy5V7pD+UvfkEATUKvIjvIAH/xCzfsFVw7ygW2SI6NClZzquT+mwdTfgfdbUiceh6iQO0CHtCPsyze/MZ2YbAA== + dependencies: + "@babel/types" "^7.24.7" + "@babel/helper-string-parser@^7.25.7": version "7.25.7" resolved "https://registry.npmjs.org/@babel/helper-string-parser/-/helper-string-parser-7.25.7.tgz" integrity sha512-CbkjYdsJNHFk8uqpEkpCvRs3YRp9tY6FmFY7wLMSYuGYkrdUi7r2lc4/wqsvlHoMznX3WJ9IP8giGPq68T/Y6g== +"@babel/helper-string-parser@^7.25.9": + version "7.25.9" + resolved "https://registry.yarnpkg.com/@babel/helper-string-parser/-/helper-string-parser-7.25.9.tgz#1aabb72ee72ed35789b4bbcad3ca2862ce614e8c" + integrity sha512-4A/SCr/2KLd5jrtOMFzaKjVtAei3+2r/NChoBNoZ3EyP/+GlhoaEGoWOZUmFmoITP7zOJyHIMm+DYRd8o3PvHA== + +"@babel/helper-validator-identifier@^7.16.7", "@babel/helper-validator-identifier@^7.25.9": + version "7.25.9" + resolved "https://registry.yarnpkg.com/@babel/helper-validator-identifier/-/helper-validator-identifier-7.25.9.tgz#24b64e2c3ec7cd3b3c547729b8d16871f22cbdc7" + integrity sha512-Ed61U6XJc3CVRfkERJWDz4dJwKe7iLmmJsbOGu9wSloNSFttHV0I8g6UAgb7qnK5ly5bGLPd4oXZlxCdANBOWQ== + "@babel/helper-validator-identifier@^7.25.7": version "7.25.7" resolved "https://registry.npmjs.org/@babel/helper-validator-identifier/-/helper-validator-identifier-7.25.7.tgz" @@ -189,6 +257,13 @@ dependencies: "@babel/types" "^7.25.7" +"@babel/parser@^7.20.5", "@babel/parser@^7.23.0", "@babel/parser@^7.26.2": + version "7.26.2" + resolved "https://registry.yarnpkg.com/@babel/parser/-/parser-7.26.2.tgz#fd7b6f487cfea09889557ef5d4eeb9ff9a5abd11" + integrity sha512-DWMCZH9WA4Maitz2q21SRKHo9QXZxkDsbNZoVD62gusNtNBBqDg9i7uOhASfTfIGNzW+O+r7+jAlM8dwphcJKQ== + dependencies: + "@babel/types" "^7.26.0" + "@babel/plugin-transform-react-jsx-self@^7.24.5": version "7.24.7" resolved "https://registry.npmjs.org/@babel/plugin-transform-react-jsx-self/-/plugin-transform-react-jsx-self-7.24.7.tgz" @@ -226,6 +301,22 @@ "@babel/parser" "^7.25.7" "@babel/types" "^7.25.7" +"@babel/traverse@7.23.2": + version "7.23.2" + resolved "https://registry.yarnpkg.com/@babel/traverse/-/traverse-7.23.2.tgz#329c7a06735e144a506bdb2cad0268b7f46f4ad8" + integrity sha512-azpe59SQ48qG6nu2CzcMLbxUudtN+dOM9kDbUqGq3HXUJRlo7i8fvPoxQUzYgLZ4cMVmuZgm8vvBpNeRhd6XSw== + dependencies: + "@babel/code-frame" "^7.22.13" + "@babel/generator" "^7.23.0" + "@babel/helper-environment-visitor" "^7.22.20" + "@babel/helper-function-name" "^7.23.0" + "@babel/helper-hoist-variables" "^7.22.5" + "@babel/helper-split-export-declaration" "^7.22.6" + "@babel/parser" "^7.23.0" + "@babel/types" "^7.23.0" + debug "^4.1.0" + globals "^11.1.0" + "@babel/traverse@^7.24.7", "@babel/traverse@^7.25.7": version "7.25.7" resolved "https://registry.npmjs.org/@babel/traverse/-/traverse-7.25.7.tgz" @@ -239,6 +330,14 @@ debug "^4.3.1" globals "^11.1.0" +"@babel/types@7.17.0": + version "7.17.0" + resolved "https://registry.yarnpkg.com/@babel/types/-/types-7.17.0.tgz#a826e368bccb6b3d84acd76acad5c0d87342390b" + integrity sha512-TmKSNO4D5rzhL5bjWFcVHHLETzfQ/AmbKpKPOSjlP0WoHZ6L911fgoOKY4Alp/emzG4cHJdyN49zpgkbXFEHHw== + dependencies: + "@babel/helper-validator-identifier" "^7.16.7" + to-fast-properties "^2.0.0" + "@babel/types@^7.0.0", "@babel/types@^7.20.7", "@babel/types@^7.24.7", "@babel/types@^7.25.4", "@babel/types@^7.25.7": version "7.25.7" resolved "https://registry.npmjs.org/@babel/types/-/types-7.25.7.tgz" @@ -248,6 +347,14 @@ "@babel/helper-validator-identifier" "^7.25.7" to-fast-properties "^2.0.0" +"@babel/types@^7.17.0", "@babel/types@^7.23.0", "@babel/types@^7.26.0": + version "7.26.0" + resolved "https://registry.yarnpkg.com/@babel/types/-/types-7.26.0.tgz#deabd08d6b753bc8e0f198f8709fb575e31774ff" + integrity sha512-Z/yiTPj+lDVnF7lWeKCIJzaIkI0vYO87dMpZ4bg4TDrFe4XXLFWL1TbXU27gBP3QccxV9mZICCrnjnYlJjXHOA== + dependencies: + "@babel/helper-string-parser" "^7.25.9" + "@babel/helper-validator-identifier" "^7.25.9" + "@bcoe/v8-coverage@^0.2.3": version "0.2.3" resolved "https://registry.yarnpkg.com/@bcoe/v8-coverage/-/v8-coverage-0.2.3.tgz#75a2e8b51cb758a7553d6804a5932d7aace75c39" @@ -1579,6 +1686,18 @@ resolved "https://registry.yarnpkg.com/@testing-library/user-event/-/user-event-14.5.2.tgz#db7257d727c891905947bd1c1a99da20e03c2ebd" integrity sha512-YAh82Wh4TIrxYLmfGcixwD18oIjyC1pFQC2Y01F2lzV2HTMiYrI0nze0FD0ocB//CKS/7jIUgae+adPqxK5yCQ== +"@trivago/prettier-plugin-sort-imports@^4.3.0": + version "4.3.0" + resolved "https://registry.yarnpkg.com/@trivago/prettier-plugin-sort-imports/-/prettier-plugin-sort-imports-4.3.0.tgz#725f411646b3942193a37041c84e0b2116339789" + integrity sha512-r3n0onD3BTOVUNPhR4lhVK4/pABGpbA7bW3eumZnYdKaHkf1qEC+Mag6DPbGNuuh0eG8AaYj+YqmVHSiGslaTQ== + dependencies: + "@babel/generator" "7.17.7" + "@babel/parser" "^7.20.5" + "@babel/traverse" "7.23.2" + "@babel/types" "7.17.0" + javascript-natural-sort "0.7.1" + lodash "^4.17.21" + "@types/aria-query@^5.0.1": version "5.0.4" resolved "https://registry.yarnpkg.com/@types/aria-query/-/aria-query-5.0.4.tgz#1a31c3d378850d2778dabb6374d036dcba4ba708" @@ -3946,6 +4065,11 @@ jackspeak@^3.1.2: optionalDependencies: "@pkgjs/parseargs" "^0.11.0" +javascript-natural-sort@0.7.1: + version "0.7.1" + resolved "https://registry.yarnpkg.com/javascript-natural-sort/-/javascript-natural-sort-0.7.1.tgz#f9e2303d4507f6d74355a73664d1440fb5a0ef59" + integrity sha512-nO6jcEfZWQXDhOiBtG2KvKyEptz7RVbpGP4vTD2hLBdmNQSsCiicO2Ioinv6UI4y9ukqnBpy+XZ9H6uLNgJTlw== + "js-tokens@^3.0.0 || ^4.0.0", js-tokens@^4.0.0: version "4.0.0" resolved "https://registry.npmjs.org/js-tokens/-/js-tokens-4.0.0.tgz" @@ -3998,6 +4122,11 @@ jsep@^1.1.2, jsep@^1.2.0: resolved "https://registry.npmjs.org/jsep/-/jsep-1.3.8.tgz" integrity sha512-qofGylTGgYj9gZFsHuyWAN4jr35eJ66qJCK4eKDnldohuUoQFbU3iZn2zjvEbd9wOAhP9Wx5DsAAduTyE1PSWQ== +jsesc@^2.5.1: + version "2.5.2" + resolved "https://registry.yarnpkg.com/jsesc/-/jsesc-2.5.2.tgz#80564d2e483dacf6e8ef209650a67df3f0c283a4" + integrity sha512-OYu7XEzjkCQ3C5Ps3QIZsQfNpqoJyZZA99wd9aWd05NCtC5pWOkShK2mkL6HXQR6/Cy2lbNdPlZBpuQHXE63gA== + jsesc@^3.0.2: version "3.0.2" resolved "https://registry.npmjs.org/jsesc/-/jsesc-3.0.2.tgz" @@ -5130,11 +5259,6 @@ prelude-ls@^1.2.1: resolved "https://registry.npmjs.org/prelude-ls/-/prelude-ls-1.2.1.tgz" integrity sha512-vkcDPrRZo1QZLbn5RLGPpg/WmIQ65qoWWhcGKf/b5eplkkarX0m9z8ppCat4mlOqUsWpyNuYgO3VRyrYHSzX5g== -prettier-plugin-organize-imports@^4.0.0: - version "4.0.0" - resolved "https://registry.npmjs.org/prettier-plugin-organize-imports/-/prettier-plugin-organize-imports-4.0.0.tgz" - integrity sha512-vnKSdgv9aOlqKeEFGhf9SCBsTyzDSyScy1k7E0R1Uo4L0cTcOV7c1XQaT7jfXIOc/p08WLBfN2QUQA9zDSZMxA== - prettier@^3.3.3: version "3.3.3" resolved "https://registry.npmjs.org/prettier/-/prettier-3.3.3.tgz" @@ -5677,7 +5801,7 @@ source-map-js@^1.2.0, source-map-js@^1.2.1: resolved "https://registry.npmjs.org/source-map-js/-/source-map-js-1.2.1.tgz" integrity sha512-UXWMKhLOwVKb728IUtQPXxfYU+usdybtUrK/8uGE8CQMvrhOpwvzDBwj0QhSL7MQc7vIsISBG8VQ8+IDQxpfQA== -source-map@^0.5.7: +source-map@^0.5.0, source-map@^0.5.7: version "0.5.7" resolved "https://registry.npmjs.org/source-map/-/source-map-0.5.7.tgz" integrity sha512-LbrmJOMUSdEVxIKvdcJzQC+nQhe8FUZQTXQy6+I75skNgn3OoQ0DZA8YnFa7gp8tqtL3KPf1kmo0R5DoApeSGQ==