Skip to content

Commit f1c7d72

Browse files
Apply formatting and finalize fix for --showConfig
Co-authored-by: RyanCavanaugh <[email protected]>
1 parent d4fb9b4 commit f1c7d72

2 files changed

Lines changed: 24 additions & 26 deletions

File tree

src/compiler/executeCommandLine.ts

Lines changed: 16 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -638,24 +638,22 @@ function executeCommandLineWorker(
638638
if (configFileName) {
639639
const extendedConfigCache = new Map<string, ExtendedConfigCacheEntry>();
640640
const configParseResult = parseConfigFileWithSystem(configFileName, commandLineOptions, extendedConfigCache, commandLine.watchOptions, sys, reportDiagnostic)!; // TODO: GH#18217
641-
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 =>
644-
error.code !== Diagnostics.No_inputs_were_found_in_config_file_0_Specified_include_paths_were_1_and_exclude_paths_were_2.code
645-
);
646-
647-
if (errorsExcludingNoInputs.length !== 0) {
648-
reportDiagnostic = updateReportDiagnostic(
649-
sys,
650-
reportDiagnostic,
651-
configParseResult.options,
652-
);
653-
errorsExcludingNoInputs.forEach(reportDiagnostic);
654-
return sys.exit(ExitStatus.DiagnosticsPresent_OutputsSkipped);
655-
}
656-
// eslint-disable-next-line no-restricted-syntax
657-
sys.write(JSON.stringify(convertToTSConfig(configParseResult, configFileName, sys), null, 4) + sys.newLine);
658-
return sys.exit(ExitStatus.Success);
641+
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) {
646+
reportDiagnostic = updateReportDiagnostic(
647+
sys,
648+
reportDiagnostic,
649+
configParseResult.options,
650+
);
651+
errorsExcludingNoInputs.forEach(reportDiagnostic);
652+
return sys.exit(ExitStatus.DiagnosticsPresent_OutputsSkipped);
653+
}
654+
// eslint-disable-next-line no-restricted-syntax
655+
sys.write(JSON.stringify(convertToTSConfig(configParseResult, configFileName, sys), null, 4) + sys.newLine);
656+
return sys.exit(ExitStatus.Success);
659657
}
660658
reportDiagnostic = updateReportDiagnostic(
661659
sys,

src/testRunner/unittests/config/showConfig.ts

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -129,14 +129,14 @@ describe("unittests:: config:: showConfig", () => {
129129
include: [
130130
"${configDir}/src/**/*", // eslint-disable-line no-template-curly-in-string
131131
],
132-
files: ["${configDir}/main.ts"], // eslint-disable-line no-template-curly-in-string
133-
});
134-
135-
// Test that --showConfig works even when no input files are found
136-
showTSConfigCorrectly("Show TSConfig with no input files", ["-p", "tsconfig.json"], {
137-
include: ["./*"],
138-
});
139-
132+
files: ["${configDir}/main.ts"], // eslint-disable-line no-template-curly-in-string
133+
});
134+
135+
// Test that --showConfig works even when no input files are found
136+
showTSConfigCorrectly("Show TSConfig with no input files", ["-p", "tsconfig.json"], {
137+
include: ["./*"],
138+
});
139+
140140
// Bulk validation of all option declarations
141141
for (const option of ts.optionDeclarations) {
142142
baselineOption(option, /*isCompilerOptions*/ true);

0 commit comments

Comments
 (0)