Skip to content

Commit

Permalink
Merge pull request #109 from balena-io-modules/output-asap
Browse files Browse the repository at this point in the history
Output linting failures as soon as they're available
  • Loading branch information
Page- authored Jul 17, 2024
2 parents 47617a7 + 25af4f3 commit 6742263
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions lib/balena-lint.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 = {
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 6742263

Please sign in to comment.