Skip to content

Commit 38ab710

Browse files
authored
Fix sonar issue Prefer node:crypto over crypto (#138)
refactor(crypto): Node.js built-in modules should be imported using the "node:" protocol typescript:S7772 And it's only for UUID type then import type Signed-off-by: sBouzols <[email protected]>
1 parent c6995f1 commit 38ab710

File tree

6 files changed

+6
-6
lines changed

6 files changed

+6
-6
lines changed

src/pages/announcements/announcements-page.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
66
*/
77

8-
import type { UUID } from 'crypto';
8+
import type { UUID } from 'node:crypto';
99
import { useCallback, useMemo, useRef, useState } from 'react';
1010
import { FormattedMessage, useIntl } from 'react-intl';
1111
import { Divider, Grid, Typography } from '@mui/material';

src/pages/announcements/cancel-cell-renderer.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
* License, v. 2.0. If a copy of the MPL was not distributed with this
55
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
66
*/
7-
import type { UUID } from 'crypto';
7+
import type { UUID } from 'node:crypto';
88
import { useCallback } from 'react';
99
import { IconButton, type IconButtonProps, Tooltip } from '@mui/material';
1010
import { Delete } from '@mui/icons-material';

src/pages/profiles/modification/profile-modification-dialog.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ import { useForm } from 'react-hook-form';
2323
import { FunctionComponent, useCallback, useEffect, useMemo, useState } from 'react';
2424
import { CustomMuiDialog, FetchStatus, useSnackMessage, yupConfig as yup } from '@gridsuite/commons-ui';
2525
import { UserAdminSrv, UserProfile } from '../../../services';
26-
import { UUID } from 'crypto';
26+
import type { UUID } from 'node:crypto';
2727

2828
export interface ProfileModificationDialogProps {
2929
profileId: UUID | undefined;

src/pages/profiles/profiles-page.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import { GridTableRef } from '../../components/Grid';
1111
import { UserProfile } from '../../services';
1212
import { RowClickedEvent } from 'ag-grid-community';
1313
import ProfileModificationDialog from './modification/profile-modification-dialog';
14-
import { UUID } from 'crypto';
14+
import type { UUID } from 'node:crypto';
1515
import ProfilesTable from './profiles-table';
1616
import AddProfileDialog from './add-profile-dialog';
1717

src/services/directory.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
*/
77

88
import { backendFetchJson, getRestBase } from '../utils/api-rest';
9-
import { UUID } from 'crypto';
9+
import type { UUID } from 'node:crypto';
1010
import { ElementAttributes } from '@gridsuite/commons-ui';
1111

1212
const EXPLORE_URL = `${getRestBase()}/explore/v1`;

src/services/user-admin.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
*/
77

88
import { backendFetch, backendFetchJson, getRestBase } from '../utils/api-rest';
9-
import { UUID } from 'crypto';
9+
import type { UUID } from 'node:crypto';
1010

1111
const USER_ADMIN_URL = `${getRestBase()}/user-admin/v1`;
1212

0 commit comments

Comments
 (0)