Skip to content

Commit

Permalink
NGSTACK-957 read and output stderr from eslint and prettier
Browse files Browse the repository at this point in the history
  • Loading branch information
amalija-ramljak committed Dec 17, 2024
1 parent 1c1f32c commit f0102a6
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 6 deletions.
8 changes: 5 additions & 3 deletions src/Action/JSLinter.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,10 @@ protected function doExecute(Config $config, IO $io, Repository $repository, Con

$result = $this->lintFile($file, $linterCommand, $linterOptions);

$io->write($result['output']);

if ($result['success'] !== true) {
if ($result['success'] === true) {
$io->write($result['output']);
} else {
$io->writeError(sprintf('<error>%s</error>', $result['error']));
$this->throwError($action, $io);
}
}
Expand Down Expand Up @@ -85,6 +86,7 @@ protected function lintFile(string $file, string $linterCommand, string $linterO
return [
'success' => $result->isSuccessful(),
'output' => $result->getStdOut(),
'error' => $result->getStdErr(),
];
}
}
8 changes: 5 additions & 3 deletions src/Action/JSPrettier.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,10 @@ protected function doExecute(Config $config, IO $io, Repository $repository, Con

$result = $this->lintFile($file, $prettierCommand, $prettierOptions);

$io->write($result['output']);

if ($result['success'] !== true) {
if ($result['success'] === true) {
$io->write($result['output']);
} else {
$io->writeError(sprintf('<error>%s</error>', $result['error']));
$this->throwError($action, $io);
}
}
Expand Down Expand Up @@ -85,6 +86,7 @@ protected function lintFile(string $file, string $prettierCommand, string $prett
return [
'success' => $result->isSuccessful(),
'output' => $result->getStdOut(),
'error' => $result->getStdErr(),
];
}
}

0 comments on commit f0102a6

Please sign in to comment.