From ce745e34f0054fde65990d765f834ffa5650c32b Mon Sep 17 00:00:00 2001 From: Laurent Caouissin Date: Fri, 20 Dec 2024 12:56:00 +0100 Subject: [PATCH] fix: types (ignore) and pass to tsx --- src/hooks/useArticulation.ts | 4 +++- .../articulation/articulation.stories.tsx | 4 +++- .../performance/performance.stories.jsx | 2 +- ...chemaValidator.jsx => SchemaValidator.tsx} | 2 +- .../{orchestrator.jsx => orchestrator.tsx} | 22 +++++++++++-------- .../utils/{overview.jsx => overview.tsx} | 2 ++ 6 files changed, 23 insertions(+), 13 deletions(-) rename src/stories/utils/{SchemaValidator.jsx => SchemaValidator.tsx} (93%) rename src/stories/utils/{orchestrator.jsx => orchestrator.tsx} (91%) rename src/stories/utils/{overview.jsx => overview.tsx} (96%) diff --git a/src/hooks/useArticulation.ts b/src/hooks/useArticulation.ts index be2763e1e..ec2323d36 100644 --- a/src/hooks/useArticulation.ts +++ b/src/hooks/useArticulation.ts @@ -23,7 +23,7 @@ type Item = { cells: { label: string; value: ReactNode; - page: string; + page?: string; }[]; progress: number; // -1: not completed, 0: started, 1: finished }; @@ -76,6 +76,7 @@ export function useArticulation( const iterations = useMemo( () => forceInt(variables.run(roundabout?.iterations.value ?? '0')), + // eslint-disable-next-line react-hooks/exhaustive-deps [source, data] ); @@ -86,6 +87,7 @@ export function useArticulation( value: variables.run(item.value, { iteration: [k] }) as ReactNode, })) ); + // eslint-disable-next-line react-hooks/exhaustive-deps }, [source, data, iterations, roundabout?.progressVariable]); if (!roundabout) { diff --git a/src/stories/behaviour/articulation/articulation.stories.tsx b/src/stories/behaviour/articulation/articulation.stories.tsx index bfd145dc5..bced0d172 100644 --- a/src/stories/behaviour/articulation/articulation.stories.tsx +++ b/src/stories/behaviour/articulation/articulation.stories.tsx @@ -22,6 +22,8 @@ function StoryComponent({ source, data }: Props) {
{page} + {/* eslint-disable-next-line @typescript-eslint/ban-ts-comment */} + {/*/ @ts-ignore */}
); @@ -74,7 +76,7 @@ function StoryComponent({ source, data }: Props) { padding: '.5rem 1rem', }} > - diff --git a/src/stories/behaviour/performance/performance.stories.jsx b/src/stories/behaviour/performance/performance.stories.jsx index c5c15f88f..065bf88b1 100644 --- a/src/stories/behaviour/performance/performance.stories.jsx +++ b/src/stories/behaviour/performance/performance.stories.jsx @@ -1,8 +1,8 @@ import React from 'react'; -import Orchestrator from '../../utils/orchestrator'; import source from './source.json'; import { generateData } from '../../../tests/utils/lunatic'; import { times } from '../../../utils/array'; +import Orchestrator from '../../utils/orchestrator'; const stories = { title: 'Behaviour/Performance', diff --git a/src/stories/utils/SchemaValidator.jsx b/src/stories/utils/SchemaValidator.tsx similarity index 93% rename from src/stories/utils/SchemaValidator.jsx rename to src/stories/utils/SchemaValidator.tsx index cb51bd4f6..82a1b872e 100644 --- a/src/stories/utils/SchemaValidator.jsx +++ b/src/stories/utils/SchemaValidator.tsx @@ -2,7 +2,7 @@ import Ajv from 'ajv/dist/2020.js'; import { useMemo } from 'react'; import LunaticSchema from '../../../lunatic-schema.json'; -export function SchemaValidator({ source }) { +export function SchemaValidator({ source }: { source: any }) { const errors = useMemo(() => { const ajv = new Ajv({ removeAdditional: true, diff --git a/src/stories/utils/orchestrator.jsx b/src/stories/utils/orchestrator.tsx similarity index 91% rename from src/stories/utils/orchestrator.jsx rename to src/stories/utils/orchestrator.tsx index 92df20fd4..7bee6b72d 100644 --- a/src/stories/utils/orchestrator.jsx +++ b/src/stories/utils/orchestrator.tsx @@ -1,3 +1,5 @@ +/* eslint-disable */ +// @ts-nocheck import './custom-lunatic.scss'; import './orchestrator.scss'; @@ -7,19 +9,19 @@ import { LunaticComponents, ModalControls, useLunatic, -} from '../..'; -import React, { memo, useCallback, useEffect, useMemo, useState } from 'react'; +} from '../../index.js'; +import { memo, useCallback, useEffect, useState } from 'react'; -import { Logger } from '../../utils/logger'; -import { Overview } from './overview'; +import { Logger } from '../../utils/logger.js'; +import { Overview } from './overview.js'; import { SchemaValidator } from './SchemaValidator.jsx'; const Input = components.Input; -function DevOptions({ goToPage, getData }) { +function DevOptions({ goToPage, getData }: { goToPage: any; getData: any }) { const [toPage, setToPage] = useState(1); - function handleChange(_, value) { + function handleChange(_, value: any) { setToPage(value); } @@ -33,6 +35,8 @@ function DevOptions({ goToPage, getData }) {