@@ -68,7 +68,15 @@ function collect(): Baseline {
6868 const ruleToMetric = new Map < string , Metric > (
6969 Object . entries ( METRICS ) . map ( ( [ metric , rule ] ) => [ rule , metric as Metric ] )
7070 )
71- for ( const line of result . stdout . toString ( ) . split ( '\n' ) ) {
71+ const lines = result . stdout . toString ( ) . split ( '\n' )
72+ // A file Biome cannot parse yields an undercount, so a parse error fails the audit outright.
73+ const unparsable = lines . filter ( ( line ) => line . startsWith ( '::error title=parse,' ) )
74+ if ( unparsable . length ) {
75+ console . error ( `✗ Biome could not parse ${ unparsable . length } location(s); fix the syntax first:` )
76+ for ( const line of unparsable ) console . error ( ` ${ line . replace ( / ^ : : e r r o r t i t l e = p a r s e , / , '' ) } ` )
77+ process . exit ( 1 )
78+ }
79+ for ( const line of lines ) {
7280 const match = / ^ : : \w + t i t l e = ( [ ^ , ] + ) , f i l e = ( [ ^ , ] + ) , / . exec ( line )
7381 const metric = match && ruleToMetric . get ( match [ 1 ] )
7482 if ( ! match || ! metric ) continue
@@ -131,7 +139,17 @@ function shrunkTo(after: Counts, before: Counts): Counts {
131139 )
132140}
133141
142+ const suppressed = suppressions ( )
143+ if ( suppressed . length ) {
144+ console . error (
145+ `✗ ${ suppressed . length } biome-ignore comment(s) hide an \`any\` or \`!\` from this check:`
146+ )
147+ for ( const line of suppressed ) console . error ( ` ${ line } ` )
148+ console . error ( ' Delete the suppression and fix the type instead.\n' )
149+ }
150+
134151if ( process . argv . includes ( '--update' ) ) {
152+ if ( suppressed . length ) process . exit ( 1 )
135153 const next : Baseline = {
136154 explicitAny : sorted ( shrunkTo ( current . explicitAny , baseline . explicitAny ?? { } ) ) ,
137155 nonNullAssertion : sorted ( shrunkTo ( current . nonNullAssertion , baseline . nonNullAssertion ?? { } ) ) ,
@@ -162,15 +180,6 @@ let stale = 0
162180/** A vanished baselined file next to a new file with no more hits: likely a rename. */
163181const renames = new Set < string > ( )
164182
165- const suppressed = suppressions ( )
166- if ( suppressed . length ) {
167- console . error (
168- `✗ ${ suppressed . length } biome-ignore comment(s) hide an \`any\` or \`!\` from this check:`
169- )
170- for ( const line of suppressed ) console . error ( ` ${ line } ` )
171- console . error ( ' Delete the suppression and fix the type instead.\n' )
172- }
173-
174183for ( const metric of Object . keys ( METRICS ) as Metric [ ] ) {
175184 const before = baseline [ metric ] ?? { }
176185 const after = current [ metric ]
0 commit comments