From 25af4f385fcaeb9176c5298fec26c044e0961dc8 Mon Sep 17 00:00:00 2001 From: Pagan Gazzard Date: Wed, 17 Jul 2024 14:22:55 +0100 Subject: [PATCH] Output linting failures as soon as they're available Change-type: patch --- lib/balena-lint.ts | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/lib/balena-lint.ts b/lib/balena-lint.ts index bb7e216..a6e1a2d 100644 --- a/lib/balena-lint.ts +++ b/lib/balena-lint.ts @@ -104,11 +104,15 @@ const lintTsFiles = async function ( const linter = new ESLint(config); const totalResults: ESLint.LintResult[] = await linter.lintFiles(files); - const unformattedFiles: string[] = []; if (config.fix) { await ESLint.outputFixes(totalResults); } + if (totalResults.length > 0) { + const formatter = await linter.loadFormatter('stylish'); + console.log(await formatter.format(totalResults)); + } + const unformattedFiles: string[] = []; await Promise.all( files.map(async (file) => { const prettierConfigWithPath: prettier.Options = { @@ -138,10 +142,6 @@ const lintTsFiles = async function ( } }), ); - if (totalResults.length > 0) { - const formatter = await linter.loadFormatter('stylish'); - console.log(await formatter.format(totalResults)); - } return totalResults.some((l) => l.errorCount > 0 || l.fatalErrorCount > 0) || unformattedFiles.length > 0