shufo / blade-formatter

An opinionated blade template formatter for Laravel that respects readability
https://www.npmjs.com/package/blade-formatter
MIT License
456 stars 25 forks source link

[Feature]: Improve inconsistent output of prettier/plugin-php for Blade directives regarding whitespace #862

Closed ldommer closed 2 weeks ago

ldommer commented 1 year ago

Description

Nearly all Blade directives are formatted without whitespace between the directive and the following bracket, for example:

@switch($foo)

But some are formatted with whitespace between the directive and the following bracket, for example:

@if ($foo === 'bar')

To me this is pretty inconsistent.

In plain PHP for example, both are formatted with a whitespace between the statement and the following bracket.

So it would be cool to have all Blade directives formatted without a whitespace between the directive and the following bracket or to have a choice for config which ones will and which ones not.

Where does this formatting come from? From the Blade Formatter oder from Prettier Plugin PHP?

Is there any easy solution for this formatting, to have it consistent (and maybe configurable)?

Suggested Solution

Pretty much the description above. I would be nice to start a discussion about this formatting behaviour and where it derives from.

Alternatives

No response

Additional Context

No response

github-actions[bot] commented 12 months ago

This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 5 days

github-actions[bot] commented 9 months ago

This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 5 days

github-actions[bot] commented 7 months ago

This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 5 days

github-actions[bot] commented 4 weeks ago

This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 5 days