From f38db751b0908fd2eaab57a23cf4fc89337e1c55 Mon Sep 17 00:00:00 2001 From: Jack Hsu Date: Fri, 6 Sep 2024 16:44:58 -0400 Subject: [PATCH] fix(misc): add back rootProject to e2e project for root project --- packages/cypress/src/utils/add-linter.ts | 3 +++ packages/eslint/src/generators/utils/eslint-file.ts | 6 ++++-- packages/playwright/src/utils/add-linter.ts | 3 +++ 3 files changed, 10 insertions(+), 2 deletions(-) diff --git a/packages/cypress/src/utils/add-linter.ts b/packages/cypress/src/utils/add-linter.ts index 29c4c490c6e317..082dc9d0e627c8 100644 --- a/packages/cypress/src/utils/add-linter.ts +++ b/packages/cypress/src/utils/add-linter.ts @@ -65,6 +65,7 @@ export async function addLinterToCyProject( tsConfigPaths: [joinPathFragments(projectConfig.root, 'tsconfig.json')], setParserOptionsProject: options.setParserOptionsProject, skipPackageJson: options.skipPackageJson, + rootProject: options.rootProject, addPlugin: options.addPlugin, }) ); @@ -98,8 +99,10 @@ export async function addLinterToCyProject( 'recommended', 'cypress', 'eslint-plugin-cypress/flat', + false, false ); + addOverrideToLintConfig(tree, projectConfig.root, { rules: {} }); } else { if (options.rootProject) { addPluginsToLintConfig(tree, projectConfig.root, '@nx'); diff --git a/packages/eslint/src/generators/utils/eslint-file.ts b/packages/eslint/src/generators/utils/eslint-file.ts index 656a01e6b64f16..88a07b195628b7 100644 --- a/packages/eslint/src/generators/utils/eslint-file.ts +++ b/packages/eslint/src/generators/utils/eslint-file.ts @@ -421,7 +421,8 @@ export function addPredefinedConfigToFlatLintConfig( predefinedConfigName: string, moduleName = 'nx', moduleImportPath = '@nx/eslint-plugin', - spread = true + spread = true, + insertAtTheEnd = true ): void { if (!useFlatConfig(tree)) throw new Error('Predefined configs can only be used with flat configs'); @@ -435,7 +436,8 @@ export function addPredefinedConfigToFlatLintConfig( content = addImportToFlatConfig(content, moduleName, moduleImportPath); content = addBlockToFlatConfigExport( content, - generateFlatPredefinedConfig(predefinedConfigName, moduleName, spread) + generateFlatPredefinedConfig(predefinedConfigName, moduleName, spread), + { insertAtTheEnd } ); tree.write(fileName, content); diff --git a/packages/playwright/src/utils/add-linter.ts b/packages/playwright/src/utils/add-linter.ts index f0775d8f60048f..c266a1053fdfd4 100644 --- a/packages/playwright/src/utils/add-linter.ts +++ b/packages/playwright/src/utils/add-linter.ts @@ -54,6 +54,7 @@ export async function addLinterToPlaywrightProject( tsConfigPaths: [joinPathFragments(projectConfig.root, 'tsconfig.json')], setParserOptionsProject: options.setParserOptionsProject, skipPackageJson: options.skipPackageJson, + rootProject: options.rootProject, addPlugin: options.addPlugin, }) ); @@ -84,8 +85,10 @@ export async function addLinterToPlaywrightProject( 'flat/recommended', 'playwright', 'eslint-plugin-playwright', + false, false ); + addOverrideToLintConfig(tree, projectConfig.root, { rules: {} }); } else { const addExtendsTask = addExtendsToLintConfig( tree,