From 2f3127c46735fba10c2b4fbaae564e565f7d8abf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=80=9CJamesHenry=E2=80=9D?= Date: Mon, 12 Feb 2024 17:04:36 +0400 Subject: [PATCH] chore(core): try and fix failing e2e --- packages/eslint/src/plugins/plugin.ts | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/packages/eslint/src/plugins/plugin.ts b/packages/eslint/src/plugins/plugin.ts index b7181566e8a471..df3dd69c056375 100644 --- a/packages/eslint/src/plugins/plugin.ts +++ b/packages/eslint/src/plugins/plugin.ts @@ -53,23 +53,24 @@ function getProjectsUsingRootESLintConfig( context: CreateNodesContext ): CreateNodesResult['projects'] { const projects: CreateNodesResult['projects'] = {}; + const workspaceFiles = context.workspaceFiles ?? []; // If there's no src folder, it's not a standalone project, so a project.json would be explicitly required to add the root to the mapping const isStandaloneWorkspace = - context.workspaceFiles.some((f) => f.startsWith('src')) && - context.workspaceFiles.includes('package.json'); + workspaceFiles.some((f) => f.startsWith('src')) && + workspaceFiles.includes('package.json'); if (isStandaloneWorkspace) { projects['.'] = { targets: buildEslintTargets([configFilePath], '.', options, true), }; - } else if (context.workspaceFiles.includes('project.json')) { + } else if (workspaceFiles.includes('project.json')) { projects['.'] = { targets: buildEslintTargets([configFilePath], '.', options), }; } // Some nested projects may require a lint target based on this root level config as well (in the case they don't have their own) - const childProjectRoots = context.workspaceFiles + const childProjectRoots = workspaceFiles .filter( (f) => f.includes('/') && @@ -81,9 +82,7 @@ function getProjectsUsingRootESLintConfig( const childProjectsWithoutEslintConfig = childProjectRoots.filter( (childProjectRoot) => !ESLINT_CONFIG_FILENAMES.some((eslintConfigFile) => - context.workspaceFiles.includes( - join(childProjectRoot, eslintConfigFile) - ) + workspaceFiles.includes(join(childProjectRoot, eslintConfigFile)) ) );