Skip to content

Marko with javascript inline is not formatted properly #192

@okannivadikubendran

Description

@okannivadikubendran

Using @marko/prettyprint - 3.0.1 with the command marko-prettyprint . --single-quote --max-len 120, we are seeing following issues:

  1. First line in the script block is not indented similar to the other lines
  2. Shorthand notation is not working for the marko attributes in the options of sample-header

Given:

$ const { model, options } = input;
<if(model)>
    $ {
        const {foo} = model;
        const {bar} = foo || {};
        const {xyz} = options || {};
    }
    <div class="app"> <sample-header options={ xyz } />    </div>
</if>

Expected:

$ const { model, options } = input;
<if(model)>
    $ {
        const { foo } = model;
        const { bar } = foo || {};
        const { xyz } = options || {};
    }
    <div class='app'>
        <sample-header options={ xyz }/>
    </div>
</if>

Actual:

$ const { model, options } = input;
<if(model)>
    $ {
        const { foo } = model;
            const { bar } = foo || {};
            const { xyz } = options || {};
    }
    <div class='app'>
        <sample-header options={
            xyz: xyz
        }/>
    </div>
</if>

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions