From 598ac1c7506607dddbca64de96990c9068ae9faf Mon Sep 17 00:00:00 2001 From: samreid Date: Fri, 8 Jan 2021 13:58:31 -0700 Subject: [PATCH] Use _.sum, see https://github.com/phetsims/chipper/issues/1000 --- js/grunt/lint.js | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/js/grunt/lint.js b/js/grunt/lint.js index 567b55ea..7b701e06 100644 --- a/js/grunt/lint.js +++ b/js/grunt/lint.js @@ -87,11 +87,9 @@ const lint = async ( patterns, options ) => { const formatter = await eslint.loadFormatter( 'stylish' ); const resultText = formatter.format( results ); - const sum = ( a, b ) => a + b; - const count = numbers => numbers.length === 0 ? 0 : numbers.reduce( sum ); + const totalWarnings = _.sum( results.map( result => result.warningCount ) ); + const totalErrors = _.sum( results.map( result => result.errorCount ) ); - const totalWarnings = count( results.map( result => result.warningCount ) ); - const totalErrors = count( results.map( result => result.errorCount ) ); const total = totalWarnings + totalErrors; // 5. Output it.