Skip to content

Commit

Permalink
Use new JSX transform (#56294)
Browse files Browse the repository at this point in the history
Co-authored-by: Jimmy Lai <[email protected]>
Co-authored-by: Jiachi Liu <[email protected]>
  • Loading branch information
3 people authored Dec 8, 2023
1 parent 4dd8c0b commit 79a8d01
Show file tree
Hide file tree
Showing 9 changed files with 9 additions and 18 deletions.
10 changes: 1 addition & 9 deletions .eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -113,14 +113,6 @@
"jsdoc/no-undefined-types": "error"
}
},
{
"files": [
"test/**/*",
"examples/**/*",
"packages/create-next-app/templates/**/*"
],
"rules": { "react/react-in-jsx-scope": "off" }
},
{
"files": ["examples/**/*"],
"rules": {
Expand Down Expand Up @@ -351,7 +343,7 @@
"react/no-direct-mutation-state": "warn",
"react/no-is-mounted": "warn",
"react/no-typos": "error",
"react/react-in-jsx-scope": "error",
"react/react-in-jsx-scope": "off",
"react/require-render-return": "error",
"react/style-prop-object": "warn",
"react-hooks/rules-of-hooks": "error",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
"target": "es2017",
"noUnusedLocals": true,
"noUnusedParameters": true,
"jsx": "react",
"jsx": "react-jsx",
"jsxFactory": "h"
},
"include": ["src", "types/jsx.d.ts"],
Expand Down
2 changes: 1 addition & 1 deletion packages/next/src/build/analysis/get-page-static-info.ts
Original file line number Diff line number Diff line change
Expand Up @@ -484,7 +484,7 @@ export async function getPageStaticInfo(params: {

const fileContent = (await tryToReadFile(pageFilePath, !isDev)) || ''
if (
/runtime|preferredRegion|getStaticProps|getServerSideProps|generateStaticParams|export const/.test(
/(?<!(_jsx|jsx-))runtime|preferredRegion|getStaticProps|getServerSideProps|generateStaticParams|export const/.test(
fileContent
)
) {
Expand Down
1 change: 0 additions & 1 deletion packages/next/src/build/swc/options.ts
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,6 @@ function getBaseSWCOptions({
? '@emotion/react'
: 'react'),
runtime: 'automatic',
pragma: 'React.createElement',
pragmaFrag: 'React.Fragment',
throwIfNamespace: true,
development: !!development,
Expand Down
4 changes: 2 additions & 2 deletions packages/next/taskfile-swc.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ module.exports = function (task) {
},
transform: {
react: {
pragma: 'React.createElement',
runtime: 'automatic',
pragmaFrag: 'React.Fragment',
throwIfNamespace: true,
development: false,
Expand Down Expand Up @@ -102,7 +102,7 @@ module.exports = function (task) {
},
transform: {
react: {
pragma: 'React.createElement',
runtime: 'automatic',
pragmaFrag: 'React.Fragment',
throwIfNamespace: true,
development: false,
Expand Down
2 changes: 1 addition & 1 deletion packages/next/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"target": "ES2017",
"esModuleInterop": true,
"moduleResolution": "node",
"jsx": "react",
"jsx": "react-jsx",
"stripInternal": true,
"verbatimModuleSyntax": true
},
Expand Down
2 changes: 1 addition & 1 deletion packages/react-dev-overlay/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"downlevelIteration": true,
"preserveWatchOutput": true,
"outDir": "dist",
"jsx": "react",
"jsx": "react-jsx",
"noFallthroughCasesInSwitch": true,
"skipLibCheck": true,
"module": "Node16",
Expand Down
2 changes: 1 addition & 1 deletion packages/third-parties/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"esModuleInterop": true,
"target": "es2019",
"outDir": "dist",
"jsx": "react",
"jsx": "react-jsx",
"resolveJsonModule": true,
"module": "commonjs",
"rootDir": "src"
Expand Down
2 changes: 1 addition & 1 deletion tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"noEmit": true,
"allowJs": true,
"resolveJsonModule": true,
"jsx": "react",
"jsx": "react-jsx",
"module": "esnext",
"target": "ESNext",
"esModuleInterop": true,
Expand Down

0 comments on commit 79a8d01

Please sign in to comment.