Skip to content

Commit 945f607

Browse files
Update to modern JSX transform (#3097)
## Which problem is this PR solving? - Resolves #3092 ## Description of the changes - The console warnings about "outdated JSX transform" are completely resolved with the configuration changes ## How was this change tested? - Unit tests ## Checklist - [x] I have read https://github.com/jaegertracing/jaeger/blob/master/CONTRIBUTING_GUIDELINES.md - [x] I have signed all commits - [ ] I have added unit tests for the new functionality - [x] I have run lint and test steps successfully - for `jaeger`: `make lint test` - for `jaeger-ui`: `npm run lint` and `npm run test` --------- Signed-off-by: Parship Chowdhury <[email protected]> Co-authored-by: Yuri Shkuro <[email protected]>
1 parent d97ab8b commit 945f607

File tree

4 files changed

+19
-12
lines changed

4 files changed

+19
-12
lines changed

packages/jaeger-ui/test/babel-transform.js

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ const babelJest = require('babel-jest').default;
2121
// Solution: Transform import.meta to process during Jest transformation.
2222
// This allows ESM-only packages to work in Jest's CommonJS test environment.
2323
// Production code is unaffected, this only runs during testing.
24-
const importMetaTransform = function() {
24+
const importMetaTransform = function () {
2525
return {
2626
visitor: {
2727
MetaProperty(path) {
@@ -30,26 +30,29 @@ const importMetaTransform = function() {
3030
if (path.node.meta.name === 'import' && path.node.property.name === 'meta') {
3131
path.replaceWithSourceString('process');
3232
}
33-
}
34-
}
33+
},
34+
},
3535
};
3636
};
3737

3838
const babelConfiguration = {
3939
presets: [
40-
['@babel/preset-env', {
41-
targets: { node: 'current' },
42-
modules: 'commonjs'
43-
}],
44-
['@babel/preset-react', { development: !process.env.CI }],
40+
[
41+
'@babel/preset-env',
42+
{
43+
targets: { node: 'current' },
44+
modules: 'commonjs',
45+
},
46+
],
47+
['@babel/preset-react', { development: !process.env.CI, runtime: 'automatic' }],
4548
'@babel/preset-typescript',
4649
],
4750
plugins: [
4851
'babel-plugin-inline-react-svg',
4952
['@babel/plugin-transform-modules-commonjs', { allowTopLevelThis: true }],
50-
importMetaTransform
53+
importMetaTransform,
5154
],
52-
}
55+
};
5356

5457
// Export configuration for depcheck (without the function)
5558
const babelConfigurationForDepcheck = {
@@ -59,7 +62,7 @@ const babelConfigurationForDepcheck = {
5962
['@babel/plugin-transform-modules-commonjs', { allowTopLevelThis: true }],
6063
// Note: custom function plugins are excluded for depcheck compatibility
6164
],
62-
}
65+
};
6366

6467
module.exports = babelJest.createTransformer(babelConfiguration);
6568
module.exports.babelConfiguration = babelConfiguration;

packages/jaeger-ui/tsconfig.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,5 +13,8 @@
1313
// limitations under the License.
1414
{
1515
"extends": "../../tsconfig",
16+
"compilerOptions": {
17+
"jsx": "react-jsx"
18+
},
1619
"include": ["src/**/*.tsx", "src/**/*.ts", "src/**/*.json", "typings"]
1720
}

packages/plexus/babel.config.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ function getBabelConfig(api) {
4343
{
4444
development: env === 'development',
4545
useBuiltIns: true,
46+
runtime: 'automatic',
4647
},
4748
],
4849
'@babel/preset-typescript',

tsconfig.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
"isolatedModules": true,
1616
"declaration": true,
1717
"emitDeclarationOnly": true,
18-
"jsx": "preserve"
18+
"jsx": "react-jsx"
1919
},
2020
"include": [],
2121
"files": [],

0 commit comments

Comments
 (0)