diff --git a/.eslintrc.js b/.eslintrc.js index 8db17ed5a8..409b820783 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -49,13 +49,13 @@ module.exports = { "CallExpression[arguments.length=0] > MemberExpression[property.name='toUpperCase']", }, { - message: "Default React import not allowed.", + message: "React default imports are deprecated. Follow the x migration guide for details.", selector: "ImportDeclaration[source.value='react'][specifiers.0.type='ImportDefaultSpecifier']", }, { message: - "Default React import not allowed. If you need a global type that collides with a React named export (such as `MouseEvent`), try using `globalThis.MouseHandler`.", + "React default imports are deprecated. Follow the x migration guide for details. If you need a global type that collides with a React named export (such as `MouseEvent`), try using `globalThis.MouseHandler`.", selector: "ImportDeclaration[source.value='react'] :matches(ImportDefaultSpecifier, ImportNamespaceSpecifier)", }, diff --git a/packages/cli/config/eslint-factory.js b/packages/cli/config/eslint-factory.js index 914979043e..e51fe88db5 100644 --- a/packages/cli/config/eslint-factory.js +++ b/packages/cli/config/eslint-factory.js @@ -246,15 +246,16 @@ function createConfigForRole(dir, role, extraConfig = {}) { rules: { 'react/react-in-jsx-scope': 'off', 'no-restricted-syntax': [ - 'error', + 'warn', { - message: 'Default React import not allowed.', + message: + 'React default imports are deprecated. Follow the x migration guide for details.', selector: "ImportDeclaration[source.value='react'][specifiers.0.type='ImportDefaultSpecifier']", }, { message: - 'Default React import not allowed. If you need a global type that collides with a React named export (such as `MouseEvent`), try using `globalThis.MouseHandler`.', + 'React default imports are deprecated. Follow the x migration guide for details. If you need a global type that collides with a React named export (such as `MouseEvent`), try using `globalThis.MouseHandler`.', selector: "ImportDeclaration[source.value='react'] :matches(ImportDefaultSpecifier, ImportNamespaceSpecifier)", }, diff --git a/packages/cli/config/tsconfig.json b/packages/cli/config/tsconfig.json index 4aa5665b02..ac5e62b52e 100644 --- a/packages/cli/config/tsconfig.json +++ b/packages/cli/config/tsconfig.json @@ -11,7 +11,7 @@ "importHelpers": false, "incremental": true, "isolatedModules": true, - "jsx": "react-jsx", + "jsx": "react", "lib": ["DOM", "DOM.Iterable", "ScriptHost", "ES2022"], "module": "ESNext", "moduleResolution": "node", diff --git a/packages/create-app/templates/default-app/tsconfig.json b/packages/create-app/templates/default-app/tsconfig.json index 2aa745d3a9..eac19c5b92 100644 --- a/packages/create-app/templates/default-app/tsconfig.json +++ b/packages/create-app/templates/default-app/tsconfig.json @@ -11,6 +11,7 @@ "exclude": ["node_modules"], "compilerOptions": { "outDir": "dist-types", - "rootDir": "." + "rootDir": ".", + "jsx": "react-jsx" } } diff --git a/tsconfig.json b/tsconfig.json index 8d72a3315b..26bfcf72e8 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -11,6 +11,7 @@ "compilerOptions": { "outDir": "dist-types", "rootDir": ".", - "useUnknownInCatchVariables": false + "useUnknownInCatchVariables": false, + "jsx": "react-jsx" } }