Skip to content

Commit

Permalink
feat: migrate to new JSX transform (#2006)
Browse files Browse the repository at this point in the history
Co-authored-by: Andrey Morozov <[email protected]>
  • Loading branch information
u4aew and amje authored Dec 25, 2024
1 parent 44d0775 commit 300a013
Show file tree
Hide file tree
Showing 527 changed files with 369 additions and 697 deletions.
9 changes: 7 additions & 2 deletions .babelrc
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,12 @@
}
],
"@babel/preset-typescript",
"@babel/preset-react"
[
"@babel/preset-react",
{
"runtime": "automatic"
}
]
],
"plugins": []
}
}
7 changes: 4 additions & 3 deletions .eslintrc
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@
"@gravity-ui/eslint-config/client",
"@gravity-ui/eslint-config/prettier",
"@gravity-ui/eslint-config/import-order",
"@gravity-ui/eslint-config/a11y"
"@gravity-ui/eslint-config/a11y",
"plugin:react/jsx-runtime"
],
"root": true,
"rules": {
Expand All @@ -15,8 +16,8 @@
"no-restricted-syntax": [
"error",
{
"selector": "ImportDeclaration[source.value='react'] :matches(ImportNamespaceSpecifier, ImportSpecifier)",
"message": "Please use import React from 'react' instead."
"selector": "ImportDeclaration[source.value='react'] :matches(ImportDefaultSpecifier, ImportSpecifier)",
"message": "Please use `import * as React from 'react'` instead."
},
{
"selector": "TSTypeReference>TSQualifiedName[left.name='React'][right.name='FC']",
Expand Down
2 changes: 0 additions & 2 deletions .storybook/decorators/withLang.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import React from 'react';

import type {Decorator} from '@storybook/react';

import {configure} from '../../src';
Expand Down
2 changes: 0 additions & 2 deletions .storybook/decorators/withMobile.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import React from 'react';

import type {Decorator} from '@storybook/react';

import {MobileProvider} from '../../src';
Expand Down
2 changes: 1 addition & 1 deletion .storybook/decorators/withStrictMode.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React from 'react';
import * as React from 'react';

import type {Decorator} from '@storybook/react';

Expand Down
2 changes: 0 additions & 2 deletions .storybook/decorators/withTheme.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import React from 'react';

import type {Decorator} from '@storybook/react';

import {ThemeProvider} from '../../src';
Expand Down
2 changes: 1 addition & 1 deletion .storybook/theme-addon/register.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React from 'react';
import * as React from 'react';

import type {API} from '@storybook/manager-api';
import {addons, types, useGlobals} from '@storybook/manager-api';
Expand Down
2 changes: 0 additions & 2 deletions playwright/core/mountFixture.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import React from 'react';

import type {MountFixture, PlaywrightFixture} from './types';

export const mountFixture: PlaywrightFixture<MountFixture> = async ({mount: baseMount}, use) => {
Expand Down
2 changes: 1 addition & 1 deletion playwright/core/types.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type React from 'react';
import type * as React from 'react';

import type {MountOptions, MountResult} from '@playwright/experimental-ct-react';
import type {
Expand Down
2 changes: 0 additions & 2 deletions playwright/playwright/index.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import React from 'react';

import {beforeMount} from '@playwright/experimental-ct-react/hooks';

import {ToasterProvider} from '../../src/components/Toaster';
Expand Down
2 changes: 1 addition & 1 deletion src/components/ActionTooltip/ActionTooltip.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
'use client';

import React from 'react';
import * as React from 'react';

import {useForkRef} from '../../hooks';
import {useTooltipVisible} from '../../hooks/private';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import React from 'react';

import type {StoryFn} from '@storybook/react';

import {Button} from '../../Button';
Expand Down
2 changes: 0 additions & 2 deletions src/components/ActionTooltip/__tests__/ActionTooltip.test.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import React from 'react';

import userEvent from '@testing-library/user-event';

import {createEvent, fireEvent, render, screen} from '../../../../test-utils/utils';
Expand Down
2 changes: 0 additions & 2 deletions src/components/ActionsPanel/ActionsPanel.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
'use client';

import React from 'react';

import {Xmark} from '@gravity-ui/icons';

import {Button} from '../Button';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import React from 'react';

import type {Meta, StoryObj} from '@storybook/react';

import {ActionsPanel} from '../../ActionsPanel';
Expand Down
2 changes: 0 additions & 2 deletions src/components/ActionsPanel/__stories__/actions.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import React from 'react';

import {ChevronDown, Files, PencilToSquare, TrashBin} from '@gravity-ui/icons';

import type {ActionsPanelProps} from '../../ActionsPanel';
Expand Down
2 changes: 1 addition & 1 deletion src/components/ActionsPanel/components/CollapseActions.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
'use client';

import React from 'react';
import * as React from 'react';

import {Ellipsis} from '@gravity-ui/icons';

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
'use client';

import React from 'react';
import * as React from 'react';

import type {ActionsPanelItem} from '../../types';

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
'use client';

import React from 'react';
import * as React from 'react';

import {useDirection} from '../../../theme';

Expand Down
2 changes: 0 additions & 2 deletions src/components/Alert/Alert.test.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import React from 'react';

import userEvent from '@testing-library/user-event';

import {render, screen} from '../../../test-utils/utils';
Expand Down
2 changes: 0 additions & 2 deletions src/components/Alert/Alert.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import React from 'react';

import {Xmark} from '@gravity-ui/icons';

import {Button} from '../Button';
Expand Down
2 changes: 0 additions & 2 deletions src/components/Alert/AlertAction.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
'use client';

import React from 'react';

import {Button} from '../Button';

import type {AlertActionProps} from './types';
Expand Down
2 changes: 0 additions & 2 deletions src/components/Alert/AlertActions.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
'use client';

import React from 'react';

import {Flex} from '../layout';

import {AlertAction} from './AlertAction';
Expand Down
2 changes: 1 addition & 1 deletion src/components/Alert/AlertContext.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React from 'react';
import * as React from 'react';

import type {AlertContextType} from './types';

Expand Down
2 changes: 0 additions & 2 deletions src/components/Alert/AlertContextProvider.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
'use client';

import React from 'react';

import {AlertContext} from './AlertContext';
import type {AlertContextProviderProps} from './types';

Expand Down
2 changes: 1 addition & 1 deletion src/components/Alert/AlertIcon.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React from 'react';
import type * as React from 'react';

import {
CircleCheck,
Expand Down
2 changes: 0 additions & 2 deletions src/components/Alert/AlertTitle.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import React from 'react';

import {Text} from '../Text';

import {bAlert} from './constants';
Expand Down
2 changes: 0 additions & 2 deletions src/components/Alert/__stories__/Alert.stories.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import React from 'react';

import {Gear} from '@gravity-ui/icons';
import {action} from '@storybook/addon-actions';
import type {Meta, StoryObj} from '@storybook/react';
Expand Down
2 changes: 0 additions & 2 deletions src/components/Alert/__tests__/Alert.visual.test.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import React from 'react';

import {smokeTest, test} from '~playwright/core';

import {createSmokeScenarios} from '../../../stories/tests-factory/create-smoke-scenarios';
Expand Down
2 changes: 0 additions & 2 deletions src/components/Alert/__tests__/cases.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import React from 'react';

import type {Cases, CasesWithName} from '../../../stories/tests-factory/models';
import {Alert} from '../Alert';
import type {AlertProps} from '../types';
Expand Down
2 changes: 1 addition & 1 deletion src/components/Alert/types.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type React from 'react';
import type * as React from 'react';

import type {ButtonProps} from '../Button';
import type {QAProps} from '../types';
Expand Down
2 changes: 1 addition & 1 deletion src/components/Alert/useAlertContext.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
'use client';

import React from 'react';
import * as React from 'react';

import {AlertContext} from './AlertContext';

Expand Down
2 changes: 0 additions & 2 deletions src/components/ArrowToggle/ArrowToggle.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import React from 'react';

import {ChevronDown} from '@gravity-ui/icons';

import {Icon} from '../Icon';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import React from 'react';

import type {Meta, StoryFn} from '@storybook/react';

import {ArrowToggle} from '../ArrowToggle';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React from 'react';
import * as React from 'react';

import type {Meta, StoryFn} from '@storybook/react';

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React from 'react';
import * as React from 'react';

import {DocsExample} from '../../../../demo/DocsExample/DocsExample';
import {Button} from '../../../Button';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import React from 'react';

import {smokeTest, test} from '~playwright/core';

import {createSmokeScenarios} from '../../../stories/tests-factory/create-smoke-scenarios';
Expand Down
2 changes: 1 addition & 1 deletion src/components/Avatar/Avatar.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React from 'react';
import * as React from 'react';

import {block} from '../utils/cn';

Expand Down
2 changes: 0 additions & 2 deletions src/components/Avatar/AvatarIcon/AvatarIcon.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import React from 'react';

import {Icon} from '../../Icon';
import type {AvatarSize} from '../types/common';

Expand Down
2 changes: 1 addition & 1 deletion src/components/Avatar/AvatarImage/AvatarImage.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
'use client';

import React from 'react';
import * as React from 'react';

import {AVATAR_SIZES} from '../constants';

Expand Down
2 changes: 0 additions & 2 deletions src/components/Avatar/AvatarText/AvatarText.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import React from 'react';

import type {AvatarTextProps} from './types';
import {getAvatarDisplayText} from './utils';

Expand Down
2 changes: 1 addition & 1 deletion src/components/Avatar/__stories__/Avatar.stories.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React from 'react';
import * as React from 'react';

import {faker} from '@faker-js/faker/locale/en';
import {FaceRobot} from '@gravity-ui/icons';
Expand Down
2 changes: 0 additions & 2 deletions src/components/Avatar/__tests__/Avatar.visual.test.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import React from 'react';

import {expect} from '@playwright/experimental-ct-react';

import {test} from '~playwright/core';
Expand Down
2 changes: 1 addition & 1 deletion src/components/AvatarStack/AvatarStack.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React from 'react';
import * as React from 'react';

import {block} from '../utils/cn';

Expand Down
2 changes: 1 addition & 1 deletion src/components/AvatarStack/AvatarStackItem.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React from 'react';
import type * as React from 'react';

import {block} from '../utils/cn';

Expand Down
2 changes: 1 addition & 1 deletion src/components/AvatarStack/AvatarStackMore.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React from 'react';
import * as React from 'react';

import {DEFAULT_AVATAR_SIZE} from '../Avatar';
import {block} from '../utils/cn';
Expand Down
2 changes: 1 addition & 1 deletion src/components/AvatarStack/AvatarStackMoreButton.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React from 'react';
import * as React from 'react';

import {DEFAULT_AVATAR_SIZE} from '../Avatar';
import {block} from '../utils/cn';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React from 'react';
import type * as React from 'react';

import {faker} from '@faker-js/faker/locale/en';
import type {Meta, StoryObj} from '@storybook/react';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import React from 'react';

import {test} from '~playwright/core';

import {AvatarStackStories} from './stories';
Expand Down
2 changes: 1 addition & 1 deletion src/components/AvatarStack/types.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type React from 'react';
import type * as React from 'react';

import type {AvatarSize} from '../Avatar';

Expand Down
2 changes: 1 addition & 1 deletion src/components/Breadcrumbs/Breadcrumbs.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
'use client';

import React from 'react';
import * as React from 'react';

import _throttle from 'lodash/throttle';

Expand Down
2 changes: 1 addition & 1 deletion src/components/Breadcrumbs/BreadcrumbsButton.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React from 'react';
import type * as React from 'react';

import {block} from '../utils/cn';

Expand Down
2 changes: 1 addition & 1 deletion src/components/Breadcrumbs/BreadcrumbsItem.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
'use client';

import React from 'react';
import * as React from 'react';

import {Link} from '../Link';
import {block} from '../utils/cn';
Expand Down
2 changes: 0 additions & 2 deletions src/components/Breadcrumbs/BreadcrumbsMore.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
'use client';

import React from 'react';

import {DropdownMenu} from '../DropdownMenu';
import {block} from '../utils/cn';

Expand Down
2 changes: 0 additions & 2 deletions src/components/Breadcrumbs/BreadcrumbsSeparator.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import React from 'react';

import {block} from '../utils/cn';

import type {BreadcrumbsProps} from './Breadcrumbs';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import React from 'react';

import type {StoryFn} from '@storybook/react';

import {Breadcrumbs} from '../Breadcrumbs';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React from 'react';
import * as React from 'react';

import {cn} from '../../utils/cn';
import {Breadcrumbs} from '../Breadcrumbs';
Expand Down
2 changes: 0 additions & 2 deletions src/components/Breadcrumbs/__tests__/Breadcrumbs.test.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import React from 'react';

import {render, screen} from '../../../../test-utils/utils';
import {Breadcrumbs} from '../Breadcrumbs';

Expand Down
Loading

0 comments on commit 300a013

Please sign in to comment.