From aa5ec36526bf817b09345449492d5b9da11c0b93 Mon Sep 17 00:00:00 2001 From: Andrew Bradley Date: Sun, 10 Jul 2022 10:16:13 -0400 Subject: [PATCH] Make --project accept path to directory containing tsconfig, not just path to tsconfig (#1830) * fix #1829 * fix * fix --- src/configuration.ts | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/configuration.ts b/src/configuration.ts index 266f2d920..4ab0a7ccf 100644 --- a/src/configuration.ts +++ b/src/configuration.ts @@ -1,4 +1,4 @@ -import { resolve, dirname } from 'path'; +import { resolve, dirname, join } from 'path'; import type * as _ts from 'typescript'; import { CreateOptions, @@ -167,9 +167,13 @@ export function readConfig( // Read project configuration when available. if (!skipProject) { - configFilePath = project - ? resolve(cwd, project) - : ts.findConfigFile(projectSearchDir, fileExists); + if (project) { + const resolved = resolve(cwd, project); + const nested = join(resolved, 'tsconfig.json'); + configFilePath = fileExists(nested) ? nested : resolved; + } else { + configFilePath = ts.findConfigFile(projectSearchDir, fileExists); + } if (configFilePath) { let pathToNextConfigInChain = configFilePath;