Skip to content

Commit

Permalink
Merge pull request #259 from laravel/feat/prettier-plugin
Browse files Browse the repository at this point in the history
Feat/prettier plugin
  • Loading branch information
nunomaduro authored Mar 16, 2024
2 parents dce1b6b + ac1dbb7 commit dbde266
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion app/Fixers/LaravelBladeFixer.php
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,13 @@ protected function applyFix(SplFileInfo $file, Tokens $tokens): void
$result = app(Prettier::class)->run([$path]);

if ($result->failed()) {
throw new PrettierException($result->errorOutput());
$error = $result->errorOutput();

if (str($error)->startsWith('[error]') && str($error)->contains('SyntaxError:')) {
$error = str($error)->after('SyntaxError: ')->before("\n")->value();
}

throw new PrettierException($error);
}

$tokens->setCode($result->output());
Expand Down
Binary file modified builds/pint
Binary file not shown.

0 comments on commit dbde266

Please sign in to comment.