diff --git a/src/main/java/tech/jhipster/lite/generator/client/react/core/domain/ReactCoreModulesFactory.java b/src/main/java/tech/jhipster/lite/generator/client/react/core/domain/ReactCoreModulesFactory.java index 9c05f41dcae..ea27c33aa40 100644 --- a/src/main/java/tech/jhipster/lite/generator/client/react/core/domain/ReactCoreModulesFactory.java +++ b/src/main/java/tech/jhipster/lite/generator/client/react/core/domain/ReactCoreModulesFactory.java @@ -142,7 +142,6 @@ private Consumer patchEslintConfig(JHipsterModuleProperti .add( regex("[ \\t]+quotes: \\['error', 'single', \\{ avoidEscape: true }],"), """ - \t\t\t'react/react-in-jsx-scope': 'off', \t\t\t'@typescript-eslint/no-explicit-any': 'off', \t\t\t'@typescript-eslint/await-thenable': 'off', \t\t\t'@typescript-eslint/consistent-type-imports': 'error', @@ -170,6 +169,7 @@ private Consumer patchTsConfig(JHipsterModuleProperties p .add(tsConfigCompilerOption("composite", false, properties.indentation())) .add(tsConfigCompilerOption("forceConsistentCasingInFileNames", true, properties.indentation())) .add(tsConfigCompilerOption("allowSyntheticDefaultImports", true, properties.indentation())) + .add(tsConfigCompilerOption("jsx", "react", properties.indentation())) .add(text(DEFAULT_TSCONFIG_PATH), pathsReplacement) .and() .and(); @@ -181,6 +181,11 @@ private static MandatoryReplacer tsConfigCompilerOption(String optionName, boole return new MandatoryReplacer(lineAfterRegex("\"compilerOptions\":"), compilerOption); } + private static MandatoryReplacer tsConfigCompilerOption(String optionName, String optionValue, Indentation indentation) { + String compilerOption = indentation.times(2) + "\"%s\": \"%s\",".formatted(optionName, optionValue); + return new MandatoryReplacer(lineAfterRegex("\"compilerOptions\":"), compilerOption); + } + private Consumer patchVitestConfig(JHipsterModuleProperties properties) { //@formatter:off return moduleBuilder -> moduleBuilder diff --git a/src/main/resources/generator/client/react/core/src/main/webapp/app/home/infrastructure/primary/HomePage.tsx.mustache b/src/main/resources/generator/client/react/core/src/main/webapp/app/home/infrastructure/primary/HomePage.tsx.mustache index 48d7c713d6c..3dd2980fb19 100644 --- a/src/main/resources/generator/client/react/core/src/main/webapp/app/home/infrastructure/primary/HomePage.tsx.mustache +++ b/src/main/resources/generator/client/react/core/src/main/webapp/app/home/infrastructure/primary/HomePage.tsx.mustache @@ -1,3 +1,4 @@ +import React from 'react'; import './HomePage.css'; import JHipsterLiteNeonBlue from '@assets/JHipster-Lite-neon-blue.png'; diff --git a/src/main/resources/generator/client/react/core/src/test/webapp/unit/home/infrastructure/primary/HomePage.spec.tsx.mustache b/src/main/resources/generator/client/react/core/src/test/webapp/unit/home/infrastructure/primary/HomePage.spec.tsx.mustache index 00f8eaf4836..ce0fc36d799 100644 --- a/src/main/resources/generator/client/react/core/src/test/webapp/unit/home/infrastructure/primary/HomePage.spec.tsx.mustache +++ b/src/main/resources/generator/client/react/core/src/test/webapp/unit/home/infrastructure/primary/HomePage.spec.tsx.mustache @@ -1,3 +1,4 @@ +import React from 'react'; import { render } from '@testing-library/react'; import { describe, it } from 'vitest'; diff --git a/src/main/resources/generator/client/react/security/jwt/src/main/webapp/app/common/primary/app/LoginApp.tsx.mustache b/src/main/resources/generator/client/react/security/jwt/src/main/webapp/app/common/primary/app/LoginApp.tsx.mustache index e3c68a1b423..abdfecce2db 100644 --- a/src/main/resources/generator/client/react/security/jwt/src/main/webapp/app/common/primary/app/LoginApp.tsx.mustache +++ b/src/main/resources/generator/client/react/security/jwt/src/main/webapp/app/common/primary/app/LoginApp.tsx.mustache @@ -1,3 +1,4 @@ +import React from 'react'; import LoginForm from '@/login/primary/loginForm'; import './HomePage.css'; diff --git a/src/main/resources/generator/client/react/security/jwt/src/main/webapp/app/login/primary/loginForm/index.tsx.mustache b/src/main/resources/generator/client/react/security/jwt/src/main/webapp/app/login/primary/loginForm/index.tsx.mustache index 2bf275fd4a2..c4499a8c7ef 100644 --- a/src/main/resources/generator/client/react/security/jwt/src/main/webapp/app/login/primary/loginForm/index.tsx.mustache +++ b/src/main/resources/generator/client/react/security/jwt/src/main/webapp/app/login/primary/loginForm/index.tsx.mustache @@ -1,5 +1,5 @@ import { Button } from '@nextui-org/react'; -import { createContext, useCallback, useMemo, useState } from 'react'; +import React, { createContext, useCallback, useMemo, useState } from 'react'; import LoginModal from '@/login/primary/loginModal'; diff --git a/src/main/resources/generator/client/react/security/jwt/src/main/webapp/app/login/primary/loginModal/EyeFilledIcon.tsx.mustache b/src/main/resources/generator/client/react/security/jwt/src/main/webapp/app/login/primary/loginModal/EyeFilledIcon.tsx.mustache index f0a2a41c6fc..f77c064c746 100644 --- a/src/main/resources/generator/client/react/security/jwt/src/main/webapp/app/login/primary/loginModal/EyeFilledIcon.tsx.mustache +++ b/src/main/resources/generator/client/react/security/jwt/src/main/webapp/app/login/primary/loginModal/EyeFilledIcon.tsx.mustache @@ -1,3 +1,5 @@ +import React from 'react'; + export const EyeFilledIcon = (props: { className: string }) => (