From 45cb3ed151a7ff9b9fce3dbd215c4b89475cab6b Mon Sep 17 00:00:00 2001 From: Jack Hsu Date: Wed, 11 Dec 2024 13:23:54 -0500 Subject: [PATCH] fix(react): fix issues with react ts setup --- .../expo/src/generators/library/library.ts | 2 +- .../src/generators/library/library.ts | 2 +- .../src/generators/application/application.ts | 18 +++++++++++++----- .../react/src/generators/library/library.ts | 2 +- 4 files changed, 16 insertions(+), 8 deletions(-) diff --git a/packages/expo/src/generators/library/library.ts b/packages/expo/src/generators/library/library.ts index 83743bf5a6e444..aa158f52f868b2 100644 --- a/packages/expo/src/generators/library/library.ts +++ b/packages/expo/src/generators/library/library.ts @@ -136,7 +136,7 @@ export async function expoLibraryGeneratorInternal( // Always run install to link packages. if (options.isUsingTsSolutionConfig) { - tasks.push(() => installPackagesTask(host)); + tasks.push(() => installPackagesTask(host, true)); } tasks.push(() => { diff --git a/packages/react-native/src/generators/library/library.ts b/packages/react-native/src/generators/library/library.ts index 227cd2d302431d..4e42ac8cbddb02 100644 --- a/packages/react-native/src/generators/library/library.ts +++ b/packages/react-native/src/generators/library/library.ts @@ -136,7 +136,7 @@ export async function reactNativeLibraryGeneratorInternal( // Always run install to link packages. if (options.isUsingTsSolutionConfig) { - tasks.push(() => installPackagesTask(host)); + tasks.push(() => installPackagesTask(host, true)); } tasks.push(() => { diff --git a/packages/react/src/generators/application/application.ts b/packages/react/src/generators/application/application.ts index c9a421896e46a0..88ad5adce58cab 100644 --- a/packages/react/src/generators/application/application.ts +++ b/packages/react/src/generators/application/application.ts @@ -361,11 +361,19 @@ export async function applicationGeneratorInternal( ); } - updateTsconfigFiles(host, options.appProjectRoot, 'tsconfig.app.json', { - jsx: 'react-jsx', - module: 'esnext', - moduleResolution: 'bundler', - }); + updateTsconfigFiles( + host, + options.appProjectRoot, + 'tsconfig.app.json', + { + jsx: 'react-jsx', + module: 'esnext', + moduleResolution: 'bundler', + }, + options.linter === 'eslint' + ? ['eslint.config.js', 'eslint.config.cjs', 'eslint.config.mjs'] + : undefined + ); if (!options.skipFormat) { await formatFiles(host); diff --git a/packages/react/src/generators/library/library.ts b/packages/react/src/generators/library/library.ts index 786c5acd3fcbcc..2e09bb44edbbed 100644 --- a/packages/react/src/generators/library/library.ts +++ b/packages/react/src/generators/library/library.ts @@ -286,7 +286,7 @@ export async function libraryGeneratorInternal(host: Tree, schema: Schema) { // Always run install to link packages. if (options.isUsingTsSolutionConfig) { - tasks.push(() => installPackagesTask(host)); + tasks.push(() => installPackagesTask(host, true)); } tasks.push(() => {