Skip to content

Commit

Permalink
bump: node dependencies (#1144)
Browse files Browse the repository at this point in the history
  • Loading branch information
Grafikart committed Aug 14, 2024
1 parent fd60aa4 commit 0d746bd
Show file tree
Hide file tree
Showing 35 changed files with 2,038 additions and 4,459 deletions.
9 changes: 0 additions & 9 deletions .eslintrc

This file was deleted.

2 changes: 1 addition & 1 deletion e2e/simpson.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ test('can complete simpson form', async ({ page }) => {
.getByRole('row', { name: 'Kill Mr Burns' })
.getByText('Commencez votre saisie...')
.click();
await page.getByText('Other').click();
await page.getByText('Other').locator('visible=true').click();
await page.getByText('Commencez votre saisie...').click();
await page.getByRole('option', { name: 'Jay' }).getByText('Jay').click();
await gotoNextPage(page, 4);
Expand Down
29 changes: 29 additions & 0 deletions eslint.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
import js from '@eslint/js';
import globals from 'globals';
import reactHooks from 'eslint-plugin-react-hooks';
import reactRefresh from 'eslint-plugin-react-refresh';
import tseslint from 'typescript-eslint';

export default tseslint.config({
extends: [js.configs.recommended, ...tseslint.configs.recommended],
files: ['**/*.{ts,tsx}'],
languageOptions: {
ecmaVersion: 2020,
globals: globals.browser,
},
plugins: {
'react-hooks': reactHooks,
'react-refresh': reactRefresh,
},
rules: {
...reactHooks.configs.recommended.rules,
'react-refresh/only-export-components': 'off',
'@typescript-eslint/no-explicit-any': 'off',
'@typescript-eslint/no-empty-object-type': [
'error',
{
allowInterfaces: 'always',
},
],
},
});
72 changes: 33 additions & 39 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,7 @@
"test-watch": "vitest",
"build:types": "node ./tools/schema-ts-generator.js && prettier src/type.source.ts --write",
"check": "tsc --noEmit",
"lint": "eslint ./src",
"lint:check": "eslint . --ext .ts,.tsx",
"lint:check": "eslint ./src",
"_format": "prettier **/*.{ts,tsx,json}",
"format": "npm run _format -- --write",
"format:check": "npm run _format -- --list-different",
Expand All @@ -64,64 +63,59 @@
"dependencies": {
"@inseefr/trevas": "^0.1.21",
"@inseefr/vtl-2.0-antlr-tools": "^0.3.2",
"antlr4": "4.11.0",
"antlr4": "^4.13.2",
"classnames": "^2.5.1",
"http-server": "^14.1.1",
"minisearch": "^6.3.0",
"minisearch": "^7.1.0",
"react-error-boundary": "^4.0.13",
"react-markdown": "^9.0.1",
"react-number-format": "^5.3.4",
"react-tooltip": "^5.26.4",
"react-number-format": "^5.4.0",
"react-tooltip": "^5.28.0",
"remark-breaks": "^4.0.0",
"remark-emoji": "^5.0.0",
"sass": "^1.76.0"
"remark-emoji": "^5.0.1",
"sass": "^1.77.8"
},
"resolutions": {
"jackspeak": "2.3.6",
"strip-ansi": "6.0.1"
},
"devDependencies": {
"ajv": "^8.12.0",
"json-schema-to-typescript": "^15.0.0",
"@playwright/test": "^1.43.1",
"@storybook/addon-a11y": "^8.0.10",
"@storybook/addon-essentials": "^8.0.10",
"@storybook/addon-interactions": "^8.0.10",
"@storybook/react": "^8.0.10",
"@storybook/react-vite": "^8.0.10",
"@storybook/test": "^8.0.10",
"@storybook/test-runner": "^0.17.0",
"@testing-library/jest-dom": "^6.4.5",
"@eslint/js": "^9.9.0",
"@playwright/test": "^1.46.0",
"@storybook/addon-a11y": "^8.2.9",
"@storybook/addon-essentials": "^8.2.9",
"@storybook/addon-interactions": "^8.2.9",
"@storybook/react": "^8.2.9",
"@storybook/react-vite": "^8.2.9",
"@storybook/test": "^8.2.9",
"@storybook/test-runner": "^0.19.1",
"@testing-library/jest-dom": "^6.4.8",
"@testing-library/react": "^16.0.0",
"@types/react": "^18.3.1",
"@types/react": "^18.3.3",
"@types/react-dom": "^18.3.0",
"@typescript-eslint/eslint-plugin": "^8.0.0",
"@typescript-eslint/parser": "^8.0.0",
"@vitejs/plugin-react": "4.2.1",
"@vitejs/plugin-react": "^4.3.1",
"ajv": "^8.17.1",
"concurrently": "^8.2.2",
"eslint": "8.57.0",
"eslint-config-prettier": "^9.1.0",
"eslint-config-react-app": "^7.0.1",
"eslint-plugin-flowtype": "^8.0.3",
"eslint-plugin-import": "^2.29.1",
"eslint-plugin-jsx-a11y": "^6.8.0",
"eslint-plugin-react": "^7.34.1",
"eslint-plugin-react-hooks": "^4.6.2",
"eslint-plugin-storybook": "^0.8.0",
"jsdom": "^24.0.0",
"prettier": "^3.2.5",
"eslint": "^9.9.0",
"eslint-plugin-react-hooks": "^5.1.0-rc.0",
"eslint-plugin-react-refresh": "^0.4.9",
"globals": "^15.9.0",
"jsdom": "^24.1.1",
"json-schema-to-typescript": "^15.0.0",
"prettier": "^3.3.3",
"react": "^18.3.1",
"react-dom": "^18.3.1",
"storybook": "^8.0.10",
"typescript": "^5.4.5",
"vite": "^5.2.11",
"vitest": "^2.0.0"
"storybook": "^8.2.9",
"typescript": "^5.5.4",
"typescript-eslint": "^8.1.0",
"vite": "^5.4.0",
"vitest": "^2.0.5"
},
"publishConfig": {
"access": "public"
},
"peerDependencies": {
"react": "^18.0.0"
"react": "^18.3.1 "
},
"volta": {
"node": "20.16.0",
Expand Down
2 changes: 1 addition & 1 deletion src/components/Accordion/Accordion.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import type { LunaticComponentProps } from '../type';

export const Accordion = slottableComponent<LunaticComponentProps<'Accordion'>>(
'Accordion',
function Accordion({ items, meta }) {
function Accordion({ items }) {
return (
<div className="lunatic-accordion">
{items.map((item, k) => (
Expand Down
4 changes: 3 additions & 1 deletion src/components/RosterForLoop/RosterForLoop.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,13 @@ export const RosterForLoop = (
lines,
errors,
handleChanges,
// eslint-disable-next-line @typescript-eslint/no-unused-vars
declarations,
header,
iterations,
id,
getComponents,
// eslint-disable-next-line @typescript-eslint/no-unused-vars
label,
...otherProps // These props will be passed down to the child components
} = props;
Expand Down Expand Up @@ -104,7 +106,7 @@ export const RosterForLoop = (
</Tr>
{hasLineErrors && (
<Tr className="lunatic-errors">
{/* @ts-ignore-next-line */}
{/* @ts-expect-error colSpan is not resolved */}
<Td colSpan={cols}>
<ComponentErrors errors={lineErrors} />
</Td>
Expand Down
2 changes: 1 addition & 1 deletion src/components/Suggester/Suggester.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ export function Suggester({
onBlur();
};

let componentErrors = getComponentErrors(errors, id) ?? [];
const componentErrors = getComponentErrors(errors, id) ?? [];
if (state === 'error') {
componentErrors.push({
id: 'suggester',
Expand Down
3 changes: 2 additions & 1 deletion src/components/Suggester/useSuggestions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ export function useSuggestions({
const [searchQuery, setSearchQuery] = useState('');
const store = getSearchForStore(storeName);
const searchIndexRef = useRefSync(store.index);
// eslint-disable-next-line prefer-const
let [options, setOptions] = useState(selectedOptions);
const [state, setState] = useState<State>(
store.error !== null
Expand All @@ -41,7 +42,7 @@ export function useSuggestions({
.then(() => {
setState('success');
})
.catch((err) => {
.catch(() => {
setState('error');
});
}, [searchIndexRef]);
Expand Down
4 changes: 2 additions & 2 deletions src/components/shared/HOC/slottableComponent.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -143,11 +143,11 @@ export function slottableComponent<T>(

if (custom && name in custom) {
const SlotComponent = custom[name] as ComponentType<T>;
// @ts-ignore-next-line
// @ts-expect-error This is too dynamic
return <SlotComponent {...props} />;
}

// @ts-ignore-next-line
// @ts-expect-error This is too dynamic
return <OriginalComponent {...props} />;
};
DecoratedComponent.displayName = name;
Expand Down
9 changes: 1 addition & 8 deletions src/components/shared/Table/Td.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,7 @@ type Props = PropsWithChildren<
} & LunaticComponentProps
>;

function LunaticTd({
children,
row,
index,
className,
colSpan,
rowSpan,
}: Props) {
function LunaticTd({ children, className, colSpan, rowSpan }: Props) {
return (
<td
className={classnames('lunatic-table-td', className)}
Expand Down
2 changes: 1 addition & 1 deletion src/components/shared/Table/Th.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ type Props = PropsWithChildren<{
rowSpan?: number;
}>;

function LunaticTh({ index, children, className, colSpan, rowSpan }: Props) {
function LunaticTh({ children, className, colSpan, rowSpan }: Props) {
return (
<th
className={classnames('lunatic-table-th', className)}
Expand Down
2 changes: 1 addition & 1 deletion src/components/shared/Table/Tr.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ type Props = PropsWithChildren<{
row?: string | number;
}>;

function LunaticTr({ children, className, row }: Props) {
function LunaticTr({ children, className }: Props) {
return (
<tr className={classnames('lunatic-table-tr', className)}>{children}</tr>
);
Expand Down
1 change: 0 additions & 1 deletion src/insee.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ declare module 'antlr4' {
class InputStream {
constructor(expression: string);
}
// eslint-disable-next-line import/no-anonymous-default-export
export default {
InputStream: InputStream,
};
Expand Down
1 change: 0 additions & 1 deletion src/type.source.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
/* eslint-disable */
/**
* This file was automatically generated by json-schema-to-typescript.
* DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file,
Expand Down
4 changes: 2 additions & 2 deletions src/use-lunatic/actions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,12 @@ export type ActionGoToPage = {

export type ActionGoNextPage = {
type: ActionKind.GO_NEXT_PAGE;
payload: {};
payload: object;
};

export type ActionGoPreviousPage = {
type: ActionKind.GO_PREVIOUS_PAGE;
payload: {};
payload: object;
};

export type Action =
Expand Down
4 changes: 2 additions & 2 deletions src/use-lunatic/commons/compile-controls.ts
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ function checkComponentInLoop(
{ value: component.conditionFilter.value, type: 'VTL' },
iterationPager
)) ||
// @ts-ignore
// @ts-expect-error TS doesn't understand that conditionFilter is a boolean here
component.conditionFilter === false
) {
continue;
Expand Down Expand Up @@ -218,7 +218,7 @@ export function compileControls(state: StateForControls) {
}
return true;
});
let errors = checkComponents(state, componentFiltered);
const errors = checkComponents(state, componentFiltered);
const currentErrors = Object.keys(errors).length > 0 ? errors : undefined;
return {
currentErrors,
Expand Down
2 changes: 1 addition & 1 deletion src/use-lunatic/commons/component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ export function hasResponse(
!!component &&
typeof component === 'object' &&
'response' in component &&
'name' in (component.response as {})
'name' in (component.response as object)
);
}

Expand Down
14 changes: 0 additions & 14 deletions src/use-lunatic/commons/compose.ts

This file was deleted.

2 changes: 2 additions & 0 deletions src/use-lunatic/commons/page-navigation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ export function getNextPager(
parent?: LunaticComponentType
): LunaticReducerState['pager'] {
// Increment the page or subPage
// eslint-disable-next-line prefer-const
let [page, subPage] =
pager.subPage !== undefined
? [pager.page, pager.subPage + 1]
Expand Down Expand Up @@ -74,6 +75,7 @@ export function getPrevPager(
parent?: LunaticComponentType
): LunaticReducerState['pager'] {
// Decrement the page or subPage
// eslint-disable-next-line prefer-const
let [page, subPage] =
pager.subPage !== undefined
? [pager.page, pager.subPage - 1]
Expand Down
5 changes: 1 addition & 4 deletions src/use-lunatic/commons/page.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,7 @@ export function pageStringToNumbers(page: string): number[] {
* Check if we are on an empty page
* if no components can be displayed on this page (using filter)
*/
export function isPageEmpty(
state: LunaticReducerState,
isMovingBackward = false
): boolean {
export function isPageEmpty(state: LunaticReducerState): boolean {
const { executeExpression, pager } = state;
const { iteration } = pager;
const components = getComponentsFromState(state);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ export function getQuestionnaireData(
} else {
try {
result[variable.variableType][variable.name] = store.get(variable.name);
} catch (e) {
} catch {
// Error can happen when calculating variable, send null to prevent crashing the mehod
result[variable.variableType][variable.name] = null;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -346,7 +346,7 @@ class LunaticVariable {
// Remember the value
try {
this.setValue(interpretVTL(this.expression, bindings), iteration);
} catch (e) {
} catch {
throw new VTLInterpretationError(this.expression!, bindings);
}
this.updateTimestamps(iteration, 'calculatedAt');
Expand Down
6 changes: 4 additions & 2 deletions src/use-lunatic/hooks/useWarnDepChange.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { useEffect, useRef } from 'react';
import type { LunaticLogger } from '../logger/type';
import { useRefSync } from '../../hooks/useRefSync';

/**
* Log a warning when the variable change
Expand All @@ -11,10 +12,11 @@ export function useWarnDepChange(
logger: LunaticLogger
) {
const firstRender = useRef(true);
const loggerRef = useRefSync(logger);
useEffect(() => {
if (!firstRender.current) {
logger({ type: 'WARNING', message });
loggerRef.current({ type: 'WARNING', message });
}
firstRender.current = false;
}, [variable]);
}, [variable, loggerRef, message]);
}
Loading

0 comments on commit 0d746bd

Please sign in to comment.