prettier / prettier/plugin-pug

mixin arguments can not be formatted

Open
#66 3 comments 4 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

type: enhancement
Dominant language
TypeScript
Stars
208
Forks
49
Avg merge
4h 26m
Merged PRs (30d)
8

Description

If I have the following formatted code:

+link({
  name: 'Solutions', 
  subnav: {
    sublinks: [
       {name: 'WISP', url: '#', icon:'wisp'},
       {name: 'Fiber', url: '#', icon:'fiber'},
       {name: 'MDU', url: '#', icon:'mdu'},
       {name: 'Voice', url: '#', icon:'voice'},
       {name: 'Cable', url: '#', icon:'cable'},
       {name: 'Enterprise', url: '#', icon:'enterprise'}
    ]
  }
})

It gets formatted to the following:

+link({ name: 'Solutions', subnav: { sublinks: [ {name: 'WISP', url: '#', icon:'wisp'}, {name: 'Fiber', url: '#', icon:'fiber'}, {name: 'MDU', url: '#', icon:'mdu'}, {name: 'Voice', url: '#', icon:'voice'}, {name: 'Cable', url: '#', icon:'cable'}, {name: 'Enterprise', url: '#', icon:'enterprise'} ] }})

Is there any possible way to prevent this reformatting from happening, as it makes parsing the information far more difficult?

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the supplied Pug mixin input and its formatted output. Trace the formatter behavior for multiline mixin arguments; done means preserving a readable multiline structure instead of collapsing the argument object onto one line, with a regression test for this example.

Written by the indexing model from the issue text.

Assessment

Tech stack
pug
Domain
tooling
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.