Skip to content

Commit

Permalink
fix: types (ignore) and pass to tsx
Browse files Browse the repository at this point in the history
  • Loading branch information
laurentC35 committed Dec 20, 2024
1 parent b027b64 commit ce745e3
Show file tree
Hide file tree
Showing 6 changed files with 23 additions and 13 deletions.
4 changes: 3 additions & 1 deletion src/hooks/useArticulation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ type Item = {
cells: {
label: string;
value: ReactNode;
page: string;
page?: string;
}[];
progress: number; // -1: not completed, 0: started, 1: finished
};
Expand Down Expand Up @@ -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]
);

Expand All @@ -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) {
Expand Down
4 changes: 3 additions & 1 deletion src/stories/behaviour/articulation/articulation.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ function StoryComponent({ source, data }: Props) {
<div>
{page}
<button onClick={gotoNav}>&lt; Revenir à l'articulation</button>
{/* eslint-disable-next-line @typescript-eslint/ban-ts-comment */}
{/*/ @ts-ignore */}
<Orchestrator source={source} data={data} initialPage={page} />
</div>
);
Expand Down Expand Up @@ -74,7 +76,7 @@ function StoryComponent({ source, data }: Props) {
padding: '.5rem 1rem',
}}
>
<button onClick={() => setPage(item.page)}>
<button onClick={() => console.log('ToDo')}>
{progressLabel(item.progress)}
</button>
</td>
Expand Down
2 changes: 1 addition & 1 deletion src/stories/behaviour/performance/performance.stories.jsx
Original file line number Diff line number Diff line change
@@ -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',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
/* eslint-disable */
// @ts-nocheck
import './custom-lunatic.scss';
import './orchestrator.scss';

Expand All @@ -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);
}

Expand All @@ -33,6 +35,8 @@ function DevOptions({ goToPage, getData }) {
</div>
<Input
id="page-to-jump"
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore
value={toPage}
handleChange={handleChange}
min={1}
Expand Down Expand Up @@ -89,7 +93,7 @@ function Pager({
);
}

function onLogChange(response, value, args) {
function onLogChange(response: any, value: any, args: any) {
Logger.log('onChange', { response, value, args });
}

Expand All @@ -110,7 +114,7 @@ function OrchestratorForStories({
missingStrategy = logMissingStrategy,
missingShortcut,
autoSuggesterLoading,
addExternal,
// addExternal,
preferences,
slots,
showOverview = false,
Expand All @@ -136,7 +140,7 @@ function OrchestratorForStories({
pageTag,
isFirstPage,
isLastPage,
waiting,
// waiting,
overview,
compileControls,
getData,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
/* eslint-disable */
// @ts-nocheck
import { Fragment } from 'react';
import './overview.scss';

Expand Down

0 comments on commit ce745e3

Please sign in to comment.