From 4756556bdd08fb4e4b224895871682896e03d124 Mon Sep 17 00:00:00 2001 From: Robin Monnier Date: Thu, 10 Oct 2024 17:09:07 +0200 Subject: [PATCH] chore: remove ts-ignore (#1262) --- .../[slug]/_component/sections/association/dirigeants.tsx | 3 +-- .../_component/sections/entreprise/dirigeant-content.tsx | 7 +++---- .../donnees-financieres/[slug]/_components/bilans.tsx | 1 - .../faq/parcours/_components/parcours-questions.tsx | 5 ++--- .../[slug]/_components/pdf-failed.tsx | 5 +++-- components/finances-section/societe/index.tsx | 1 - components/labels-and-certificates/rge/index.tsx | 2 +- components/map/map-etablissement.tsx | 4 +--- components/map/map-results.tsx | 1 - components/section/data-section/client.tsx | 2 +- components/table/full.tsx | 2 +- pages/erreur/administration/[slug].tsx | 6 ++---- utils/helpers/formatting/categories-entreprise.ts | 4 +--- utils/static-pages/load-all.ts | 1 - 14 files changed, 16 insertions(+), 28 deletions(-) diff --git a/app/(header-default)/dirigeants/[slug]/_component/sections/association/dirigeants.tsx b/app/(header-default)/dirigeants/[slug]/_component/sections/association/dirigeants.tsx index 8bcf7269d..c9c341680 100644 --- a/app/(header-default)/dirigeants/[slug]/_component/sections/association/dirigeants.tsx +++ b/app/(header-default)/dirigeants/[slug]/_component/sections/association/dirigeants.tsx @@ -1,6 +1,5 @@ 'use client'; -import { useMemo, useState } from 'react'; import FAQLink from '#components-ui/faq-link'; import InformationTooltip from '#components-ui/information-tooltip'; import { Tag } from '#components-ui/tag'; @@ -15,6 +14,7 @@ import { ISession } from '#models/user/session'; import { formatSiret } from '#utils/helpers'; import { extractAssociationEtablissements } from '#utils/helpers/association'; import { useAPIRouteData } from 'hooks/fetch/use-API-route-data'; +import { useMemo, useState } from 'react'; type IProps = { uniteLegale: IUniteLegale; @@ -58,7 +58,6 @@ function DirigeantsAssociationSection({ uniteLegale, session }: IProps) { id="rna-dirigeants" title="Dirigeants des associations" isProtected - // @ts-ignore notFoundInfo={} sources={[EAdministration.MI, EAdministration.DJEPVA]} data={associationProtected} diff --git a/app/(header-default)/dirigeants/[slug]/_component/sections/entreprise/dirigeant-content.tsx b/app/(header-default)/dirigeants/[slug]/_component/sections/entreprise/dirigeant-content.tsx index 14aa7d1e8..1b8cb21c4 100644 --- a/app/(header-default)/dirigeants/[slug]/_component/sections/entreprise/dirigeant-content.tsx +++ b/app/(header-default)/dirigeants/[slug]/_component/sections/entreprise/dirigeant-content.tsx @@ -37,12 +37,11 @@ export function DirigeantContent({ if (dirigeant.siren) { const defaultDenom = dirigeant.denomination || dirigeant.siren; - //@ts-ignore - infos.push([ + infos.push( → voir les dirigeants de {defaultDenom} - , - ]); + + ); } return infos; } else { diff --git a/app/(header-default)/donnees-financieres/[slug]/_components/bilans.tsx b/app/(header-default)/donnees-financieres/[slug]/_components/bilans.tsx index 3509ef043..3eeb6dac0 100644 --- a/app/(header-default)/donnees-financieres/[slug]/_components/bilans.tsx +++ b/app/(header-default)/donnees-financieres/[slug]/_components/bilans.tsx @@ -78,7 +78,6 @@ const AgentBilansSection: React.FC<{ head={[ 'Date de dépôt', 'Année fiscale', - //@ts-ignore Une entreprise peut déposer différents types de bilans :
    diff --git a/app/(header-default)/faq/parcours/_components/parcours-questions.tsx b/app/(header-default)/faq/parcours/_components/parcours-questions.tsx index 582398c37..580b28ded 100644 --- a/app/(header-default)/faq/parcours/_components/parcours-questions.tsx +++ b/app/(header-default)/faq/parcours/_components/parcours-questions.tsx @@ -1,9 +1,9 @@ 'use client'; -import { useRef, useState } from 'react'; import { MultiChoice } from '#components-ui/multi-choice'; import Question, { EQuestionType } from '#components/faq-parcours/question'; import { FAQTargets, allFaqArticlesByTarget } from '#models/article/faq'; +import { useRef, useState } from 'react'; type IProps = { question: EQuestionType; @@ -13,7 +13,7 @@ export default function ParcoursQuestions({ question }: IProps) { ? question : null; - const scrollRef = useRef(null); + const scrollRef = useRef(null); const [userType, setUserType] = useState(initialQuestionType ? 'all' : ''); const [questionType, setQuestionType] = useState( @@ -22,7 +22,6 @@ export default function ParcoursQuestions({ question }: IProps) { const scroll = () => { if (scrollRef && scrollRef.current) { - //@ts-ignore scrollRef.current.scrollIntoView({ behavior: 'smooth' }); } }; diff --git a/app/(header-default)/justificatif-immatriculation-pdf/[slug]/_components/pdf-failed.tsx b/app/(header-default)/justificatif-immatriculation-pdf/[slug]/_components/pdf-failed.tsx index 043aff443..72ccdae94 100644 --- a/app/(header-default)/justificatif-immatriculation-pdf/[slug]/_components/pdf-failed.tsx +++ b/app/(header-default)/justificatif-immatriculation-pdf/[slug]/_components/pdf-failed.tsx @@ -14,8 +14,9 @@ export function PDFFailed({ downloadLink }: { downloadLink: string }) { target="_blank" rel="noreferrer noopener" href={downloadLink} - //@ts-ignore - onClick={window.open(downloadLink, '_blank', 'noopener,noreferrer')} + onClick={() => + window.open(downloadLink, '_blank', 'noopener,noreferrer') + } > cliquez ici pour re-lancer un téléchargement dans un nouvel onglet. diff --git a/components/finances-section/societe/index.tsx b/components/finances-section/societe/index.tsx index 51e83a29a..26ada6961 100644 --- a/components/finances-section/societe/index.tsx +++ b/components/finances-section/societe/index.tsx @@ -154,7 +154,6 @@ export const FinancesSocieteSection: React.FC<{
    { diff --git a/components/map/map-etablissement.tsx b/components/map/map-etablissement.tsx index e5d7eb62a..e2798adfe 100644 --- a/components/map/map-etablissement.tsx +++ b/components/map/map-etablissement.tsx @@ -1,4 +1,3 @@ -/* eslint-disable import/order */ 'use client'; import constants from '#models/constants'; @@ -16,7 +15,7 @@ export function MapEtablissement({ etablissement: IEtablissement; }) { const mapContainer = useRef(null); - const map = useRef(null); + const map = useRef(null); const coords = checkLatLng(etablissement.latitude, etablissement.longitude); @@ -25,7 +24,6 @@ export function MapEtablissement({ const zoom = etablissement ? 12 : 4.5; - //@ts-ignore map.current = new maplibregl.Map({ //@ts-ignore container: mapContainer.current, diff --git a/components/map/map-results.tsx b/components/map/map-results.tsx index 61995f5fb..68310632b 100644 --- a/components/map/map-results.tsx +++ b/components/map/map-results.tsx @@ -1,4 +1,3 @@ -/* eslint-disable import/order */ 'use client'; import constants from '#models/constants'; diff --git a/components/section/data-section/client.tsx b/components/section/data-section/client.tsx index db0c86ec7..d410644a6 100644 --- a/components/section/data-section/client.tsx +++ b/components/section/data-section/client.tsx @@ -1,7 +1,6 @@ 'use client'; /* eslint-disable react/jsx-props-no-spreading */ -import { useEffect, useState } from 'react'; import { FadeIn } from '#components-ui/animation/fade-in'; import { HeightTransition } from '#components-ui/animation/height-transition'; import { IAPINotRespondingError, isAPI404 } from '#models/api-not-responding'; @@ -12,6 +11,7 @@ import { isUnauthorized, } from '#models/data-fetching'; import { useTimeout } from 'hooks/use-timeout'; +import { useEffect, useState } from 'react'; import { ISectionProps, Section } from '..'; import { DataSectionContent } from './content'; import DataFetchErrorExplanation from './error'; diff --git a/components/table/full.tsx b/components/table/full.tsx index 29e2b0826..4733716e6 100644 --- a/components/table/full.tsx +++ b/components/table/full.tsx @@ -2,7 +2,7 @@ import React from 'react'; import styles from './styleFull.module.css'; interface ISectionProps { - head: string[]; + head: (string | JSX.Element)[]; body: any[][]; id?: string; verticalAlign?: 'top' | 'middle' | 'bottom'; diff --git a/pages/erreur/administration/[slug].tsx b/pages/erreur/administration/[slug].tsx index 25bddcf6e..c5a0a1fbb 100644 --- a/pages/erreur/administration/[slug].tsx +++ b/pages/erreur/administration/[slug].tsx @@ -1,9 +1,9 @@ -import { GetStaticPaths, GetStaticProps } from 'next'; import { HttpNotFound } from '#clients/exceptions'; import AdministrationNotResponding from '#components/administration-not-responding'; import Meta from '#components/meta/meta-client'; import { administrationsMetaData } from '#models/administrations'; import { EAdministration } from '#models/administrations/EAdministration'; +import { GetStaticPaths, GetStaticProps } from 'next'; import { NextPageWithLayout } from 'pages/_app'; const AdministrationError: NextPageWithLayout<{ @@ -37,11 +37,9 @@ export const getStaticPaths: GetStaticPaths = async () => { }; export const getStaticProps: GetStaticProps = async ({ params }) => { - //@ts-ignore - const slug = params.slug as EAdministration; + const slug = params?.slug as EAdministration; const administrationEnum = Object.keys(administrationsMetaData).find( - //@ts-ignore (key) => administrationsMetaData[key].slug === slug ); if (administrationEnum === undefined) { diff --git a/utils/helpers/formatting/categories-entreprise.ts b/utils/helpers/formatting/categories-entreprise.ts index 729a675b5..f7c2fe1f9 100644 --- a/utils/helpers/formatting/categories-entreprise.ts +++ b/utils/helpers/formatting/categories-entreprise.ts @@ -16,7 +16,6 @@ export const categoriesEntreprisesOptions = [ ]; export const categoriesEntreprise = (code: string) => { - //@ts-ignore const categorie = categoriesEntreprisesMap[code]; if (categorie) { return categorie; @@ -26,10 +25,9 @@ export const categoriesEntreprise = (code: string) => { const formatAsMap = () => { return categoriesEntreprisesOptions.reduce((aggregator, code) => { - //@ts-ignore aggregator[code.value] = code.label; return aggregator; - }, {}); + }, {} as { [key: string]: string }); }; const categoriesEntreprisesMap = formatAsMap(); diff --git a/utils/static-pages/load-all.ts b/utils/static-pages/load-all.ts index 6ac5cde5b..536a5e226 100644 --- a/utils/static-pages/load-all.ts +++ b/utils/static-pages/load-all.ts @@ -13,7 +13,6 @@ export function loadAll( .filter((k: string) => k.indexOf('./') === 0) .forEach((key: string, index: number) => { const slug = key.replace('.yml', '').replace('./', ''); - //@ts-ignore articles.push({ ...values[index], slug }); });