shufo / prettier-plugin-blade

Format your blade template using Prettier
https://www.npmjs.com/package/@shufo/prettier-plugin-blade
MIT License
318 stars 8 forks source link

[Formatting Bug]: Arrays are being collapse on a single line #235

Closed calebdw closed 8 months ago

calebdw commented 9 months ago

Version

1.11.1

Template before formatting

@props([
    'name',
    'title'                => 'Please Confirm',
    'message'              => 'Are you sure?',
    'level'                => 'info',
    'icon'                 => 'heroicon-o-question-mark-circle',
    'cancelButtonText'     => 'No',
    'cancelButtonType'     => 'muted',
    'affirmButtonText'     => 'Yes',
    'affirmButtonType'     => 'success',
    'affirmButtonDisabled' => false,
])

Template after formatting

@props(['name', 'title' => 'Please Confirm', 'message' => 'Are you sure?', 'level' => 'info', 'icon' => 'heroicon-o-question-mark-circle', 'cancelButtonText' => 'No', 'cancelButtonType' => 'muted', 'affirmButtonText' => 'Yes', 'affirmButtonType' => 'success', 'affirmButtonDisabled' => false])

Expected Behaviour

It should stay the same, I don't want the array collapsed and it most definitely exceeds the line limit of 120 chars.

Relevant log output

No response

Andreas-Halemba commented 9 months ago

@shufo can you confirm this as expected behaviour?

shufo commented 8 months ago

Fixed at https://github.com/shufo/prettier-plugin-blade/releases/tag/v1.13.2

chrillep commented 6 months ago

@shufo same goes for any arrays, is this intended? :)

@php
$array = [
    'col-span-1',
    'flex',
    'flex-col',
    'gap-6',
    'border',
    'border-secondary1',
    'py-6',
    'rounded-4xl'
];
@endphp

becomes

@php
$array = ['col-span-1', 'flex', 'flex-col', 'gap-6', 'border', 'border-secondary1', 'py-6', 'rounded-4xl'];
@endphp