Stillat / blade-parser-typescript

A Laravel Blade parser, compiler, and static analyzer written in TypeScript.
https://stillat.com
MIT License
90 stars 3 forks source link

Comments within tag attributes broken? #68

Closed cheesegrits closed 1 year ago

cheesegrits commented 1 year ago

It seems that any sort of comment within tag attributes breaks things, to the point it errors out.

    <div
        x-data="{
            @unless(config('filament-media-library.settings.show-upload-box-by-default'))
            showUploadBox: false,
            @endunless
        }"
        {{-- This event is dispatched from Livewire, so we need an event listener in addition to the global store. --}}
        @unless(config('filament-media-library.settings.show-upload-box-by-default'))
            x-on:toggle-upload-box.window="showUploadBox = ! showUploadBox"
        @endunless
    >

This doesn't format the Blade file at all from within PHP Storm. If I run prettier by hand on the command line ...

SyntaxError: Unexpected closing tag "div". It may happen when the tag has already been closed by another tag. For more info see https://www.w3.org/TR/html5/syntax.html#closing-elements-that-have-implied-end-tags (349:1)
[error]   347 |         </x-filament::modal>
[error]   348 |     </div>
[error] > 349 | </div>
[error]       | ^^^^^^
[error]   350 |

The divs are correctly closed. If I move that comment so it's outside the tag, everything works again. I've also tried HTML style comments, same thing.

JohnathonKoster commented 1 year ago

This has been resolved in 1.6.7 🙂