diff --git a/site/cypress/integration/mon-entreprise/demande-mobilité.ts b/site/cypress/integration/mon-entreprise/demande-mobilité.ts index 6322c0756..b846f27a1 100644 --- a/site/cypress/integration/mon-entreprise/demande-mobilité.ts +++ b/site/cypress/integration/mon-entreprise/demande-mobilité.ts @@ -57,82 +57,57 @@ describe( .click() // "coordonnées" section - cy.contains('Nom') - .parent() - .click() - .focused() - .type('Deaux') - .tab() - .type('Jean Bernard') - .tab() - .type('1 91 07 468 054 75') - .tab() - .type('Française') - .tab() - .type('25/07/1991') + cy.contains('Nom').parent().click() + cy.focused().type('Deaux') + cy.tab().type('Jean Bernard') + cy.tab().type('1 91 07 468 054 75') + cy.tab().type('Française') + cy.tab().type('25/07/1991') - cy.contains('Non') - .click() - .focused() - .tab() - .type('Pouts') - .wait('@communes') - .focused() - cy.contains('65100').type('{enter}').focused().tab().type('{downarrow}') + cy.contains('Non').click() + cy.focused().tab().type('Pouts') + cy.wait('@communes') + cy.focused().contains('65100').type('{enter}') + cy.focused().tab().type('{downarrow}') cy.focused().tab().type('Brest') cy.wait('@communes') - cy.contains('29200') - .type('{enter}') - .focused() - .tab() - .type('3 rue de la Rhumerie') - .tab() + cy.contains('29200').type('{enter}') + cy.focused().tab().type('3 rue de la Rhumerie') + cy.tab() - cy.focused() - .type('614540144500') - .tab() - .type('Deaux & Cie') - .tab() - .type('14 chemin des Docks') - .tab() - .type('Bre') - cy.contains('29200') - .click() - .focused() - .tab() - .type('Deaux') - .tab() - .type('Alphonse') - .tab() - .type('alphonse.deaux@gamil.com') - .tab() - .type('06 85 69 78 54') + cy.focused().type('614540144500') + cy.tab().type('Deaux & Cie') + cy.tab().type('14 chemin des Docks') + cy.tab().type('Bre') + cy.contains('29200').click() + cy.focused().tab().type('Deaux') + cy.tab().type('Alphonse') + cy.tab().type('alphonse.deaux@gamil.com') + cy.tab().type('06 85 69 78 54') // "activité en France" section cy.contains('Pour une période déterminée et dans un seul pays').click() cy.contains('Date de début').click({ force: true }) - cy.focused().type('06/11/2020').tab().tab().type('09/04/2021').tab().tab() + cy.focused().type('06/11/2020') + cy.tab() + cy.tab().type('09/04/2021') + cy.tab() + cy.tab() cy.focused().type('Argen{enter}') cy.contains('Agent contractuel').click() - cy.contains("Nom de l'entreprise") - .parent() - .click() - .focused() - .type('Haldithet Docks') - .tab() - .type('64E45 12-654') - .tab() - .type('Handstath street, 9th') - .tab() - .type('654004') - .tab() - .type('Egrageoiria') + cy.contains("Nom de l'entreprise").parent().click() + cy.focused().type('Haldithet Docks') + cy.tab().type('64E45 12-654') + cy.tab().type('Handstath street, 9th') + cy.tab().type('654004') + cy.tab().type('Egrageoiria') - cy.focused().tab().type('you@ajido.com').tab().type('+94655487015') + cy.focused().tab().type('you@ajido.com') + cy.tab().type('+94655487015') cy.contains("Dans le pays d'accueil").click() @@ -145,7 +120,9 @@ describe( cy.focused().tab().type('{downarrow}') cy.focused().tab() - cy.focused().type('Docker').tab().type('Docker').tab() + cy.focused().type('Docker') + cy.tab().type('Docker') + cy.tab() cy.focused().type('{downarrow}{enter}') cy.contains("Le salarié sera-t'il accompagné d'ayants droits") @@ -155,15 +132,11 @@ describe( .click() cy.contains("Combien d'ayants droits partiront").parent().next().type('1') cy.contains('Ayant droit n°1') - cy.focused() - .tab() - .type('Deladj') - .tab() - .type('Sophie') - .tab() - .type('21/04/1978') - .tab() - .tab() + cy.focused().tab().type('Deladj') + cy.tab().type('Sophie') + cy.tab().type('21/04/1978') + cy.tab() + cy.tab() cy.focused().type('{downarrow}{enter}') cy.contains("Souhaitez-vous partager d'autres informations") diff --git a/site/cypress/integration/mon-entreprise/english/navigation.ts b/site/cypress/integration/mon-entreprise/english/navigation.ts index 054bf8878..56f1a39bd 100644 --- a/site/cypress/integration/mon-entreprise/english/navigation.ts +++ b/site/cypress/integration/mon-entreprise/english/navigation.ts @@ -72,10 +72,8 @@ describe(`Navigation to income simulator using company name (${ fr ? 'Rechercher votre entreprise ' : 'Find your company ' ).click() - cy.get('input[data-test-id="company-search-input"]') - .first() - .type('menoz') - .wait('@search') + cy.get('input[data-test-id="company-search-input"]').first().type('menoz') + cy.wait('@search') cy.contains('834364291') .should('be.visible') @@ -99,9 +97,8 @@ describe(`Navigation to income simulator using company name (${ fr ? 'Rechercher votre entreprise ' : 'Find your company ' ).click() - cy.get('input[data-test-id="company-search-input"]') - .type('jeremy rialland') - .wait('@search') + cy.get('input[data-test-id="company-search-input"]').type('jeremy rialland') + cy.wait('@search') cy.contains('850556812') .should('be.visible') diff --git a/site/cypress/integration/mon-entreprise/landing.ts b/site/cypress/integration/mon-entreprise/landing.ts index 12b44cea8..534a63d5a 100644 --- a/site/cypress/integration/mon-entreprise/landing.ts +++ b/site/cypress/integration/mon-entreprise/landing.ts @@ -41,7 +41,8 @@ describe('Landing page', function () { cy.get(searchInputPath).should('have.attr', 'placeholder') cy.get(searchInputPath).invoke('attr', 'type').should('equal', 'search') - cy.get(searchInputPath).focus().type('noima') + cy.get(searchInputPath).focus() + cy.type('noima') cy.intercept( { diff --git a/site/cypress/integration/mon-entreprise/localisation-field.js b/site/cypress/integration/mon-entreprise/localisation-field.js index 2471e26d7..1c5c93548 100644 --- a/site/cypress/integration/mon-entreprise/localisation-field.js +++ b/site/cypress/integration/mon-entreprise/localisation-field.js @@ -9,10 +9,8 @@ describe('Champs localisation (simulateur salarié)', function () { cy.visit(encodeURI('/simulateurs/salaire-brut-net')) cy.contains('SMIC').click() cy.contains('button', 'Commune').click() - cy.contains('Commune ou code postal') - .click({ force: true }) - .focused() - .type('Steenvoorde') + cy.contains('Commune ou code postal').click({ force: true }) + cy.focused().type('Steenvoorde') cy.contains('Steenvoorde (59114)').click({ force: true }) cy.contains('Suivant').click({ force: true }) cy.contains('Modifier mes réponses').click({ force: true }) diff --git a/site/cypress/support/simulateur.js b/site/cypress/support/simulateur.js index b900c93af..6c5e04181 100644 --- a/site/cypress/support/simulateur.js +++ b/site/cypress/support/simulateur.js @@ -22,6 +22,7 @@ export const runSimulateurTest = (simulateur) => { cy.get(chargeInputSelector).type(1000) } cy.get(inputSelector).each(($testedInput) => { + // eslint-disable-next-line cypress/unsafe-to-chain-command cy.wrap($testedInput) .type('{selectall}60111') .and(($i) => diff --git a/site/scripts/runScriptOnFileChange/execOnFileChange.ts b/site/scripts/runScriptOnFileChange/execOnFileChange.ts index 0fd517e3a..218d74863 100644 --- a/site/scripts/runScriptOnFileChange/execOnFileChange.ts +++ b/site/scripts/runScriptOnFileChange/execOnFileChange.ts @@ -11,6 +11,7 @@ type DirPath = string type FilePath = string interface Option { + // eslint-disable-next-line @typescript-eslint/no-duplicate-type-constituents paths: (DirPath | FilePath)[] run: string } diff --git a/site/source/components/ChiffreAffairesActivitéMixte.tsx b/site/source/components/ChiffreAffairesActivitéMixte.tsx index c3f369c93..1c299ed31 100644 --- a/site/source/components/ChiffreAffairesActivitéMixte.tsx +++ b/site/source/components/ChiffreAffairesActivitéMixte.tsx @@ -160,8 +160,6 @@ function ActivitéMixte() { [dispatch, situation] ) - const { t } = useTranslation() - return (
diff --git a/site/source/components/PaySlip.tsx b/site/source/components/PaySlip.tsx index a89ec322c..07feab002 100644 --- a/site/source/components/PaySlip.tsx +++ b/site/source/components/PaySlip.tsx @@ -107,8 +107,6 @@ export default function PaySlip() { const parsedRules = useEngine().getParsedRules() const cotisationsBySection = getCotisationsBySection(parsedRules) - const { t } = useTranslation() - return (
| undefined } export function SimulateurCard({ diff --git a/site/source/components/company/Details.tsx b/site/source/components/company/Details.tsx index cdd2665e5..cbe564438 100644 --- a/site/source/components/company/Details.tsx +++ b/site/source/components/company/Details.tsx @@ -16,6 +16,7 @@ export function CompanyDetails({ headingTag = 'h2', }: { showSituation?: boolean + // eslint-disable-next-line @typescript-eslint/no-explicit-any headingTag?: string | ComponentType | undefined }) { return ( diff --git a/site/source/components/conversation/AnswerList.tsx b/site/source/components/conversation/AnswerList.tsx index 7296a0f48..b948b2696 100644 --- a/site/source/components/conversation/AnswerList.tsx +++ b/site/source/components/conversation/AnswerList.tsx @@ -275,8 +275,6 @@ function AnswerElement(rule: RuleNode) { const dispatch = useDispatch() const engine = useEngine() - const { t } = useTranslation() - const parentDottedName = utils.ruleParent(rule.dottedName) as DottedName const questionDottedName = rule.rawNode.question ? (rule.dottedName as DottedName) diff --git a/site/source/components/utils/Scroll.tsx b/site/source/components/utils/Scroll.tsx index fd0571ac8..83df2f4ac 100644 --- a/site/source/components/utils/Scroll.tsx +++ b/site/source/components/utils/Scroll.tsx @@ -20,7 +20,7 @@ export function ScrollToTop({ if (!elem) { return } - ;(elem as any).scrollTop = 0 + ;(elem as HTMLElement).scrollTop = 0 }) try { window.scroll({ diff --git a/site/source/components/utils/useSearchParamsSimulationSharing.ts b/site/source/components/utils/useSearchParamsSimulationSharing.ts index ec6cd29b9..8863b5d83 100644 --- a/site/source/components/utils/useSearchParamsSimulationSharing.ts +++ b/site/source/components/utils/useSearchParamsSimulationSharing.ts @@ -10,6 +10,7 @@ import { Situation } from '@/store/reducers/rootReducer' import { configObjectifsSelector } from '@/store/selectors/simulationSelectors' type ShortName = string +// eslint-disable-next-line @typescript-eslint/no-redundant-type-constituents type ParamName = DottedName | ShortName export default function useSearchParamsSimulationSharing() { diff --git a/site/source/design-system/checklist/index.tsx b/site/source/design-system/checklist/index.tsx index c297bd1b5..4170b4832 100644 --- a/site/source/design-system/checklist/index.tsx +++ b/site/source/design-system/checklist/index.tsx @@ -14,10 +14,7 @@ export const CheckList = ({ const { isChecked, label } = item return ( - + {isChecked ? : } {label} diff --git a/site/source/design-system/typography/link.tsx b/site/source/design-system/typography/link.tsx index af0bcd7fd..06791d5fe 100644 --- a/site/source/design-system/typography/link.tsx +++ b/site/source/design-system/typography/link.tsx @@ -3,7 +3,6 @@ import { AriaButtonProps } from '@react-types/button' import React, { ComponentProps, ComponentPropsWithRef, - CSSProperties, ForwardedRef, useCallback, useRef, diff --git a/site/source/hooks/useAxeCoreAnalysis.ts b/site/source/hooks/useAxeCoreAnalysis.ts index 67da5289c..a0359937e 100644 --- a/site/source/hooks/useAxeCoreAnalysis.ts +++ b/site/source/hooks/useAxeCoreAnalysis.ts @@ -5,7 +5,9 @@ export const useAxeCoreAnalysis = () => { const axeRef = useRef< | { default: ( + // eslint-disable-next-line @typescript-eslint/no-explicit-any _React: any, + // eslint-disable-next-line @typescript-eslint/no-explicit-any _ReactDOM: any, _timeout: number ) => Promise diff --git a/site/source/hooks/useSaveAndRestoreScrollPosition.ts b/site/source/hooks/useSaveAndRestoreScrollPosition.ts index 386badde1..8aabaafe1 100644 --- a/site/source/hooks/useSaveAndRestoreScrollPosition.ts +++ b/site/source/hooks/useSaveAndRestoreScrollPosition.ts @@ -16,7 +16,9 @@ export const useSaveAndRestoreScrollPosition = () => { if ( scrollPosition && + // eslint-disable-next-line @typescript-eslint/no-unsafe-enum-comparison (navigationType === POP_ACTION_LABEL || + // eslint-disable-next-line @typescript-eslint/no-unsafe-enum-comparison navigationType === REPLACE_ACTION_LABEL) ) { window.scrollTo(0, parseInt(scrollPosition)) diff --git a/site/source/pages/assistants/components/Fields.tsx b/site/source/pages/assistants/components/Fields.tsx index fec6a1e65..c075acd96 100644 --- a/site/source/pages/assistants/components/Fields.tsx +++ b/site/source/pages/assistants/components/Fields.tsx @@ -2,7 +2,6 @@ import { useSSRSafeId } from '@react-aria/ssr' import { DottedName } from 'modele-social' import { PublicodesExpression, RuleNode } from 'publicodes' import { useCallback, useContext } from 'react' -import { useTranslation } from 'react-i18next' import { useDispatch, useSelector } from 'react-redux' import styled from 'styled-components' @@ -96,8 +95,6 @@ export function SimpleField(props: SimpleFieldProps) { [dispatch] ) - const { t } = useTranslation() - let displayedQuestion = question ?? evaluateQuestion(engine, engine.getRule(dottedName)) diff --git a/site/source/pages/assistants/declaration-revenu-independants/components/DéclarationRevenu.tsx b/site/source/pages/assistants/declaration-revenu-independants/components/DéclarationRevenu.tsx index 33c4e52e9..8f49ef1ed 100644 --- a/site/source/pages/assistants/declaration-revenu-independants/components/DéclarationRevenu.tsx +++ b/site/source/pages/assistants/declaration-revenu-independants/components/DéclarationRevenu.tsx @@ -1,7 +1,6 @@ import { DottedName } from 'modele-social' import { PublicodesExpression, Rule, RuleNode } from 'publicodes' import { Fragment, useCallback } from 'react' -import { useTranslation } from 'react-i18next' import { useDispatch } from 'react-redux' import styled, { css } from 'styled-components' @@ -36,8 +35,6 @@ const RuleInputWithTitle = ({ }) => { const dispatch = useDispatch() - const { t } = useTranslation() - const dispatchValue = useCallback( (value: PublicodesExpression | undefined, dottedName: DottedName) => { dispatch(updateSituation(dottedName, value)) diff --git a/site/source/pages/assistants/demande-mobilité/EndBlock.tsx b/site/source/pages/assistants/demande-mobilité/EndBlock.tsx index dccad6e43..d934195ab 100644 --- a/site/source/pages/assistants/demande-mobilité/EndBlock.tsx +++ b/site/source/pages/assistants/demande-mobilité/EndBlock.tsx @@ -267,6 +267,7 @@ function isOnTouchDevice() { if ( 'ontouchstart' in window || ('DocumentTouch' in window && + // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access, @typescript-eslint/no-explicit-any document instanceof (window as any).DocumentTouch) ) { return true diff --git a/site/source/pages/assistants/demande-mobilité/FieldsPDF.tsx b/site/source/pages/assistants/demande-mobilité/FieldsPDF.tsx index aa6d546e2..f2f7fac73 100644 --- a/site/source/pages/assistants/demande-mobilité/FieldsPDF.tsx +++ b/site/source/pages/assistants/demande-mobilité/FieldsPDF.tsx @@ -28,7 +28,7 @@ export default function FieldsPDF({ fields }: FieldsPDFProps) { <> {question && typeof question === 'object' - ? (engine.evaluate(question) as any).nodeValue + ? (engine.evaluate(question).nodeValue as string) : question ?? title}{' '} {note && ({note})} diff --git a/site/source/pages/statistiques/Chart.tsx b/site/source/pages/statistiques/Chart.tsx index 1844bb1f9..8460906bc 100644 --- a/site/source/pages/statistiques/Chart.tsx +++ b/site/source/pages/statistiques/Chart.tsx @@ -257,6 +257,7 @@ function formatMonth(date: string | Date) { type CustomTooltipProps = { active?: boolean period: Period + // eslint-disable-next-line @typescript-eslint/no-explicit-any payload?: any dataKeys: string[] } diff --git a/site/source/pages/statistiques/Stats.tsx b/site/source/pages/statistiques/Stats.tsx index 4a065d650..8d1a3d469 100644 --- a/site/source/pages/statistiques/Stats.tsx +++ b/site/source/pages/statistiques/Stats.tsx @@ -22,7 +22,7 @@ export default function Stats({ accessibleMode }: StatsProps) { <> - + ) : loading ? ( Chargement des statistiques... diff --git a/site/source/pages/statistiques/StatsGlobal.tsx b/site/source/pages/statistiques/StatsGlobal.tsx index dd6e60f61..8041add8c 100644 --- a/site/source/pages/statistiques/StatsGlobal.tsx +++ b/site/source/pages/statistiques/StatsGlobal.tsx @@ -89,13 +89,9 @@ const RetoursAsProgress = ({ interface GlobalStatsProps { stats: StatsStruct - accessibleMode: boolean } -export default function StatsGlobal({ - stats, - accessibleMode, -}: GlobalStatsProps) { +export default function StatsGlobal({ stats }: GlobalStatsProps) { const { pathname, search } = useLocation() const { i18n } = useTranslation() const formatNumber = Intl.NumberFormat(i18n.language).format.bind(null) diff --git a/site/source/sitePaths.ts b/site/source/sitePaths.ts index 21a1509a4..0d4b1cc68 100644 --- a/site/source/sitePaths.ts +++ b/site/source/sitePaths.ts @@ -225,7 +225,9 @@ const checkedSitePathsFr = rawSitePathsFr satisfies RequiredPath // If there is a type error here, check rawSitePathsEn object matches the metadata-src.ts pathId const checkedSitePathsEn = rawSitePathsEn satisfies RequiredPath +// eslint-disable-next-line @typescript-eslint/no-unused-vars type SitePathsFr = typeof checkedSitePathsFr +// eslint-disable-next-line @typescript-eslint/no-unused-vars type SitePathsEn = typeof checkedSitePathsEn type GenericSitePath = { [key: string]: string | GenericSitePath } diff --git a/site/source/types/css-prop.d.ts b/site/source/types/css-prop.d.ts index 55fa2007f..01ee3f1e8 100644 --- a/site/source/types/css-prop.d.ts +++ b/site/source/types/css-prop.d.ts @@ -1,6 +1,7 @@ import { CSSProp, DefaultTheme } from 'styled-components' declare module 'react' { + // eslint-disable-next-line @typescript-eslint/no-unused-vars interface DOMAttributes { // @ts-ignore css?: CSSProp diff --git a/site/source/types/iframe-resizer.d.ts b/site/source/types/iframe-resizer.d.ts index b61047817..ed89edb8c 100644 --- a/site/source/types/iframe-resizer.d.ts +++ b/site/source/types/iframe-resizer.d.ts @@ -1,4 +1,5 @@ interface Window { + // eslint-disable-next-line @typescript-eslint/no-explicit-any parentIFrame?: any } diff --git a/site/source/types/import-yaml.d.ts b/site/source/types/import-yaml.d.ts index 127e8da46..c13a884fd 100644 --- a/site/source/types/import-yaml.d.ts +++ b/site/source/types/import-yaml.d.ts @@ -1,6 +1,7 @@ // TODO: We could have better types for yaml imports (it works automatically for JSON modules) declare module '*.yaml' { + // eslint-disable-next-line @typescript-eslint/no-explicit-any const content: any export default content } diff --git a/site/source/types/react-signature-pad-wrapper.d.ts b/site/source/types/react-signature-pad-wrapper.d.ts index c924e415f..2bd51a9bf 100644 --- a/site/source/types/react-signature-pad-wrapper.d.ts +++ b/site/source/types/react-signature-pad-wrapper.d.ts @@ -1,4 +1,5 @@ declare module 'react-signature-pad-wrapper' { + // eslint-disable-next-line @typescript-eslint/no-explicit-any const signaturePad: any export default signaturePad } diff --git a/site/source/types/styled.d.ts b/site/source/types/styled.d.ts index c15642301..676726101 100644 --- a/site/source/types/styled.d.ts +++ b/site/source/types/styled.d.ts @@ -1,6 +1,6 @@ import 'styled-components' -import theme from '@/design-system/theme' +import theme, { SpacingKey } from '@/design-system/theme' type Color = string diff --git a/site/test/persistence.test.ts b/site/test/persistence.test.ts index 10b37eb6a..533855da0 100644 --- a/site/test/persistence.test.ts +++ b/site/test/persistence.test.ts @@ -1,3 +1,4 @@ +/* eslint-disable @typescript-eslint/no-explicit-any */ import { createMemoryHistory } from 'history' import { DottedName } from 'modele-social' import { createStore } from 'redux'