Skip to content

Commit eb35630

Browse files
Refactor --showConfig to write output then issue diagnostics
Co-authored-by: RyanCavanaugh <[email protected]>
1 parent f1c7d72 commit eb35630

1 file changed

Lines changed: 4 additions & 7 deletions

File tree

src/compiler/executeCommandLine.ts

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -639,20 +639,17 @@ function executeCommandLineWorker(
639639
const extendedConfigCache = new Map<string, ExtendedConfigCacheEntry>();
640640
const configParseResult = parseConfigFileWithSystem(configFileName, commandLineOptions, extendedConfigCache, commandLine.watchOptions, sys, reportDiagnostic)!; // TODO: GH#18217
641641
if (commandLineOptions.showConfig) {
642-
// For --showConfig, filter out "no inputs found" errors since the purpose is to show configuration, not compile
643-
const errorsExcludingNoInputs = configParseResult.errors.filter(error => error.code !== Diagnostics.No_inputs_were_found_in_config_file_0_Specified_include_paths_were_1_and_exclude_paths_were_2.code);
644-
645-
if (errorsExcludingNoInputs.length !== 0) {
642+
// eslint-disable-next-line no-restricted-syntax
643+
sys.write(JSON.stringify(convertToTSConfig(configParseResult, configFileName, sys), null, 4) + sys.newLine);
644+
if (configParseResult.errors.length !== 0) {
646645
reportDiagnostic = updateReportDiagnostic(
647646
sys,
648647
reportDiagnostic,
649648
configParseResult.options,
650649
);
651-
errorsExcludingNoInputs.forEach(reportDiagnostic);
650+
configParseResult.errors.forEach(reportDiagnostic);
652651
return sys.exit(ExitStatus.DiagnosticsPresent_OutputsSkipped);
653652
}
654-
// eslint-disable-next-line no-restricted-syntax
655-
sys.write(JSON.stringify(convertToTSConfig(configParseResult, configFileName, sys), null, 4) + sys.newLine);
656653
return sys.exit(ExitStatus.Success);
657654
}
658655
reportDiagnostic = updateReportDiagnostic(

0 commit comments

Comments
 (0)