Skip to content

Commit

Permalink
chore: use new JSX transform
Browse files Browse the repository at this point in the history
Closes #9289

Signed-off-by: Jon Koops <[email protected]>
  • Loading branch information
jonkoops committed Dec 6, 2024
1 parent c1ab963 commit ebcfac4
Show file tree
Hide file tree
Showing 7 changed files with 19 additions and 9 deletions.
2 changes: 1 addition & 1 deletion babel.config.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
module.exports = {
presets: ['@babel/preset-typescript', '@babel/preset-react'],
presets: ['@babel/preset-typescript', ['@babel/preset-react', { runtime: 'automatic' }]],
plugins: ['@babel/plugin-transform-modules-commonjs']
};
17 changes: 15 additions & 2 deletions eslint.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import patternflyReact from 'eslint-plugin-patternfly-react';
import eslintPluginPrettierRecommended from 'eslint-plugin-prettier/recommended';
import reactCompiler from 'eslint-plugin-react-compiler';
import reactHooks from 'eslint-plugin-react-hooks';
import reactRecommended from 'eslint-plugin-react/configs/recommended.js';
import react from 'eslint-plugin-react';
import testingLibrary from 'eslint-plugin-testing-library';
import globals from 'globals';
import tseslint from 'typescript-eslint';
Expand All @@ -23,7 +23,8 @@ export default [
},
js.configs.recommended,
...tseslint.configs.recommended,
reactRecommended,
react.configs.flat.recommended,
react.configs.flat['jsx-runtime'],
eslintPluginPrettierRecommended,
{
plugins: {
Expand Down Expand Up @@ -98,6 +99,18 @@ export default [
'no-eval': 'error',
'no-new-wrappers': 'error',
'no-prototype-builtins': 'off',
'no-restricted-imports': [
'error',
{
paths: [
{
name: 'react',
importNames: ['default'],
message: 'Please use named imports when importing from React.'
}
]
}
],
'no-shadow': 'off',
'no-throw-literal': 'error',
'no-trailing-spaces': 'off',
Expand Down
1 change: 0 additions & 1 deletion packages/react-core/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
{
"extends": "../tsconfig.base.json",
"compilerOptions": {
"jsx": "react",
"rootDir": "./src",
"outDir": "./dist/esm",
"tsBuildInfoFile": "dist/esm.tsbuildinfo",
Expand Down
4 changes: 2 additions & 2 deletions packages/react-icons/scripts/writeIcons.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ export default ${jsName};
};

const writeDTSExport = (fname, jsName, icon) => {
const text = `import * as React from 'react';
const text = `import { ComponentClass } from 'react';
import { SVGIconProps } from '../createIcon';
export declare const ${jsName}Config: {
name: '${jsName}',
Expand All @@ -61,7 +61,7 @@ export declare const ${jsName}Config: {
yOffset: ${icon.yOffset || 0},
xOffset: ${icon.xOffset || 0},
};
export declare const ${jsName}: React.ComponentClass<SVGIconProps>;
export declare const ${jsName}: ComponentClass<SVGIconProps>;
export default ${jsName};
`.trim();
const filename = `${fname}.d.ts`;
Expand Down
1 change: 0 additions & 1 deletion packages/react-integration/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
"noImplicitAny": true,
"module": "es6",
"target": "es5",
"jsx": "react",
"lib": ["dom", "es6"],
"allowJs": true,
"types": ["cypress"]
Expand Down
1 change: 0 additions & 1 deletion packages/react-table/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
{
"extends": "../tsconfig.base.json",
"compilerOptions": {
"jsx": "react",
"rootDir": "./src",
"outDir": "./dist/esm",
"tsBuildInfoFile": "dist/esm.tsbuildinfo",
Expand Down
2 changes: 1 addition & 1 deletion packages/tsconfig.base.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"compilerOptions": {
"assumeChangesOnlyAffectDirectDependencies": true,
"jsx": "react",
"jsx": "react-jsx",
"lib": [
"es2015",
"dom"
Expand Down

0 comments on commit ebcfac4

Please sign in to comment.