@@ -1954,7 +1954,7 @@ namespace ts {
1954
1954
}
1955
1955
1956
1956
const result = matchFileNames ( filesSpecs , includeSpecs , excludeSpecs , configFileName ? directoryOfCombinedPath ( configFileName , basePath ) : basePath , options , host , errors , extraFileExtensions , sourceFile ) ;
1957
- if ( result . fileNames . length === 0 && ! hasProperty ( raw , "files" ) && resolutionStack . length === 0 && ! hasProperty ( raw , "references" ) ) {
1957
+ if ( shouldReportNoInputFiles ( result , canJsonReportNoInutFiles ( raw ) , resolutionStack ) ) {
1958
1958
errors . push ( getErrorForNoInputFiles ( result . spec , configFileName ) ) ;
1959
1959
}
1960
1960
@@ -1989,20 +1989,39 @@ namespace ts {
1989
1989
}
1990
1990
}
1991
1991
1992
- /*@internal */
1993
- export function isErrorNoInputFiles ( error : Diagnostic ) {
1992
+ function isErrorNoInputFiles ( error : Diagnostic ) {
1994
1993
return error . code === Diagnostics . No_inputs_were_found_in_config_file_0_Specified_include_paths_were_1_and_exclude_paths_were_2 . code ;
1995
1994
}
1996
1995
1997
- /*@internal */
1998
- export function getErrorForNoInputFiles ( { includeSpecs, excludeSpecs } : ConfigFileSpecs , configFileName : string | undefined ) {
1996
+ function getErrorForNoInputFiles ( { includeSpecs, excludeSpecs } : ConfigFileSpecs , configFileName : string | undefined ) {
1999
1997
return createCompilerDiagnostic (
2000
1998
Diagnostics . No_inputs_were_found_in_config_file_0_Specified_include_paths_were_1_and_exclude_paths_were_2 ,
2001
1999
configFileName || "tsconfig.json" ,
2002
2000
JSON . stringify ( includeSpecs || [ ] ) ,
2003
2001
JSON . stringify ( excludeSpecs || [ ] ) ) ;
2004
2002
}
2005
2003
2004
+ function shouldReportNoInputFiles ( result : ExpandResult , canJsonReportNoInutFiles : boolean , resolutionStack ?: Path [ ] ) {
2005
+ return result . fileNames . length === 0 && canJsonReportNoInutFiles && ( ! resolutionStack || resolutionStack . length === 0 ) ;
2006
+ }
2007
+
2008
+ /*@internal */
2009
+ export function canJsonReportNoInutFiles ( raw : any ) {
2010
+ return ! hasProperty ( raw , "files" ) && ! hasProperty ( raw , "references" ) ;
2011
+ }
2012
+
2013
+ /*@internal */
2014
+ export function updateErrorForNoInputFiles ( result : ExpandResult , configFileName : string , configFileSpecs : ConfigFileSpecs , configParseDiagnostics : Diagnostic [ ] , canJsonReportNoInutFiles : boolean ) {
2015
+ const existingErrors = configParseDiagnostics . length ;
2016
+ if ( shouldReportNoInputFiles ( result , canJsonReportNoInutFiles ) ) {
2017
+ configParseDiagnostics . push ( getErrorForNoInputFiles ( configFileSpecs , configFileName ) ) ;
2018
+ }
2019
+ else {
2020
+ filterMutate ( configParseDiagnostics , error => ! isErrorNoInputFiles ( error ) ) ;
2021
+ }
2022
+ return existingErrors !== configParseDiagnostics . length ;
2023
+ }
2024
+
2006
2025
interface ParsedTsconfig {
2007
2026
raw : any ;
2008
2027
options ?: CompilerOptions ;
0 commit comments