fix types errors

pull/2787/head
Jérémy Rialland 2023-08-01 12:58:30 +02:00 committed by Jérémy Rialland
parent b7b1a01819
commit afdc4636c6
31 changed files with 75 additions and 111 deletions

View File

@ -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")

View File

@ -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')

View File

@ -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(
{

View File

@ -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 })

View File

@ -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) =>

View File

@ -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
}

View File

@ -160,8 +160,6 @@ function ActivitéMixte() {
[dispatch, situation]
)
const { t } = useTranslation()
return (
<div key={Boolean(defaultChecked).toString()}>
<StyledActivitéMixteContainer>

View File

@ -107,8 +107,6 @@ export default function PaySlip() {
const parsedRules = useEngine().getParsedRules()
const cotisationsBySection = getCotisationsBySection(parsedRules)
const { t } = useTranslation()
return (
<div
className="payslip__container"

View File

@ -1,4 +1,3 @@
import { ComponentType } from 'react'
import { useTranslation } from 'react-i18next'
import { Chip } from '@/design-system'
@ -14,7 +13,6 @@ type SimulateurCardProps = MergedSimulatorDataValues & {
small?: boolean
fromGérer?: boolean
role?: string
as?: string | ComponentType<any> | undefined
}
export function SimulateurCard({

View File

@ -16,6 +16,7 @@ export function CompanyDetails({
headingTag = 'h2',
}: {
showSituation?: boolean
// eslint-disable-next-line @typescript-eslint/no-explicit-any
headingTag?: string | ComponentType<any> | undefined
}) {
return (

View File

@ -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)

View File

@ -20,7 +20,7 @@ export function ScrollToTop({
if (!elem) {
return
}
;(elem as any).scrollTop = 0
;(elem as HTMLElement).scrollTop = 0
})
try {
window.scroll({

View File

@ -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() {

View File

@ -14,10 +14,7 @@ export const CheckList = ({
const { isChecked, label } = item
return (
<StyledLi
$isChecked={isChecked}
key={`checklist-item-${item.toString()}-${index}`}
>
<StyledLi $isChecked={isChecked} key={`checklist-item-${index}`}>
{isChecked ? <CheckmarkIcon /> : <CrossIcon />}
{label}
</StyledLi>

View File

@ -3,7 +3,6 @@ import { AriaButtonProps } from '@react-types/button'
import React, {
ComponentProps,
ComponentPropsWithRef,
CSSProperties,
ForwardedRef,
useCallback,
useRef,

View File

@ -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<void>

View File

@ -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))

View File

@ -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))

View File

@ -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))

View File

@ -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

View File

@ -28,7 +28,7 @@ export default function FieldsPDF({ fields }: FieldsPDFProps) {
<>
<Text style={styles.name}>
{question && typeof question === 'object'
? (engine.evaluate(question) as any).nodeValue
? (engine.evaluate(question).nodeValue as string)
: question ?? title}{' '}
{note && <Text style={styles.fieldNumber}>({note})</Text>}
</Text>

View File

@ -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[]
}

View File

@ -22,7 +22,7 @@ export default function Stats({ accessibleMode }: StatsProps) {
<>
<StatsDetail stats={stats} accessibleMode={accessibleMode} />
<StatsGlobal stats={stats} accessibleMode={accessibleMode} />
<StatsGlobal stats={stats} />
</>
) : loading ? (
<Intro>Chargement des statistiques...</Intro>

View File

@ -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)

View File

@ -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 }

View File

@ -1,6 +1,7 @@
import { CSSProp, DefaultTheme } from 'styled-components'
declare module 'react' {
// eslint-disable-next-line @typescript-eslint/no-unused-vars
interface DOMAttributes<T> {
// @ts-ignore
css?: CSSProp<DefaultTheme>

View File

@ -1,4 +1,5 @@
interface Window {
// eslint-disable-next-line @typescript-eslint/no-explicit-any
parentIFrame?: any
}

View File

@ -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
}

View File

@ -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
}

View File

@ -1,6 +1,6 @@
import 'styled-components'
import theme from '@/design-system/theme'
import theme, { SpacingKey } from '@/design-system/theme'
type Color = string

View File

@ -1,3 +1,4 @@
/* eslint-disable @typescript-eslint/no-explicit-any */
import { createMemoryHistory } from 'history'
import { DottedName } from 'modele-social'
import { createStore } from 'redux'