Skip to content

Commit 7dcad64

Browse files
fix: use new JSX transform in preparation for React 19 (#5837)
1 parent 72a7055 commit 7dcad64

File tree

136 files changed

+152
-250
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

136 files changed

+152
-250
lines changed

.eslintrc.yml

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ env:
1010
es2022: true
1111
extends:
1212
- plugin:react/recommended
13+
- plugin:react/jsx-runtime
1314
- plugin:react-hooks/recommended
1415
- plugin:import/recommended
1516
- plugin:prettier/recommended
@@ -112,8 +113,6 @@ overrides:
112113

113114
- files:
114115
- 'cypress/**/*'
115-
extends:
116-
- 'plugin:react/jsx-runtime'
117116
rules:
118117
'@typescript-eslint/no-namespace': 'off'
119118

@@ -124,7 +123,6 @@ overrides:
124123
- no-only-tests
125124
rules:
126125
'@typescript-eslint/no-empty-function': 'off'
127-
'react/react-in-jsx-scope': 'off'
128126
'import/order': 'warn'
129127
'import/no-unresolved': 'off'
130128
'react/no-unescaped-entities': 'off'
@@ -135,7 +133,6 @@ overrides:
135133
- files:
136134
- '*.stories.tsx'
137135
extends:
138-
- 'plugin:react/jsx-runtime'
139136
- 'plugin:storybook/recommended'
140137
rules:
141138
'react/prop-types': 'off' # inline custom components within stories don't need prop types

.storybook/components/ArgTypesWithNote.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { ArgTypes } from '@storybook/blocks';
22
import { MessageStrip, MessageStripDesign } from '@ui5/webcomponents-react';
3-
import React, { ComponentProps, ReactNode } from 'react';
3+
import { ComponentProps, ReactNode } from 'react';
44
import classes from './ArgTypesWithNote.module.css';
55

66
interface ArgTypesWithNotePropTypes {

.storybook/components/ControlsWithNote.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { Controls } from '@storybook/blocks';
22
import { MessageStrip, MessageStripDesign } from '@ui5/webcomponents-react';
3-
import React, { ComponentProps, ReactNode } from 'react';
3+
import { ComponentProps, ReactNode } from 'react';
44
import classes from './ControlsWithNote.module.css';
55
import { DomRefTable } from './DomRefTable';
66

.storybook/components/DocsHeader.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import {
1111
ThemeProvider
1212
} from '@ui5/webcomponents-react';
1313
import { clsx } from 'clsx';
14-
import React, { useContext } from 'react';
14+
import { useContext } from 'react';
1515
import { useGetSubComponentsOfModule } from '../utils';
1616
import classes from './DocsHeader.module.css';
1717
import { GitHubLogo } from './GitHub-Mark';

.storybook/components/Footer.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import {
1111
PopoverPlacementType,
1212
WrappingType
1313
} from '@ui5/webcomponents-react';
14-
import React, { useRef } from 'react';
14+
import { useRef } from 'react';
1515
import { createPortal } from 'react-dom';
1616
import BestRunLogo from '../../assets/SAP_Best_R_grad_blk_scrn.png';
1717
import classes from './Footer.module.css';

.storybook/components/GitHub-Mark.tsx

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
import React from 'react';
2-
31
export const GitHubLogo = () => (
42
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32.58 31.77" style={{ height: '1.75rem' }}>
53
<g id="Layer_2" data-name="Layer 2">

.storybook/components/Import.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { DocsContext } from '@storybook/addon-docs';
2-
import React, { useContext } from 'react';
2+
import { Fragment, useContext } from 'react';
33
import { useGetCem, useGetSubComponentsOfModule } from '../utils';
44

55
interface ImportStatementPropTypes {
@@ -39,11 +39,11 @@ export const ImportStatement = ({ moduleNames, packageName }: ImportStatementPro
3939
<>
4040
{moduleNames.map((item) => {
4141
return (
42-
<React.Fragment key={item}>
42+
<Fragment key={item}>
4343
<br />
4444
&nbsp;&nbsp;
4545
{item},
46-
</React.Fragment>
46+
</Fragment>
4747
);
4848
})}
4949
<br />

.storybook/components/LabelWithWrapping.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import { Label, WrappingType } from '@ui5/webcomponents-react';
2-
import React from 'react';
32

43
//mdx adds a paragraph to children if added inline, this component prevents that.
54
export const LabelWithWrapping = ({ children }) => {

.storybook/components/ProductsTable.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ import {
88
TableRow,
99
Text
1010
} from '@ui5/webcomponents-react';
11-
import React from 'react';
1211
import { ProductCollection } from './products.json';
1312

1413
export const ProductsTable = () => {

.storybook/components/SplitterElementContent.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import { FlexBox, Text } from '@ui5/webcomponents-react';
2-
import React from 'react';
32

43
export const SplitterElementContent = ({ text, background = 'transparent' }) => (
54
<FlexBox style={{ height: '100%', width: '100%', background }} alignItems="Center" justifyContent="Center">

babel.config.cjs

Lines changed: 0 additions & 26 deletions
This file was deleted.

docs/knowledge-base/SsrLimitations.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import * as React from 'react';
21
import { MessageStrip, MessageStripDesign } from '@ui5/webcomponents-react';
32

43
export function SsrLimitations() {

docs/knowledgeBaseExamples/ThemeableThemingParameters.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { getTheme, setTheme } from '@ui5/webcomponents-base/dist/config/Theme.js';
2-
import React, { useEffect, useReducer, useState } from 'react';
2+
import { useEffect, useReducer, useState } from 'react';
33
import type { CSSProperties } from 'react';
44
import { MAPPED_THEMES } from '../../.storybook/utils';
55
import { FlexBox, FlexBoxDirection, Label, Option, Panel, Select, Text, ThemeProvider } from '@ui5/webcomponents-react';

docs/knowledgeBaseExamples/formExamples.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import React, { useState } from 'react';
1+
import { useState } from 'react';
22
import {
33
ThemeProvider,
44
Form,

docs/knowledgeBaseExamples/slotExamples.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1+
/* eslint-disable react/prop-types */
12
import { Bar, Button } from '@ui5/webcomponents-react';
2-
import React from 'react';
33

44
const FaultyBarStart = () => {
55
return <div>Start</div>;
@@ -10,7 +10,7 @@ const FaultyBarEnd = () => {
1010
export const FaultyBarComponent = () => {
1111
return (
1212
<Bar startContent={<FaultyBarStart />} endContent={<FaultyBarEnd />}>
13-
<div>I'm not a custom component</div>
13+
<div>Not a custom component</div>
1414
</Bar>
1515
);
1616
};
@@ -24,7 +24,7 @@ const BarEnd = (props) => {
2424
export const BarComponent = () => {
2525
return (
2626
<Bar startContent={<BarStart />} endContent={<BarEnd />}>
27-
<div>I'm not a custom component</div>
27+
<div>Not a custom component</div>
2828
</Bar>
2929
);
3030
};

docs/styling/MyCustomElement.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import React from 'react';
21
import { ThemingParameters } from '@ui5/webcomponents-react-base';
32
import './MyCustomElement.css';
43

examples/remix-ts/.eslintrc.cjs

Lines changed: 36 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -8,77 +8,73 @@
88
module.exports = {
99
root: true,
1010
parserOptions: {
11-
ecmaVersion: "latest",
12-
sourceType: "module",
11+
ecmaVersion: 'latest',
12+
sourceType: 'module',
1313
ecmaFeatures: {
14-
jsx: true,
15-
},
14+
jsx: true
15+
}
1616
},
1717
env: {
1818
browser: true,
1919
commonjs: true,
20-
es6: true,
20+
es6: true
2121
},
22-
ignorePatterns: ["!**/.server", "!**/.client"],
22+
ignorePatterns: ['!**/.server', '!**/.client'],
2323

2424
// Base config
25-
extends: ["eslint:recommended"],
25+
extends: ['eslint:recommended'],
2626

2727
overrides: [
2828
// React
2929
{
30-
files: ["**/*.{js,jsx,ts,tsx}"],
31-
plugins: ["react", "jsx-a11y"],
30+
files: ['**/*.{js,jsx,ts,tsx}'],
31+
plugins: ['react', 'jsx-a11y'],
3232
extends: [
33-
"plugin:react/recommended",
34-
"plugin:react/jsx-runtime",
35-
"plugin:react-hooks/recommended",
36-
"plugin:jsx-a11y/recommended",
33+
'plugin:react/recommended',
34+
'plugin:react/jsx-runtime',
35+
'plugin:react-hooks/recommended',
36+
'plugin:jsx-a11y/recommended'
3737
],
3838
settings: {
3939
react: {
40-
version: "detect",
40+
version: 'detect'
4141
},
42-
formComponents: ["Form"],
42+
formComponents: ['Form'],
4343
linkComponents: [
44-
{ name: "Link", linkAttribute: "to" },
45-
{ name: "NavLink", linkAttribute: "to" },
44+
{ name: 'Link', linkAttribute: 'to' },
45+
{ name: 'NavLink', linkAttribute: 'to' }
4646
],
47-
"import/resolver": {
48-
typescript: {},
49-
},
50-
},
47+
'import/resolver': {
48+
typescript: {}
49+
}
50+
}
5151
},
5252

5353
// Typescript
5454
{
55-
files: ["**/*.{ts,tsx}"],
56-
plugins: ["@typescript-eslint", "import"],
57-
parser: "@typescript-eslint/parser",
55+
files: ['**/*.{ts,tsx}'],
56+
plugins: ['@typescript-eslint', 'import'],
57+
parser: '@typescript-eslint/parser',
5858
settings: {
59-
"import/internal-regex": "^~/",
60-
"import/resolver": {
59+
'import/internal-regex': '^~/',
60+
'import/resolver': {
6161
node: {
62-
extensions: [".ts", ".tsx"],
62+
extensions: ['.ts', '.tsx']
6363
},
6464
typescript: {
65-
alwaysTryTypes: true,
66-
},
67-
},
65+
alwaysTryTypes: true
66+
}
67+
}
6868
},
69-
extends: [
70-
"plugin:@typescript-eslint/recommended",
71-
"plugin:import/recommended",
72-
"plugin:import/typescript",
73-
],
69+
extends: ['plugin:@typescript-eslint/recommended', 'plugin:import/recommended', 'plugin:import/typescript']
7470
},
7571

7672
// Node
7773
{
78-
files: [".eslintrc.cjs"],
74+
files: ['.eslintrc.cjs'],
7975
env: {
80-
node: true,
81-
},
82-
},
83-
],
76+
node: true
77+
}
78+
}
79+
]
8480
};

examples/remix-ts/vite.config.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
import { vitePlugin as remix } from "@remix-run/dev";
2-
import { installGlobals } from "@remix-run/node";
3-
import { defineConfig } from "vite";
4-
import tsconfigPaths from "vite-tsconfig-paths";
1+
import { vitePlugin as remix } from '@remix-run/dev';
2+
import { installGlobals } from '@remix-run/node';
3+
import { defineConfig } from 'vite';
4+
import tsconfigPaths from 'vite-tsconfig-paths';
55

66
installGlobals();
77

88
export default defineConfig({
9-
plugins: [remix(), tsconfigPaths()],
9+
plugins: [remix(), tsconfigPaths()]
1010
});

packages/base/src/Device/Media.cy.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import React, { useEffect, useState } from 'react';
1+
import { useEffect, useState } from 'react';
22
import { MediaEventProvider } from './EventProvider';
33
import { attachMediaHandler, detachMediaHandler, getCurrentRange } from './Media';
44

packages/charts/src/components/BarChart/BarChart.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
import { enrichEventWithDetails, ThemingParameters, useIsRTL, useSyncRef } from '@ui5/webcomponents-react-base';
44
import type { CSSProperties } from 'react';
5-
import React, { forwardRef, useCallback } from 'react';
5+
import { forwardRef, useCallback } from 'react';
66
import {
77
Bar,
88
BarChart as BarChartLib,

packages/charts/src/components/BarChart/Placeholder.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import { ThemingParameters } from '@ui5/webcomponents-react-base';
2-
import React from 'react';
32
import ContentLoader from 'react-content-loader';
43

54
export const BarChartPlaceholder = () => {

packages/charts/src/components/BulletChart/BulletChart.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
import { enrichEventWithDetails, ThemingParameters, useIsRTL, useSyncRef } from '@ui5/webcomponents-react-base';
44
import type { CSSProperties } from 'react';
5-
import React, { forwardRef, useCallback, useMemo } from 'react';
5+
import { forwardRef, useCallback, useMemo } from 'react';
66
import {
77
Bar,
88
Brush,

packages/charts/src/components/BulletChart/ComparisonLine.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import type { CSSProperties } from 'react';
2-
import React from 'react';
32

43
interface ComparisonLine {
54
x?: number;

packages/charts/src/components/BulletChart/Placeholder.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import { ThemingParameters } from '@ui5/webcomponents-react-base';
2-
import React from 'react';
32
import ContentLoader from 'react-content-loader';
43
import type { IChartMeasure } from '../../interfaces/IChartMeasure.js';
54

packages/charts/src/components/ColumnChart/ColumnChart.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
import { enrichEventWithDetails, ThemingParameters, useIsRTL, useSyncRef } from '@ui5/webcomponents-react-base';
44
import type { CSSProperties } from 'react';
5-
import React, { forwardRef, useCallback } from 'react';
5+
import { forwardRef, useCallback } from 'react';
66
import {
77
Bar as Column,
88
BarChart as ColumnChartLib,

packages/charts/src/components/ColumnChart/Placeholder.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import { ThemingParameters } from '@ui5/webcomponents-react-base';
2-
import React from 'react';
32
import ContentLoader from 'react-content-loader';
43

54
export const ColumnChartPlaceholder = (props) => {

packages/charts/src/components/ColumnChartWithTrend/ColumnChartWithTrend.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
import { ThemingParameters, useIsomorphicId } from '@ui5/webcomponents-react-base';
44
import type { CSSProperties } from 'react';
5-
import React, { forwardRef } from 'react';
5+
import { forwardRef } from 'react';
66
import type { TooltipProps, YAxisProps } from 'recharts';
77
import { useLongestYAxisLabel } from '../../hooks/useLongestYAxisLabel.js';
88
import { usePrepareDimensionsAndMeasures } from '../../hooks/usePrepareDimensionsAndMeasures.js';

packages/charts/src/components/ColumnChartWithTrend/Placeholder.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import { ThemingParameters } from '@ui5/webcomponents-react-base';
2-
import React from 'react';
32
import ContentLoader from 'react-content-loader';
43

54
export const ColumnChartWithTrendPlaceholder = (props) => {

packages/charts/src/components/ComposedChart/Placeholder.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import { ThemingParameters } from '@ui5/webcomponents-react-base';
2-
import React from 'react';
32
import ContentLoader from 'react-content-loader';
43
import type { IChartMeasure } from '../../interfaces/IChartMeasure.js';
54

0 commit comments

Comments
 (0)