Skip to content

Commit

Permalink
réactive le tsc dans le front
Browse files Browse the repository at this point in the history
  • Loading branch information
vmaubert committed Dec 26, 2024
1 parent 3abdb92 commit 5fac685
Show file tree
Hide file tree
Showing 9 changed files with 43 additions and 13 deletions.
27 changes: 26 additions & 1 deletion frontend/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 4 additions & 2 deletions frontend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,15 @@
"name": "Maestro frontend",
"version": "0.0.1",
"private": false,
"type": "module",
"scriptsComments": {
"postinstall": "Permet à l'API d'utiliser le DSFR pour générer des PDF."
},
"scripts": {
"dev": "vite",
"start": "vite",
"postinstall": "copy-dsfr-to-public",
"build": "vite build",
"build": "tsc && vite build",
"preview": "vite preview",
"test": "vitest",
"lint": "node_modules/.bin/eslint . --ext .ts,.tsx",
Expand Down Expand Up @@ -54,7 +55,7 @@
"dompurify": "^3.1.3",
"fetch-intercept": "^2.4.0",
"i18next": "^23.10.0",
"lodash": "^4.17.21",
"lodash-es": "^4.17.21",
"maplibre-gl": "^4.1.2",
"openapi-explorer": "^2.2.732",
"react": "^18.2.0",
Expand All @@ -75,6 +76,7 @@
"@svgr/core": "^8.1.0",
"@svgr/plugin-jsx": "^8.1.0",
"@types/dompurify": "^3.0.0",
"@types/lodash-es": "^4.17.12",
"@types/node": "^22.10.0",
"@typescript-eslint/parser": "^8.14.0",
"@vitejs/plugin-react": "^4.3.4",
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/components/Header/Header.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import { applicationMiddleware, applicationReducer } from 'src/store/store';
import { mockRequests } from '../../../test/requestTestUtils';
import Header from './Header';

import {describe, test, expect} from 'vitest';
import { describe, test, expect, beforeEach } from 'vitest';
const validatedProgrammingPlan = {
...genProgrammingPlan(),
status: 'Validated',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import {
MatrixKindLabels,
MatrixKindList
} from 'shared/referential/MatrixKind';
import { isNil } from 'lodash-es';
interface AddMatrixProps {
excludedMatrixList: Matrix[];
onSelect: (matrix: Matrix) => Promise<void>;
Expand All @@ -37,13 +38,15 @@ const MatrixSelectModal = ({
const [selectedOption, setSelectedOption] = useState<{
label: string;
value: Matrix;
}>(null);
} | null>(null);

const submit = async (e: React.MouseEvent<HTMLElement>) => {
e.preventDefault();

await onSelect(selectedOption.value as Matrix);
matrixSelectModal.close();
if( !isNil(selectedOption)) {
await onSelect(selectedOption.value);
matrixSelectModal.close();
}
};

return (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ vi.mock(import('react-router-dom'), async (importOriginal) => {
};
});

import { describe, test, expect, vi } from 'vitest';
import { describe, test, expect, vi, beforeEach } from 'vitest';
let store: Store;
const authUser = genAuthUser();
const nationalCoordinator = genUser({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { BrowserRouter } from 'react-router-dom';
import { store } from 'src/store/store';
import ContextStep from 'src/views/SampleView/DraftSample/ContextStep/ContextStep';

import {describe, test, expect} from 'vitest';
import { describe, test, expect, beforeEach } from 'vitest';
// const companySearchResult = genCompanySearchResult();
// const companySearchRequest = {
// pathname: `/api/companies/search?q=Company`,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import {
mockRequests,
} from '../../../../../../test/requestTestUtils';

import {describe, test, expect} from 'vitest';
import { describe, test, expect, beforeEach } from 'vitest';
let store: Store;
const authUser = genAuthUser();
const sampler = genUser({
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/views/SampleView/test/SampleView.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import {
mockRequests,
} from '../../../../test/requestTestUtils';

import { describe, test, expect, vi } from 'vitest';
import { describe, test, expect, vi, beforeEach } from 'vitest';


vi.mock(import('react-router-dom'), async (importOriginal) => {
Expand Down
4 changes: 2 additions & 2 deletions shared/schema/User/User.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import _ from 'lodash';
import { z } from 'zod';
import { Region, RegionList, Regions } from '../../referential/Region';
import { UserPermission } from './UserPermission';
import { UserRole, UserRolePermissions } from './UserRole';
import { intersection } from 'lodash-es';

export const User = z.object({
id: z.string().uuid(),
Expand Down Expand Up @@ -45,5 +45,5 @@ export const hasPermission = (
.map((role) => UserRolePermissions[role])
.flat();

return _.intersection(permissions, userPermissions).length > 0;
return intersection(permissions, userPermissions).length > 0;
};

0 comments on commit 5fac685

Please sign in to comment.