From 9ac85309f22ca103b5779f3048cbee3dbd11958e Mon Sep 17 00:00:00 2001
From: Bastien DUMONT <bdumont@grandlyon.com>
Date: Mon, 11 Sep 2023 12:27:25 +0000
Subject: [PATCH] chore: linting

---
 .eslintrc.js                                  | 28 ++++++++-
 .prettierrc                                   |  3 +-
 .vscode/settings.json                         |  5 +-
 package.json                                  |  4 +-
 src/components/Consents/Consents.tsx          | 24 ++++----
 src/components/Navigation/BottomBar.tsx       |  2 +-
 src/components/Navigation/SideBar.tsx         |  2 +-
 src/components/Newsletter/CustomEditor.tsx    |  2 +-
 src/components/Newsletter/CustomLink.tsx      |  2 +-
 .../Newsletter/DateSelector/DateSelector.tsx  |  2 +-
 .../Newsletter/ImagePicker/ImagePicker.tsx    |  4 +-
 src/components/Newsletter/Newsletter.tsx      |  2 +-
 src/components/Popups/Popups.tsx              | 42 ++++++-------
 src/components/Prices/PriceRow.tsx            |  4 +-
 src/components/Prices/PriceSection.tsx        | 12 ++--
 src/components/Routes/Router.tsx              |  2 +-
 src/services/consent.service.ts               |  9 +--
 src/services/newsletter.service.ts            | 20 +++----
 tsconfig.json                                 | 13 ++--
 yarn.lock                                     | 59 +------------------
 20 files changed, 105 insertions(+), 136 deletions(-)

diff --git a/.eslintrc.js b/.eslintrc.js
index f899dd41..50402a0b 100644
--- a/.eslintrc.js
+++ b/.eslintrc.js
@@ -6,6 +6,32 @@ module.exports = {
     'prettier', // Uses eslint-config-prettier to disable ESLint rules from @typescript-eslint/eslint-plugin that would conflict with prettier
     'plugin:prettier/recommended', // Enables eslint-plugin-prettier and displays prettier errors as ESLint errors. Make sure this is always the last configuration in the extends array.
     'plugin:react-hooks/recommended',
+    'react-app',
+  ],
+  plugins: ['@typescript-eslint', 'react', 'react-hooks'],
+  overrides: [
+    {
+      extends: [
+        'plugin:@typescript-eslint/recommended',
+        'plugin:@typescript-eslint/eslint-recommended', // Uses the recommended rules from @typescript-eslint/eslint-plugin
+        // This enables a lot of type checking
+        // 'plugin:@typescript-eslint/recommended-requiring-type-checking', // Uses the recommended rules from @typescript-eslint/eslint-plugin
+      ],
+      files: ['**/*.{ts,tsx}'],
+      parserOptions: {
+        tsconfigRootDir: __dirname,
+        project: ['./tsconfig.json'],
+      },
+      rules: {
+        '@typescript-eslint/explicit-function-return-type': 'off',
+        '@typescript-eslint/no-unused-vars': 'warn',
+        '@typescript-eslint/no-explicit-any': 'warn',
+        '@typescript-eslint/prefer-optional-chain': 'warn',
+        '@typescript-eslint/prefer-as-const': 'error',
+        '@typescript-eslint/await-thenable': 'error',
+        '@typescript-eslint/no-var-requires': 'off',
+      },
+    },
   ],
   parserOptions: {
     ecmaVersion: 2020, // Allows for the parsing of modern ECMAScript features
@@ -16,9 +42,9 @@ module.exports = {
   },
   rules: {
     // Place to specify ESLint rules. Can be used to overwrite rules specified from the extended configs
-    '@typescript-eslint/explicit-function-return-type': 'off',
     'react/react-in-jsx-scope': 'off',
     'react/prop-types': 'warn',
+    'react/self-closing-comp': 'warn',
   },
   settings: {
     react: {
diff --git a/.prettierrc b/.prettierrc
index a8926a50..c97c46da 100644
--- a/.prettierrc
+++ b/.prettierrc
@@ -3,5 +3,6 @@
   "semi": false,
   "singleQuote": true,
   "tabWidth": 2,
-  "trailingComma": "es5"
+  "trailingComma": "es5",
+  "arrowParens": "avoid"
 }
diff --git a/.vscode/settings.json b/.vscode/settings.json
index 8df3d7ac..9d92bf0c 100644
--- a/.vscode/settings.json
+++ b/.vscode/settings.json
@@ -34,10 +34,11 @@
   "editor.defaultFormatter": "esbenp.prettier-vscode",
   "peacock.color": "#2aa63d",
   "sonarlint.connectedMode.project": {
-    "connectionId": "sonarqube-forge-grandlyon",
-    "projectKey": "web-et-numerique-llle-project-backoffice-client"
+    "connectionId": "Sonar",
+    "projectKey": "web-et-numerique-factory-llle-project-backoffice-client"
   },
   "cSpell.words": [
+    "backoffice",
     "draftjs",
     "ecogesture",
     "ecolyo",
diff --git a/package.json b/package.json
index 137aecf2..6c957781 100644
--- a/package.json
+++ b/package.json
@@ -8,7 +8,7 @@
     "local-up": "docker-compose -f docker-compose.local.yml up -d && yarn start",
     "local-down": "docker-compose -f docker-compose.local.yml down",
     "docker": "docker run -it --rm -p 3000:3000 front-backoffice",
-    "lint": "eslint .",
+    "lint": "eslint src -c .eslintrc.js --fix",
     "lint:fix": "eslint --fix .",
     "format": "prettier --write \"./src/**/*.{js,jsx,ts,tsx,json,md}\"",
     "test": "react-scripts test",
@@ -36,8 +36,6 @@
     "eslint": "^8.21.0",
     "eslint-config-prettier": "^8.5.0",
     "eslint-config-react-app": "^6.0.0",
-    "eslint-plugin-import": "^2.23.4",
-    "eslint-plugin-jest": "^24.4.0",
     "eslint-plugin-prettier": "^5.0.0",
     "eslint-plugin-react": "7.30.1",
     "eslint-plugin-react-hooks": "^4.2.0",
diff --git a/src/components/Consents/Consents.tsx b/src/components/Consents/Consents.tsx
index 2267a99c..d404d5c6 100644
--- a/src/components/Consents/Consents.tsx
+++ b/src/components/Consents/Consents.tsx
@@ -45,7 +45,7 @@ const Consents: React.FC = () => {
   }, [])
 
   const toggleOpenModal = useCallback(() => {
-    setOpenDowloadModal((prev) => !prev)
+    setOpenDowloadModal(prev => !prev)
   }, [])
 
   const defaultColDef = useMemo(
@@ -134,7 +134,7 @@ const Consents: React.FC = () => {
     },
     []
   )
-  const handleChangeRowsPerPage = useCallback((event: any) => {
+  const handleChangeRowsPerPage = useCallback(event => {
     setRowsPerPage(event.target.value)
     setPage(0)
   }, [])
@@ -143,10 +143,10 @@ const Consents: React.FC = () => {
     if (gridApi) {
       const newNodes = gridApi.getRenderedNodes()
       const idsToCheck: string[] = selectedNodes
-        .filter((node: RowNode) => node.isSelected)
-        .map((node: RowNode) => node.data.ID)
+        .filter(node => node.isSelected)
+        .map(node => node.data.ID)
 
-      newNodes.forEach((node: RowNode) => {
+      newNodes.forEach(node => {
         if (idsToCheck.includes(node.data.ID))
           node.setSelected(true, false, true)
       })
@@ -187,14 +187,14 @@ const Consents: React.FC = () => {
     (event: RowSelectedEvent) => {
       if (event.node.isSelected()) {
         const index = selectedNodes.findIndex(
-          (node) => node.data.ID === event.node.data.ID
+          node => node.data.ID === event.node.data.ID
         )
         if (index === -1) {
-          setSelectedNodes((prev) => [...prev, event.node])
+          setSelectedNodes(prev => [...prev, event.node])
         }
       } else {
-        setSelectedNodes((prev) =>
-          prev.filter((node) => {
+        setSelectedNodes(prev =>
+          prev.filter(node => {
             return node.data.ID != event.node.data.ID
           })
         )
@@ -279,7 +279,7 @@ const Consents: React.FC = () => {
               }
               disabled={isShowingSelection}
               autoComplete="off"
-            ></input>
+            />
           </div>
         </div>
         <div
@@ -301,9 +301,9 @@ const Consents: React.FC = () => {
             pagination={false}
             suppressCellFocus={true}
             rowClassRules={{
-              expired: (params) => params.data.endDate < DateTime.now(),
+              expired: params => params.data.endDate < DateTime.now(),
             }}
-          ></AgGridReact>
+          />
           {!isShowingSelection && (
             <TablePagination
               labelRowsPerPage="Consentements par page"
diff --git a/src/components/Navigation/BottomBar.tsx b/src/components/Navigation/BottomBar.tsx
index 0129a636..1b6e39e8 100644
--- a/src/components/Navigation/BottomBar.tsx
+++ b/src/components/Navigation/BottomBar.tsx
@@ -14,7 +14,7 @@ const BottomBar: React.FC = () => {
       <div className="menu-list">
         {user &&
           routes.map(
-            (route) =>
+            route =>
               (!route.adminOnly || user?.isAdmin) && (
                 <NavLink
                   key={route.label}
diff --git a/src/components/Navigation/SideBar.tsx b/src/components/Navigation/SideBar.tsx
index 301ac19b..83b29903 100644
--- a/src/components/Navigation/SideBar.tsx
+++ b/src/components/Navigation/SideBar.tsx
@@ -18,7 +18,7 @@ const SideBar: React.FC = () => {
       <div className="menu-list">
         {user &&
           routes.map(
-            (route) =>
+            route =>
               (!route.adminOnly || user.isAdmin) && (
                 <NavLink
                   key={route.label}
diff --git a/src/components/Newsletter/CustomEditor.tsx b/src/components/Newsletter/CustomEditor.tsx
index b9867c75..9131bf35 100644
--- a/src/components/Newsletter/CustomEditor.tsx
+++ b/src/components/Newsletter/CustomEditor.tsx
@@ -60,7 +60,7 @@ const CustomEditor: React.FC<CustomEditorProps> = ({
   return (
     <Editor
       editorState={editorState}
-      onEditorStateChange={(state) => handleStateChange(state)}
+      onEditorStateChange={state => handleStateChange(state)}
       handlePastedText={() => false}
       wrapperClassName="wrapper-class"
       editorClassName="editor-class"
diff --git a/src/components/Newsletter/CustomLink.tsx b/src/components/Newsletter/CustomLink.tsx
index fc69ff89..847c8da1 100644
--- a/src/components/Newsletter/CustomLink.tsx
+++ b/src/components/Newsletter/CustomLink.tsx
@@ -77,7 +77,7 @@ const CustomLink: React.FC<EcolyoLinkProps> = ({ onChange, editorState }) => {
                 : 'rdw-dropdown-optionwrapper placeholder-ul'
             }
           >
-            {links.map((item: LinkState) => {
+            {links.map(item => {
               return (
                 <li
                   className="rdw-dropdownoption-default placeholder-li"
diff --git a/src/components/Newsletter/DateSelector/DateSelector.tsx b/src/components/Newsletter/DateSelector/DateSelector.tsx
index e811fc65..ec374157 100644
--- a/src/components/Newsletter/DateSelector/DateSelector.tsx
+++ b/src/components/Newsletter/DateSelector/DateSelector.tsx
@@ -17,7 +17,7 @@ const DateSelector: React.FC<DateSelectorProps> = ({
 }) => {
   const [openModal, setOpenModal] = useState<boolean>(false)
   const [isPrev, setIsPrev] = useState<boolean>(false)
-  const toggleOpenModal = () => setOpenModal((prev) => !prev)
+  const toggleOpenModal = () => setOpenModal(prev => !prev)
 
   const handleNextMonth = () => {
     setIsPrev(false)
diff --git a/src/components/Newsletter/ImagePicker/ImagePicker.tsx b/src/components/Newsletter/ImagePicker/ImagePicker.tsx
index 33a85e80..fa6da8c6 100644
--- a/src/components/Newsletter/ImagePicker/ImagePicker.tsx
+++ b/src/components/Newsletter/ImagePicker/ImagePicker.tsx
@@ -28,7 +28,7 @@ const ImagePicker: React.FC<ImagePickerProps> = ({
   const imagePerPage = 10
 
   const toggleModal = () => {
-    setOpenModal((prev) => !prev)
+    setOpenModal(prev => !prev)
   }
   const handleChangePage = (page: number) => {
     setCurrentPage(page)
@@ -95,7 +95,7 @@ const ImagePicker: React.FC<ImagePickerProps> = ({
               {imageNames &&
                 imageNames.length !== 0 &&
                 imageNames[currentPage - 1].length !== 0 &&
-                imageNames[currentPage - 1].map((imageName) => (
+                imageNames[currentPage - 1].map(imageName => (
                   <SingleImage
                     imageURL={imageName}
                     key={imageName}
diff --git a/src/components/Newsletter/Newsletter.tsx b/src/components/Newsletter/Newsletter.tsx
index 410ca999..2aa75148 100644
--- a/src/components/Newsletter/Newsletter.tsx
+++ b/src/components/Newsletter/Newsletter.tsx
@@ -298,7 +298,7 @@ const Newsletter: React.FC = () => {
             subject={subject}
             handleChange={handleEditorChange}
             onDelete={handleOpenDeleteModal}
-          ></MailSubject>
+          />
           <hr />
           <MonthlyInfo
             info={info}
diff --git a/src/components/Popups/Popups.tsx b/src/components/Popups/Popups.tsx
index c921d3fc..2484a515 100644
--- a/src/components/Popups/Popups.tsx
+++ b/src/components/Popups/Popups.tsx
@@ -70,25 +70,25 @@ const Popups: React.FC = () => {
   const handleCheckboxChange = (value: boolean, type: CheckboxType): void => {
     switch (type) {
       case CheckboxType.GRDF:
-        setPartnersInfo((prevPartnersInfo) => ({
+        setPartnersInfo(prevPartnersInfo => ({
           ...prevPartnersInfo,
           grdf_failure: value,
         }))
         break
       case CheckboxType.ENEDIS:
-        setPartnersInfo((prevPartnersInfo) => ({
+        setPartnersInfo(prevPartnersInfo => ({
           ...prevPartnersInfo,
           enedis_failure: value,
         }))
         break
       case CheckboxType.EGL:
-        setPartnersInfo((prevPartnersInfo) => ({
+        setPartnersInfo(prevPartnersInfo => ({
           ...prevPartnersInfo,
           egl_failure: value,
         }))
         break
       case CheckboxType.CUSTOM:
-        setCustomPopup((prev) => ({
+        setCustomPopup(prev => ({
           ...prev,
           popupEnabled: value,
         }))
@@ -99,7 +99,7 @@ const Popups: React.FC = () => {
   }
 
   const handlePopupChange = (field: 'title' | 'description', value: string) => {
-    setCustomPopup((prev) => ({
+    setCustomPopup(prev => ({
       ...prev,
       [field]: value,
     }))
@@ -176,7 +176,7 @@ const Popups: React.FC = () => {
   }
 
   const handleSelectChange = (event: React.ChangeEvent<HTMLSelectElement>) => {
-    setPopupDuration((prev) => ({
+    setPopupDuration(prev => ({
       ...prev,
       type: event.target.value as durationType,
     }))
@@ -197,7 +197,7 @@ const Popups: React.FC = () => {
         years: 1,
       })
     }
-    setCustomPopup((prev) => ({
+    setCustomPopup(prev => ({
       ...prev,
       endDate: newDate.toISO(),
     }))
@@ -246,14 +246,14 @@ const Popups: React.FC = () => {
                     id="switch_enedis"
                     disabled={customPopup.popupEnabled}
                     checked={partnersInfo.enedis_failure}
-                    onChange={(event) => {
+                    onChange={event => {
                       handleCheckboxChange(
                         event.currentTarget.checked,
                         CheckboxType.ENEDIS
                       )
                     }}
                   />
-                  <label htmlFor="switch_enedis"></label>
+                  <label htmlFor="switch_enedis" />
                 </div>
                 <div className="switch_div">
                   <span>Panne EGL</span>
@@ -262,14 +262,14 @@ const Popups: React.FC = () => {
                     id="switch_egl"
                     disabled={customPopup.popupEnabled}
                     checked={partnersInfo.egl_failure}
-                    onChange={(event) => {
+                    onChange={event => {
                       handleCheckboxChange(
                         event.currentTarget.checked,
                         CheckboxType.EGL
                       )
                     }}
                   />
-                  <label htmlFor="switch_egl"></label>
+                  <label htmlFor="switch_egl" />
                 </div>
                 <div className="switch_div">
                   <span>Panne GRDF</span>
@@ -278,14 +278,14 @@ const Popups: React.FC = () => {
                     id="switch_grdf"
                     disabled={customPopup.popupEnabled}
                     checked={partnersInfo.grdf_failure}
-                    onChange={(event) => {
+                    onChange={event => {
                       handleCheckboxChange(
                         event.currentTarget.checked,
                         CheckboxType.GRDF
                       )
                     }}
                   />
-                  <label htmlFor="switch_grdf"></label>
+                  <label htmlFor="switch_grdf" />
                 </div>
               </div>
             </div>
@@ -301,14 +301,14 @@ const Popups: React.FC = () => {
                       id="switch_popup"
                       disabled={isPartnerNotificationOn()}
                       checked={customPopup.popupEnabled}
-                      onChange={(event) => {
+                      onChange={event => {
                         handleCheckboxChange(
                           event.currentTarget.checked,
                           CheckboxType.CUSTOM
                         )
                       }}
                     />
-                    <label htmlFor="switch_popup"></label>
+                    <label htmlFor="switch_popup" />
                   </div>
 
                   {customPopup.popupEnabled &&
@@ -325,7 +325,7 @@ const Popups: React.FC = () => {
                     min={1}
                     placeholder="Titre"
                     value={customPopup.title}
-                    onChange={(event) =>
+                    onChange={event =>
                       handlePopupChange('title', event.target.value)
                     }
                   />
@@ -336,7 +336,7 @@ const Popups: React.FC = () => {
                     baseState={convertStringToEditorState(
                       customPopup.description
                     )}
-                    handleChange={(value) =>
+                    handleChange={value =>
                       handlePopupChange('description', value)
                     }
                     type="custom_popup"
@@ -348,9 +348,9 @@ const Popups: React.FC = () => {
                   <div className="durationInput">
                     <select
                       value={popupDuration.type}
-                      onChange={(event) => handleSelectChange(event)}
+                      onChange={event => handleSelectChange(event)}
                     >
-                      {OPTIONS.map((option) => (
+                      {OPTIONS.map(option => (
                         <option
                           key={option.value}
                           value={option.value}
@@ -365,8 +365,8 @@ const Popups: React.FC = () => {
                         type="number"
                         min="0"
                         value={popupDuration.duration}
-                        onChange={(e) =>
-                          setPopupDuration((prev) => ({
+                        onChange={e =>
+                          setPopupDuration(prev => ({
                             ...prev,
                             duration: Number(e.target.value),
                           }))
diff --git a/src/components/Prices/PriceRow.tsx b/src/components/Prices/PriceRow.tsx
index b2df90bf..09b28b35 100644
--- a/src/components/Prices/PriceRow.tsx
+++ b/src/components/Prices/PriceRow.tsx
@@ -21,7 +21,7 @@ const PriceRow: React.FC<PriceSectionProps> = ({
   index,
   isNextPrice,
 }) => {
-  const editableLimit: number = 3
+  const editableLimit = 3
 
   return (
     <>
@@ -47,7 +47,7 @@ const PriceRow: React.FC<PriceSectionProps> = ({
           />
         )}
       </li>
-      <hr></hr>
+      <hr />
     </>
   )
 }
diff --git a/src/components/Prices/PriceSection.tsx b/src/components/Prices/PriceSection.tsx
index 317d938a..9b67c826 100644
--- a/src/components/Prices/PriceSection.tsx
+++ b/src/components/Prices/PriceSection.tsx
@@ -36,13 +36,13 @@ const PriceSection: React.FC<PriceSectionProps> = ({ fluid, frequency }) => {
     endDate: null,
   })
   const { user }: Partial<UserContextProps> = useContext(UserContext)
-  const maxPerList: number = 8
+  const maxPerList = 8
 
   const handlePriceSelection = useCallback((val: string) => {
     if (val === '') val = '0'
     val = val.replace(/,/g, '.')
     val = val.replace(/([^0-9.]+)/, '')
-    setPriceToSave((prev) => {
+    setPriceToSave(prev => {
       return { ...prev, price: val }
     })
   }, [])
@@ -68,7 +68,7 @@ const PriceSection: React.FC<PriceSectionProps> = ({ fluid, frequency }) => {
   }, [priceToSave, user])
 
   const toggleHistory = useCallback(() => {
-    setShowHistory((prev) => !prev)
+    setShowHistory(prev => !prev)
   }, [])
 
   const getDate = useCallback((isoString: string): string => {
@@ -79,7 +79,7 @@ const PriceSection: React.FC<PriceSectionProps> = ({ fluid, frequency }) => {
   }, [])
 
   const toggleFullList = useCallback(() => {
-    setShowFullList((prev) => !prev)
+    setShowFullList(prev => !prev)
   }, [])
 
   useEffect(() => {
@@ -120,7 +120,7 @@ const PriceSection: React.FC<PriceSectionProps> = ({ fluid, frequency }) => {
     }
   }, [refreshData, frequency, fluid])
 
-  if (isLoading) return <Loader></Loader>
+  if (isLoading) return <Loader />
   if (!prices.length) return <section> Aucun prix trouvé</section>
   return (
     <section>
@@ -136,7 +136,7 @@ const PriceSection: React.FC<PriceSectionProps> = ({ fluid, frequency }) => {
           className="input-dark price-select"
           type="text"
           value={priceToSave.price.toString()}
-          onChange={(e) => handlePriceSelection(e.target.value)}
+          onChange={e => handlePriceSelection(e.target.value)}
           placeholder={priceToSave.price === '' ? 'Saisir le nouveau prix' : ''}
         />
         <span className="euro">€</span>
diff --git a/src/components/Routes/Router.tsx b/src/components/Routes/Router.tsx
index a1fe6c0d..e9f18d36 100644
--- a/src/components/Routes/Router.tsx
+++ b/src/components/Routes/Router.tsx
@@ -29,7 +29,7 @@ export const links: {
   },
 }
 
-export const routes = Object.keys(links).map((key) => ({
+export const routes = Object.keys(links).map(key => ({
   label: links[key].label,
   path: links[key].path,
   adminOnly: links[key].adminOnly,
diff --git a/src/services/consent.service.ts b/src/services/consent.service.ts
index 8f41655a..185b1230 100644
--- a/src/services/consent.service.ts
+++ b/src/services/consent.service.ts
@@ -1,11 +1,12 @@
 import axios, { AxiosRequestConfig } from 'axios'
 import { DateTime } from 'luxon'
 import { toast } from 'react-toastify'
-import { ConsentEntity, IConsent } from '../models/consent.model'
 import {
+  ConsentEntity,
   ConsentPaginationEntity,
+  IConsent,
   IConsentPagination,
-} from './../models/consent.model'
+} from '../models/consent.model'
 
 export class ConsentService {
   /**
@@ -28,7 +29,7 @@ export class ConsentService {
       )
       const consentPagination = data as ConsentPaginationEntity
       return this.parseConsentPagination(consentPagination)
-    } catch (e: any) {
+    } catch (e) {
       if (e.response.status === 403) {
         toast.error("Accès refusé : vous n'avez pas les droits nécessaires")
       } else {
@@ -72,7 +73,7 @@ export class ConsentService {
   public parseConsentPagination = (
     consentPaginationEntity: ConsentPaginationEntity
   ): IConsentPagination => {
-    const rows = consentPaginationEntity.rows.map((consent) =>
+    const rows = consentPaginationEntity.rows.map(consent =>
       this.parseConsent(consent)
     )
 
diff --git a/src/services/newsletter.service.ts b/src/services/newsletter.service.ts
index 2a2791ec..525ca876 100644
--- a/src/services/newsletter.service.ts
+++ b/src/services/newsletter.service.ts
@@ -27,7 +27,7 @@ export class NewsletterService {
         axiosHeaders
       )
       toast.success('Objet de la newsletter enregistré !')
-    } catch (e: any) {
+    } catch (e) {
       if (e.response.status === 403) {
         toast.error("Accès refusé : vous n'avez pas les droits nécessaires")
       } else {
@@ -56,7 +56,7 @@ export class NewsletterService {
         axiosHeaders
       )
       return data as IMailSubject
-    } catch (e: any) {
+    } catch (e) {
       console.error('error', e)
       return null
     }
@@ -79,7 +79,7 @@ export class NewsletterService {
         axiosHeaders
       )
       toast.success('Objet de la newsletter supprimé !')
-    } catch (e: any) {
+    } catch (e) {
       if (e.response.status === 403) {
         toast.error("Accès refusé : vous n'avez pas les droits nécessaires")
       } else {
@@ -112,7 +112,7 @@ export class NewsletterService {
         axiosHeaders
       )
       toast.success('Information du mois enregistrée !')
-    } catch (e: any) {
+    } catch (e) {
       if (e.response.status === 403) {
         toast.error("Accès refusé : vous n'avez pas les droits nécessaires")
       } else {
@@ -139,7 +139,7 @@ export class NewsletterService {
         axiosHeaders
       )
       return data as IMonthlyInfo
-    } catch (e: any) {
+    } catch (e) {
       console.error('error', e)
       return null
     }
@@ -162,7 +162,7 @@ export class NewsletterService {
         axiosHeaders
       )
       toast.success('Informations du mois supprimées !')
-    } catch (e: any) {
+    } catch (e) {
       if (e.response.status === 403) {
         toast.error("Accès refusé : vous n'avez pas les droits nécessaires")
       } else {
@@ -196,7 +196,7 @@ export class NewsletterService {
         axiosHeaders
       )
       toast.success('Nouveautés du mois enregistrés !')
-    } catch (e: any) {
+    } catch (e) {
       if (e.response.status === 403) {
         toast.error("Accès refusé : vous n'avez pas les droits nécessaires")
       } else {
@@ -246,7 +246,7 @@ export class NewsletterService {
         axiosHeaders
       )
       toast.success('Nouveautés du mois supprimées !')
-    } catch (e: any) {
+    } catch (e) {
       if (e.response.status === 403) {
         toast.error("Accès refusé : vous n'avez pas les droits nécessaires")
       } else {
@@ -280,7 +280,7 @@ export class NewsletterService {
         axiosHeaders
       )
       toast.success('Sondage enregistré !')
-    } catch (e: any) {
+    } catch (e) {
       if (e.response.status === 403) {
         toast.error("Accès refusé : vous n'avez pas les droits nécessaires")
       } else {
@@ -326,7 +326,7 @@ export class NewsletterService {
         axiosHeaders
       )
       toast.success('Sondage supprimé !')
-    } catch (e: any) {
+    } catch (e) {
       if (e.response.status === 403) {
         toast.error("Accès refusé : vous n'avez pas les droits nécessaires")
       } else {
diff --git a/tsconfig.json b/tsconfig.json
index a273b0cf..5fe15b34 100644
--- a/tsconfig.json
+++ b/tsconfig.json
@@ -1,11 +1,7 @@
 {
   "compilerOptions": {
     "target": "es5",
-    "lib": [
-      "dom",
-      "dom.iterable",
-      "esnext"
-    ],
+    "lib": ["dom", "dom.iterable", "esnext"],
     "allowJs": true,
     "skipLibCheck": true,
     "esModuleInterop": true,
@@ -18,9 +14,8 @@
     "resolveJsonModule": true,
     "isolatedModules": true,
     "noEmit": true,
-    "jsx": "react-jsx"
+    "jsx": "react-jsx",
+    "useUnknownInCatchVariables": false
   },
-  "include": [
-    "src"
-  ]
+  "include": ["src"]
 }
diff --git a/yarn.lock b/yarn.lock
index a9ae97aa..d2127010 100644
--- a/yarn.lock
+++ b/yarn.lock
@@ -2363,18 +2363,6 @@
     semver "^7.3.7"
     tsutils "^3.21.0"
 
-"@typescript-eslint/experimental-utils@^4.0.1":
-  version "4.33.0"
-  resolved "https://registry.yarnpkg.com/@typescript-eslint/experimental-utils/-/experimental-utils-4.33.0.tgz#6f2a786a4209fa2222989e9380b5331b2810f7fd"
-  integrity sha512-zeQjOoES5JFjTnAhI5QY7ZviczMzDptls15GFsI6jyUOq0kOf9+WonkhtlIhh0RgHRnqj5gdNxW5j1EvAyYg6Q==
-  dependencies:
-    "@types/json-schema" "^7.0.7"
-    "@typescript-eslint/scope-manager" "4.33.0"
-    "@typescript-eslint/types" "4.33.0"
-    "@typescript-eslint/typescript-estree" "4.33.0"
-    eslint-scope "^5.1.1"
-    eslint-utils "^3.0.0"
-
 "@typescript-eslint/experimental-utils@^5.0.0":
   version "5.32.0"
   resolved "https://registry.yarnpkg.com/@typescript-eslint/experimental-utils/-/experimental-utils-5.32.0.tgz#e3e664e7e00be2a3fb1a53c49b51b66c20fdd906"
@@ -2402,14 +2390,6 @@
     "@typescript-eslint/typescript-estree" "5.32.0"
     debug "^4.3.4"
 
-"@typescript-eslint/scope-manager@4.33.0":
-  version "4.33.0"
-  resolved "https://registry.yarnpkg.com/@typescript-eslint/scope-manager/-/scope-manager-4.33.0.tgz#d38e49280d983e8772e29121cf8c6e9221f280a3"
-  integrity sha512-5IfJHpgTsTZuONKbODctL4kKuQje/bzBRkwHE8UOZ4f89Zeddg+EGZs8PD8NcN4LdM3ygHWYB3ukPAYjvl/qbQ==
-  dependencies:
-    "@typescript-eslint/types" "4.33.0"
-    "@typescript-eslint/visitor-keys" "4.33.0"
-
 "@typescript-eslint/scope-manager@5.32.0":
   version "5.32.0"
   resolved "https://registry.yarnpkg.com/@typescript-eslint/scope-manager/-/scope-manager-5.32.0.tgz#763386e963a8def470580cc36cf9228864190b95"
@@ -2435,11 +2415,6 @@
     debug "^4.3.4"
     tsutils "^3.21.0"
 
-"@typescript-eslint/types@4.33.0":
-  version "4.33.0"
-  resolved "https://registry.yarnpkg.com/@typescript-eslint/types/-/types-4.33.0.tgz#a1e59036a3b53ae8430ceebf2a919dc7f9af6d72"
-  integrity sha512-zKp7CjQzLQImXEpLt2BUw1tvOMPfNoTAfb8l51evhYbOEEzdWyQNmHWWGPR6hwKJDAi+1VXSBmnhL9kyVTTOuQ==
-
 "@typescript-eslint/types@5.32.0":
   version "5.32.0"
   resolved "https://registry.yarnpkg.com/@typescript-eslint/types/-/types-5.32.0.tgz#484273021eeeae87ddb288f39586ef5efeb6dcd8"
@@ -2450,19 +2425,6 @@
   resolved "https://registry.yarnpkg.com/@typescript-eslint/types/-/types-5.33.0.tgz#d41c584831805554b063791338b0220b613a275b"
   integrity sha512-nIMt96JngB4MYFYXpZ/3ZNU4GWPNdBbcB5w2rDOCpXOVUkhtNlG2mmm8uXhubhidRZdwMaMBap7Uk8SZMU/ppw==
 
-"@typescript-eslint/typescript-estree@4.33.0":
-  version "4.33.0"
-  resolved "https://registry.yarnpkg.com/@typescript-eslint/typescript-estree/-/typescript-estree-4.33.0.tgz#0dfb51c2908f68c5c08d82aefeaf166a17c24609"
-  integrity sha512-rkWRY1MPFzjwnEVHsxGemDzqqddw2QbTJlICPD9p9I9LfsO8fdmfQPOX3uKfUaGRDFJbfrtm/sXhVXN4E+bzCA==
-  dependencies:
-    "@typescript-eslint/types" "4.33.0"
-    "@typescript-eslint/visitor-keys" "4.33.0"
-    debug "^4.3.1"
-    globby "^11.0.3"
-    is-glob "^4.0.1"
-    semver "^7.3.5"
-    tsutils "^3.21.0"
-
 "@typescript-eslint/typescript-estree@5.32.0":
   version "5.32.0"
   resolved "https://registry.yarnpkg.com/@typescript-eslint/typescript-estree/-/typescript-estree-5.32.0.tgz#282943f34babf07a4afa7b0ff347a8e7b6030d12"
@@ -2501,14 +2463,6 @@
     eslint-scope "^5.1.1"
     eslint-utils "^3.0.0"
 
-"@typescript-eslint/visitor-keys@4.33.0":
-  version "4.33.0"
-  resolved "https://registry.yarnpkg.com/@typescript-eslint/visitor-keys/-/visitor-keys-4.33.0.tgz#2a22f77a41604289b7a186586e9ec48ca92ef1dd"
-  integrity sha512-uqi/2aSz9g2ftcHWf8uLPJA70rUv6yuMW5Bohw+bwcuzaxQIHaKFZCKGoGXIrc9vkTJ3+0txM73K0Hq3d5wgIg==
-  dependencies:
-    "@typescript-eslint/types" "4.33.0"
-    eslint-visitor-keys "^2.0.0"
-
 "@typescript-eslint/visitor-keys@5.32.0":
   version "5.32.0"
   resolved "https://registry.yarnpkg.com/@typescript-eslint/visitor-keys/-/visitor-keys-5.32.0.tgz#b9715d0b11fdb5dd10fd0c42ff13987470525394"
@@ -3929,7 +3883,7 @@ debug@2.6.9, debug@^2.6.0, debug@^2.6.9:
   dependencies:
     ms "2.0.0"
 
-debug@4, debug@^4.1.0, debug@^4.1.1, debug@^4.3.1, debug@^4.3.2, debug@^4.3.4:
+debug@4, debug@^4.1.0, debug@^4.1.1, debug@^4.3.2, debug@^4.3.4:
   version "4.3.4"
   resolved "https://registry.yarnpkg.com/debug/-/debug-4.3.4.tgz#1319f6579357f2338d3337d2cdd4914bb5dcc865"
   integrity sha512-PRWFHuSU3eDtQJPvnNY7Jcket1j0t5OuOsFzPPzsekD52Zl8qUfFIPEiswXqIvHWGVHOgX+7G/vCNNhehwxfkQ==
@@ -4460,7 +4414,7 @@ eslint-plugin-flowtype@^8.0.3:
     lodash "^4.17.21"
     string-natural-compare "^3.0.1"
 
-eslint-plugin-import@^2.23.4, eslint-plugin-import@^2.25.3:
+eslint-plugin-import@^2.25.3:
   version "2.26.0"
   resolved "https://registry.yarnpkg.com/eslint-plugin-import/-/eslint-plugin-import-2.26.0.tgz#f812dc47be4f2b72b478a021605a59fc6fe8b88b"
   integrity sha512-hYfi3FXaM8WPLf4S1cikh/r4IxnO6zrhZbEGz2b660EJRbuxgpDS5gkCuYgGWg2xxh2rBuIr4Pvhve/7c31koA==
@@ -4479,13 +4433,6 @@ eslint-plugin-import@^2.23.4, eslint-plugin-import@^2.25.3:
     resolve "^1.22.0"
     tsconfig-paths "^3.14.1"
 
-eslint-plugin-jest@^24.4.0:
-  version "24.7.0"
-  resolved "https://registry.yarnpkg.com/eslint-plugin-jest/-/eslint-plugin-jest-24.7.0.tgz#206ac0833841e59e375170b15f8d0955219c4889"
-  integrity sha512-wUxdF2bAZiYSKBclsUMrYHH6WxiBreNjyDxbRv345TIvPeoCEgPNEn3Sa+ZrSqsf1Dl9SqqSREXMHExlMMu1DA==
-  dependencies:
-    "@typescript-eslint/experimental-utils" "^4.0.1"
-
 eslint-plugin-jest@^25.3.0:
   version "25.7.0"
   resolved "https://registry.yarnpkg.com/eslint-plugin-jest/-/eslint-plugin-jest-25.7.0.tgz#ff4ac97520b53a96187bad9c9814e7d00de09a6a"
@@ -5175,7 +5122,7 @@ globals@^13.15.0:
   dependencies:
     type-fest "^0.20.2"
 
-globby@^11.0.3, globby@^11.0.4, globby@^11.1.0:
+globby@^11.0.4, globby@^11.1.0:
   version "11.1.0"
   resolved "https://registry.yarnpkg.com/globby/-/globby-11.1.0.tgz#bd4be98bb042f83d796f7e3811991fbe82a0d34b"
   integrity sha512-jhIXaOzy1sb8IyocaruWSn1TjmnBVs8Ayhcy83rmxNJ8q2uWKCAj3CnJY+KpGSXCueAPc0i05kVvVKtP1t9S3g==
-- 
GitLab