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