Stillat / blade-parser-typescript

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

SyntaxError: Unpaired condition control structure (@hasSection) #92

Closed luveqz closed 7 months ago

luveqz commented 7 months ago

Problem

I'm trying to use the @hasSection directive, but then the plugin throws a:

SyntaxError: Unpaired condition control structure

Code:

@hasSection('sidebar') 
  <aside class="sidebar">
    @yield('sidebar')
  </aside>
@endif 

I tried to make Prettier to ignore that block, but it didn't work either.

Demo

Open this minimal StackBlitz demo and run:

npm run lint app.blade.php
JohnathonKoster commented 7 months ago

The ignore start/end just stops it from formatting that specific section of the document (but the Blade parser will still attempt to parse it to figure out what it should do).

I've updated the parser and just published v2.1.1 to address this specific parsing issue, however