Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: JSX automatic runtime #34498

Merged
merged 4 commits into from
Dec 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
1 change: 0 additions & 1 deletion .vscode/client.code-snippets
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
"prefix": "sbmodule",
"body": [
"import type { Meta, StoryFn } from '@storybook/react';",
"import React from 'react';",
"",
"import $1 from './$1';",
"",
Expand Down
8 changes: 8 additions & 0 deletions apps/meteor/.babelrc
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,14 @@
}
]
],
"plugins": [
[
"@babel/plugin-transform-react-jsx",
{
"runtime": "automatic"
}
]
],
"env": {
"coverage": {
"plugins": [
Expand Down
1 change: 0 additions & 1 deletion apps/meteor/.storybook/decorators.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import { mockAppRoot } from '@rocket.chat/mock-providers';
import type { Decorator } from '@storybook/react';
import React from 'react';

import ModalContextMock from '../client/stories/contexts/ModalContextMock';
import RouterContextMock from '../client/stories/contexts/RouterContextMock';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { Button, Modal } from '@rocket.chat/fuselage';
import React from 'react';
import { useTranslation } from 'react-i18next';

type PlaceChatOnHoldModalProps = {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { Field, FieldGroup, TextInput, FieldLabel, FieldRow, Box } from '@rocket.chat/fuselage';
import { useUniqueId } from '@rocket.chat/fuselage-hooks';
import React, { useEffect } from 'react';
import { useEffect } from 'react';
import { useForm, Controller } from 'react-hook-form';
import { useTranslation } from 'react-i18next';

Expand Down
2 changes: 1 addition & 1 deletion apps/meteor/client/NavBarV2/NavBar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { useToolbar } from '@react-aria/toolbar';
import { NavBar as NavBarComponent, NavBarSection, NavBarGroup, NavBarDivider } from '@rocket.chat/fuselage';
import { usePermission, useTranslation, useUser } from '@rocket.chat/ui-contexts';
import { useVoipState } from '@rocket.chat/ui-voip';
import React, { useRef } from 'react';
import { useRef } from 'react';

import {
NavBarItemOmniChannelCallDialPad,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import { NavBarItem } from '@rocket.chat/fuselage';
import type { ComponentPropsWithoutRef } from 'react';
import React from 'react';
import { useTranslation } from 'react-i18next';

import { useVoipOutboundStates } from '../../contexts/CallContext';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import type { ComponentPropsWithoutRef } from 'react';
import React from 'react';

import NavBarItemOmnichannelCallToggleError from './NavBarItemOmnichannelCallToggleError';
import NavBarItemOmnichannelCallToggleLoading from './NavBarItemOmnichannelCallToggleLoading';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import { NavBarItem } from '@rocket.chat/fuselage';
import type { ComponentPropsWithoutRef } from 'react';
import React from 'react';
import { useTranslation } from 'react-i18next';

type NavBarItemOmnichannelCallToggleErrorProps = ComponentPropsWithoutRef<typeof NavBarItem>;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import { NavBarItem } from '@rocket.chat/fuselage';
import type { ComponentPropsWithoutRef } from 'react';
import React from 'react';
import { useTranslation } from 'react-i18next';

type NavBarItemOmnichannelCallToggleLoadingProps = ComponentPropsWithoutRef<typeof NavBarItem>;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { NavBarItem } from '@rocket.chat/fuselage';
import type { ComponentPropsWithoutRef } from 'react';
import React, { useCallback } from 'react';
import { useCallback } from 'react';
import { useTranslation } from 'react-i18next';

import { useCallerInfo, useCallRegisterClient, useCallUnregisterClient, useVoipNetworkStatus } from '../../contexts/CallContext';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import { NavBarItem } from '@rocket.chat/fuselage';
import { useRouter, useCurrentRoutePath } from '@rocket.chat/ui-contexts';
import type { HTMLAttributes } from 'react';
import React from 'react';

type NavBarItemOmnichannelContactProps = Omit<HTMLAttributes<HTMLElement>, 'is'>;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import { Sidebar } from '@rocket.chat/fuselage';
import { useEffectEvent } from '@rocket.chat/fuselage-hooks';
import { useEndpoint, useToastMessageDispatch } from '@rocket.chat/ui-contexts';
import type { ReactElement, ComponentProps } from 'react';
import React from 'react';
import { useTranslation } from 'react-i18next';

import { useOmnichannelAgentAvailable } from '../../hooks/omnichannel/useOmnichannelAgentAvailable';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import { NavBarItem } from '@rocket.chat/fuselage';
import { useRouter, useCurrentRoutePath } from '@rocket.chat/ui-contexts';
import type { HTMLAttributes } from 'react';
import React from 'react';

type NavBarItemOmnichannelQueueProps = Omit<HTMLAttributes<HTMLElement>, 'is'>;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import { NavBarItem } from '@rocket.chat/fuselage';
import { GenericMenu } from '@rocket.chat/ui-client';
import { useCurrentRoutePath } from '@rocket.chat/ui-contexts';
import type { HTMLAttributes } from 'react';
import React from 'react';
import { useTranslation } from 'react-i18next';

import { useAuditMenu } from './hooks/useAuditMenu';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import { NavBarItem } from '@rocket.chat/fuselage';
import { useEffectEvent } from '@rocket.chat/fuselage-hooks';
import { useRouter, useCurrentRoutePath } from '@rocket.chat/ui-contexts';
import type { HTMLAttributes } from 'react';
import React from 'react';

type NavBarItemDirectoryPageProps = Omit<HTMLAttributes<HTMLElement>, 'is'>;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import { NavBarItem } from '@rocket.chat/fuselage';
import { useEffectEvent } from '@rocket.chat/fuselage-hooks';
import { useRouter, useLayout, useSetting, useCurrentRoutePath } from '@rocket.chat/ui-contexts';
import type { HTMLAttributes } from 'react';
import React from 'react';

type NavBarItemHomePageProps = Omit<HTMLAttributes<HTMLElement>, 'is'>;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import { NavBarItem } from '@rocket.chat/fuselage';
import { GenericMenu } from '@rocket.chat/ui-client';
import { useCurrentRoutePath } from '@rocket.chat/ui-contexts';
import type { HTMLAttributes } from 'react';
import React from 'react';
import { useTranslation } from 'react-i18next';

import { useMarketPlaceMenu } from './hooks/useMarketPlaceMenu';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import { Badge, Skeleton } from '@rocket.chat/fuselage';
import type { GenericMenuItemProps } from '@rocket.chat/ui-client';
import { useTranslation, usePermission, useRouter } from '@rocket.chat/ui-contexts';
import React from 'react';

import { useUserDropdownAppsActionButtons } from '../../../hooks/useUserDropdownAppsActionButtons';
import { useAppRequestStats } from '../../../views/marketplace/hooks/useAppRequestStats';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import { NavBarItem } from '@rocket.chat/fuselage';
import { GenericMenu } from '@rocket.chat/ui-client';
import { useCurrentRoutePath } from '@rocket.chat/ui-contexts';
import type { HTMLAttributes } from 'react';
import React from 'react';
import { useTranslation } from 'react-i18next';

import { useAdministrationMenu } from './hooks/useAdministrationMenu';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import { Button } from '@rocket.chat/fuselage';
import { useSessionDispatch } from '@rocket.chat/ui-contexts';
import type { HTMLAttributes } from 'react';
import React from 'react';
import { useTranslation } from 'react-i18next';

type NavBarItemLoginPageProps = Omit<HTMLAttributes<HTMLElement>, 'is'>;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { Field, TextInput, FieldGroup, Modal, Button, Box, FieldLabel, FieldRow,
import { useEffectEvent, useLocalStorage } from '@rocket.chat/fuselage-hooks';
import { useToastMessageDispatch, useSetting, useTranslation, useEndpoint } from '@rocket.chat/ui-contexts';
import type { ReactElement, ChangeEvent, ComponentProps, FormEvent } from 'react';
import React, { useState, useCallback } from 'react';
import { useState, useCallback } from 'react';

import UserStatusMenu from '../../../components/UserStatusMenu';
import { USER_STATUS_TEXT_MAX_LENGTH } from '../../../lib/constants';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import type { IUser } from '@rocket.chat/core-typings';
import { GenericMenu, useHandleMenuAction } from '@rocket.chat/ui-client';
import type { GenericMenuItemProps } from '@rocket.chat/ui-client';
import type { ComponentProps } from 'react';
import React, { memo, useState } from 'react';
import { memo, useState } from 'react';
import { useTranslation } from 'react-i18next';

import UserMenuButton from './UserMenuButton';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { Box, IconButton } from '@rocket.chat/fuselage';
import { UserAvatar } from '@rocket.chat/ui-avatar';
import { useSetting, useUser } from '@rocket.chat/ui-contexts';
import type { ComponentPropsWithoutRef, ForwardedRef } from 'react';
import React, { forwardRef } from 'react';
import { forwardRef } from 'react';

import { UserStatus } from '../../../components/UserStatus';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import type { IUser } from '@rocket.chat/core-typings';
import { Box, Margins } from '@rocket.chat/fuselage';
import { UserAvatar } from '@rocket.chat/ui-avatar';
import { useSetting } from '@rocket.chat/ui-contexts';
import React from 'react';
import { useTranslation } from 'react-i18next';

import MarkdownText from '../../../components/MarkdownText';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ import { useEffectEvent } from '@rocket.chat/fuselage-hooks';
import type { GenericMenuItemProps } from '@rocket.chat/ui-client';
import { defaultFeaturesPreview, usePreferenceFeaturePreviewList } from '@rocket.chat/ui-client';
import { useRouter } from '@rocket.chat/ui-contexts';
import React from 'react';
import { useTranslation } from 'react-i18next';

export const useAccountItems = (): GenericMenuItemProps[] => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { useSetModal, useUser } from '@rocket.chat/ui-contexts';
import React from 'react';

import EditStatusModal from '../EditStatusModal';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { Box } from '@rocket.chat/fuselage';
import type { GenericMenuItemProps } from '@rocket.chat/ui-client';
import { useEndpoint, useSetting } from '@rocket.chat/ui-contexts';
import { useMutation, useQuery, useQueryClient } from '@tanstack/react-query';
import React, { useEffect } from 'react';
import { useEffect } from 'react';
import { useTranslation } from 'react-i18next';

import { useCustomStatusModalHandler } from './useCustomStatusModalHandler';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import type { IUser } from '@rocket.chat/core-typings';
import { useEffectEvent } from '@rocket.chat/fuselage-hooks';
import type { GenericMenuItemProps } from '@rocket.chat/ui-client';
import { useLogout } from '@rocket.chat/ui-contexts';
import React from 'react';
import { useTranslation } from 'react-i18next';

import UserMenuHeader from '../UserMenuHeader';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import type { GenericMenuItemProps } from '@rocket.chat/ui-client';
import { useToastMessageDispatch } from '@rocket.chat/ui-contexts';
import { useVoipAPI, useVoipState } from '@rocket.chat/ui-voip';
import { useMutation } from '@tanstack/react-query';
import React, { useMemo } from 'react';
import { useMemo } from 'react';
import { useTranslation } from 'react-i18next';

export const useVoipItemsSection = (): { items: GenericMenuItemProps[] } | undefined => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { useEffectEvent } from '@rocket.chat/fuselage-hooks';
import { useLayout } from '@rocket.chat/ui-contexts';
import { useVoipDialer, useVoipState } from '@rocket.chat/ui-voip';
import type { HTMLAttributes } from 'react';
import React, { useMemo } from 'react';
import { useMemo } from 'react';
import { useTranslation } from 'react-i18next';

type NavBarItemVoipDialerProps = Omit<HTMLAttributes<HTMLElement>, 'is'> & {
Expand Down
2 changes: 1 addition & 1 deletion apps/meteor/client/apps/gameCenter/GameCenter.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import type { IExternalComponent } from '@rocket.chat/apps-engine/definition/externalComponent';
import { useMutableCallback } from '@rocket.chat/fuselage-hooks';
import React, { useState } from 'react';
import { useState } from 'react';
import type { ReactElement } from 'react';

import GameCenterContainer from './GameCenterContainer';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import { Avatar } from '@rocket.chat/fuselage';
import type { ReactElement } from 'react';
import React from 'react';
import { useTranslation } from 'react-i18next';

import type { IGame } from './GameCenter';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import type { IUser } from '@rocket.chat/core-typings';
import { Box } from '@rocket.chat/fuselage';
import type { ReactElement } from 'react';
import React, { useState } from 'react';
import { useState } from 'react';
import { useTranslation } from 'react-i18next';

import type { IGame } from './GameCenter';
Expand Down
4 changes: 2 additions & 2 deletions apps/meteor/client/apps/gameCenter/GameCenterList.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { Avatar, Icon, Table, TableBody, TableCell, TableHead, TableRow } from '@rocket.chat/fuselage';
import { useSetModal } from '@rocket.chat/ui-contexts';
import type { ReactElement } from 'react';
import React, { useCallback } from 'react';
import { useCallback } from 'react';
import { useTranslation } from 'react-i18next';

import type { IGame } from './GameCenter';
Expand All @@ -20,7 +20,7 @@ const GameCenterList = ({ handleClose, handleOpenGame, games, isLoading }: IGame
const { t } = useTranslation();
const setModal = useSetModal();
const handleInvitePlayer = useCallback(
(game) => {
(game: IGame) => {
const handleClose = (): void => {
setModal(null);
};
Expand Down
2 changes: 1 addition & 1 deletion apps/meteor/client/components/ActionManagerBusyState.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { css } from '@rocket.chat/css-in-js';
import { Box } from '@rocket.chat/fuselage';
import React, { useEffect, useState } from 'react';
import { useEffect, useState } from 'react';
import { useTranslation } from 'react-i18next';

import { useUiKitActionManager } from '../uikit/hooks/useUiKitActionManager';
Expand Down
2 changes: 1 addition & 1 deletion apps/meteor/client/components/AutoCompleteAgent.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { PaginatedSelectFiltered } from '@rocket.chat/fuselage';
import { useDebouncedValue } from '@rocket.chat/fuselage-hooks';
import type { ReactElement } from 'react';
import React, { memo, useMemo, useState } from 'react';
import { memo, useMemo, useState } from 'react';

import { useRecordList } from '../hooks/lists/useRecordList';
import { AsyncStatePhase } from '../lib/asyncState';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import type { ILivechatAgent } from '@rocket.chat/core-typings';
import { PaginatedSelectFiltered } from '@rocket.chat/fuselage';
import { useDebouncedValue } from '@rocket.chat/fuselage-hooks';
import React, { memo, useMemo, useState } from 'react';
import { memo, useMemo, useState } from 'react';

import { useRecordList } from '../hooks/lists/useRecordList';
import { AsyncStatePhase } from '../lib/asyncState';
Expand Down
2 changes: 1 addition & 1 deletion apps/meteor/client/components/AutoCompleteDepartment.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { PaginatedSelectFiltered } from '@rocket.chat/fuselage';
import { useDebouncedValue } from '@rocket.chat/fuselage-hooks';
import type { ComponentProps, ReactElement } from 'react';
import React, { memo, useMemo, useState } from 'react';
import { memo, useMemo, useState } from 'react';
import { useTranslation } from 'react-i18next';

import { useRecordList } from '../hooks/lists/useRecordList';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { CheckOption, PaginatedMultiSelectFiltered } from '@rocket.chat/fuselage
import type { PaginatedMultiSelectOption } from '@rocket.chat/fuselage';
import { useDebouncedValue } from '@rocket.chat/fuselage-hooks';
import type { ComponentProps } from 'react';
import React, { memo, useMemo, useState } from 'react';
import { memo, useMemo, useState } from 'react';
import { useTranslation } from 'react-i18next';

import { useRecordList } from '../hooks/lists/useRecordList';
Expand Down
1 change: 0 additions & 1 deletion apps/meteor/client/components/Backdrop.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import { Modal } from '@rocket.chat/fuselage';
import type { ComponentProps, ReactElement } from 'react';
import React from 'react';

type BackdropProps = ComponentProps<typeof Modal.Backdrop>;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import { Box } from '@rocket.chat/fuselage';
import type { ComponentPropsWithoutRef } from 'react';
import React from 'react';
import { useTranslation } from 'react-i18next';

import GenericModal from './GenericModal';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { ContextualbarV2, Contextualbar as ContextualbarComponent } from '@rocket.chat/fuselage';
import { FeaturePreview, FeaturePreviewOff, FeaturePreviewOn } from '@rocket.chat/ui-client';
import type { ComponentProps } from 'react';
import React, { forwardRef, memo } from 'react';
import { forwardRef, memo } from 'react';

const Contextualbar = forwardRef<HTMLElement, ComponentProps<typeof ContextualbarComponent>>(function Contextualbar(props, ref) {
return (
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { ContextualbarAction as ContextualbarActionComponent, ContextualbarV2Action } from '@rocket.chat/fuselage';
import { FeaturePreview, FeaturePreviewOff, FeaturePreviewOn } from '@rocket.chat/ui-client';
import type { ComponentProps } from 'react';
import React, { memo } from 'react';
import { memo } from 'react';

const ContextualbarAction = (props: ComponentProps<typeof ContextualbarActionComponent>) => (
<FeaturePreview feature='newNavigation'>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { ContextualbarV2Actions, ContextualbarActions as ContextualbarActionsComponent } from '@rocket.chat/fuselage';
import { FeaturePreview, FeaturePreviewOff, FeaturePreviewOn } from '@rocket.chat/ui-client';
import type { ComponentProps } from 'react';
import React, { memo } from 'react';
import { memo } from 'react';

const ContextualbarActions = (props: ComponentProps<typeof ContextualbarActionsComponent>) => (
<FeaturePreview feature='newNavigation'>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import type { ReactElement, ComponentProps } from 'react';
import React, { memo } from 'react';
import { memo } from 'react';
import { useTranslation } from 'react-i18next';

import ContextualbarAction from './ContextualbarAction';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { ContextualbarV2Button, ContextualbarButton as ContextualbarButtonComponent } from '@rocket.chat/fuselage';
import { FeaturePreview, FeaturePreviewOff, FeaturePreviewOn } from '@rocket.chat/ui-client';
import type { ComponentProps } from 'react';
import React, { memo } from 'react';
import { memo } from 'react';

const ContextualbarButton = (props: ComponentProps<typeof ContextualbarButtonComponent>) => (
<FeaturePreview feature='newNavigation'>
Expand Down
Loading
Loading