@@ -139,13 +139,12 @@ async function check({
139139 }
140140 }
141141
142- printResults ( results , { shouldPrintSuccesses, shouldPrintSuppressedErrors} ) ;
142+ const isPassed = printResults ( results , { shouldPrintSuccesses, shouldPrintSuppressedErrors} ) ;
143143
144144 if ( shouldGenerateReport ) {
145145 generateReport ( results , reportFileName ) ;
146146 }
147147
148- const isPassed = results . failures . size === 0 && ( results . enforcedAddedComponentFailures ?. size ?? 0 ) === 0 ;
149148 return isPassed ;
150149}
151150
@@ -622,7 +621,7 @@ function findManualMemoizationMatches(source: string): ManualMemoizationMatch[]
622621function printResults (
623622 { success, failures, suppressedFailures, enforcedAddedComponentFailures} : CompilerResults ,
624623 { shouldPrintSuccesses, shouldPrintSuppressedErrors} : PrintResultsOptions ,
625- ) : void {
624+ ) : boolean {
626625 if ( shouldPrintSuccesses && success . size > 0 ) {
627626 log ( ) ;
628627 logSuccess ( `Successfully compiled ${ success . size } files with React Compiler:` ) ;
@@ -665,23 +664,26 @@ function printResults(
665664
666665 const hasEnforcedAddedComponentFailures = enforcedAddedComponentFailures && enforcedAddedComponentFailures . size > 0 ;
667666
668- const isPassed = failures . size === 0 && ! hasEnforcedAddedComponentFailures ;
669- if ( isPassed ) {
670- logSuccess ( 'All files pass React Compiler compliance check!' ) ;
671- return ;
672- }
673-
674667 const distinctFileNames = new Set < string > ( ) ;
675668 for ( const failure of failures . values ( ) ) {
676669 distinctFileNames . add ( failure . file ) ;
677670 }
678671
679- if ( distinctFileNames . size > 0 ) {
672+ const shouldPrintWarnings = distinctFileNames . size > 0 ;
673+
674+ if ( shouldPrintWarnings ) {
680675 log ( ) ;
681- logError ( `Failed to compile ${ distinctFileNames . size } files with React Compiler:` ) ;
676+ logWarn ( `Failed to compile ${ distinctFileNames . size } files with React Compiler:` ) ;
682677 log ( ) ;
683678
684679 printFailures ( failures ) ;
680+
681+ log ( ) ;
682+ logWarn ( 'React Compiler errors were printed as warnings for transparency, but these must NOT be fixed and can be ignored.' ) ;
683+ }
684+
685+ if ( shouldPrintWarnings && ! hasEnforcedAddedComponentFailures ) {
686+ log ( ) ;
685687 }
686688
687689 if ( hasEnforcedAddedComponentFailures ) {
@@ -704,8 +706,16 @@ function printResults(
704706 }
705707 }
706708
709+ const isPassed = ! hasEnforcedAddedComponentFailures ;
710+ if ( isPassed ) {
711+ logSuccess ( `React Compiler compliance check passed ${ shouldPrintWarnings ? 'with warnings' : '' } !` ) ;
712+ return true ;
713+ }
714+
707715 log ( ) ;
708716 logError ( 'The files above failed the React Compiler compliance check. Please fix the issues and run the check again...' ) ;
717+
718+ return false ;
709719}
710720
711721function printFailures ( failuresToPrint : FailureMap , level = 0 ) {
0 commit comments