Skip to content

[Formatting Bug]: @js() directives are being replaced with undefined #305

@calebdw

Description

@calebdw

Version

1.15.2

Template before formatting

@section('js_bottom')
    @parent
    <script>
        $(function() {
            @foreach ($files as $file)
                addUpload(
                    @js($file->id),
                    @js($file->name),
                    @js($file->hash),
                    $('#article_inline_uploads')
                );
            @endforeach
        }
    </script>
@endsection

Template after formatting

@section('js_bottom')
    @parent
    <script>
        $(function() {
                    @foreach ($files as $file)
                        addUpload(
                            undefined,
                            undefined,
                            undefined,
                            $('#article_inline_uploads')
                        );
                    @endforeach
                }
    </script>
@endsection

Expected Behaviour

It should not remove code and replace it with undefined

Relevant log output

$ npx blade-formatter resources/views/form-js.blade.php
@section('js_bottom')
    @parent
    <script>
        $(function() {
                    @foreach ($files as $file)
                        addUpload(
                            undefined,
                            undefined,
                            undefined,
                            $('#article_inline_uploads')
                        );
                    @endforeach
                }
    </script>
@endsection

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions